有没有更好的方法来解决这个问题:
翻译文件:
monday: Mondayinmylang
tuesday: Tuesdayinmylang
wedneday: Wednesdayinmylang
thursday: Thursdayinmylang
friday: Fridayinmylang
on monday bla: On mondayinmylang bla
on tuesday bla: On tuesdayinmylang bla
on wednesday bla: On wednesdayinmylang bla
on thursday bla: On thursdayinmylang bla
on friday bla: On fridayinmylang bla
some other string with again monday: .... mondayinmylang
.... monday: !@#$ MONDAY
你明白了。因为这个原因,我正在努力工作的应用程序正在以一种可笑的,不大的,大规模的方式增长。数百个重复的字符串一遍又一遍地翻译相同的东西
有没有办法在翻译文件中创建变量?所以我必须定义星期一一次......
答案 0 :(得分:0)
您可以在翻译中使用邮件占位符
请参阅http://symfony.com/doc/current/components/translation/usage.html#component-translation-placeholders
例如:
echo $t->trans('on %date% bla'), array('%date%'=>$t->trans('Monday'));