使用 zend 框架,我和其他许多人一样,发送电子邮件。现在对于电子邮件,我使用视图模板。fx welcome.phtml 欢迎来到我的网站
Hi <?php print $this->name; ?><br />
Welcome to my site.<br /><br />
Regards <?php print $this->siteName; ?>
现在翻译这个有几种方法。我可以将整个文本墙放在 translate();?> 中,所有的 html 都会跟随,所以这是一个愚蠢的想法。
其次,我可以将每个电子邮件模板放在语言文件夹 fx 中。/languages/en_en/emails/welcome.phtml,然后翻译整个文件,html 仍然会跟随,但会更容易。缺点是如果我有 40 种语言,并且模板的 html 发生更改,我将不得不编辑 40 个文件。
第三,我可以把每一行放在一个 print $this->translate(); 但这会给出很多行。
还有其他方法吗?或者哪种方式最好?
一个小问题:如果我有一堵带有一点格式的文字墙,一般该怎么办?可能有 10 行文本,其中一些是粗体字,还有几个
's?translate() 中的整个文本墙;?> ?
问候