How to switch translation view render array?

61 views Asked by At

In a cron controller I want to select records for sending mail and render a pdf from pdf.html view to send as attachment. In the pdf.phtml I have a translation based on translation files. Looping through the array translation should change:

for($i=0;$i<count($getData);$i++)

i=0 -> tranlate pdf.phtml to English

i=1 -> translate pdf.phtml to German

I have tried to set the translation every time in the loop

for($i=0;$i<count($getData);$i++) {
select translation file 
$registry->set('Zend_Translate', $objTranslate);
render pdf.

but only the first translation of the i=0 is used for the rendering of the pdf, is does not change for i=1. Whether i=0 is English or German, for i=1 it sticks with English or German.

Any ideas on switching translation for the view renderer in a loop?

1

There are 1 answers

0
zef On BEST ANSWER

My solution is adding different views for each language and calling them in the controller. This is not the preferred solution since now I have to maintain all the views. Maybe somebody comes up with a better solution.