0
votes

Is there a better way to fix this:

translation file:

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

You get the point. The app im working is growing in a rediculous, no, MASSIVE in size just because of this. Hundreds of duplicate strings to translate the same thing over and over again

Is there a way to create variables in translation files? So that i woul have to define the word monday once..

1

1 Answers

0
votes

You can use message placeholders in your translation

See http://symfony.com/doc/current/components/translation/usage.html#component-translation-placeholders

for example :

echo $t->trans('on %date% bla'), array('%date%'=>$t->trans('Monday'));