Using zend framework, i, as many others, send emails. Now for the email i use a view template. f.x. welcome.phtml Welcome to my site
Hi <?php print $this->name; ?><br />
Welcome to my site.<br /><br />
Regards <?php print $this->siteName; ?>
Now to translate this there would be several ways. I could put the whole wall of text in a translate();?>, the all the html would follow, so thats a dumb idea.
Secondly i could put each email template in the language folder, fx. /languages/en_en/emails/welcome.phtml, and translate the whole file, the html would still follow, but it would be easier. The downside is that if i have 40 languages, and the html for the template changes, i would have to edit 40 files.
Thirdly i could put each line in a print $this->translate(); but that would give a lot of lines.
Are there other ways? Or which way of doing this are the best?
A little question: What to do generally if i have a wall of text with a little formatting? maybe 10 lines of text, with some words in bold, and a few
's? The whole wall of text in a translate(); ?> ?
Regards
Zend_Translate supports placeholders, so you can also try to create a messages in your translation source like:
and if your data is:
you just can call the translate method
and "%s" will be replaced with actual data