Symfony Translation Using YAML Files

I am currently facing a translation problem in symfony2.

Some translations are downloaded, some are not.

My messages .de.yml:

form: label: save: Speichern status: daten_mangelhaft: Die Daten scheinen etwas mager zu sein, bitte überprüfen. 

Some twig files:

 {{ 'form.label.save'|trans }} 

(as was expected):

 Speichern 

while (same twig file):

 {{ 'status.daten_mangelhaft'|trans }} 

outputs:

 status.daten_mangelhaft 

If I add it to message.de.yml as follows, it will work:

 status.daten_mangelhaft: Die Daten scheinen etwas mager zu sein, bitte überprüfen. 

I really don't understand, it works in some cases, but not in others.

I tried:

  • Flush cache
  • omitting special characters (ä, ö, ü) in translations
  • descending on the account in the identifier
  • Convert translations to quotation marks or single quotation marks

to no avail.

Has anyone had this problem before? How did you solve it?

+5
source share
2 answers

How true is this?

However: have you checked your spare language in your config.yml?

 framework: translator: {fallbacks: ['de']} default_locale: 'de' 

You can also use the locale parameter from the parameters.yml file and have:

 framework: translator: {fallbacks: ['%locale%']} default_locale: '%locale%' 
0
source

Try running php app/console translation:update after deleting your translations (you saved them). He must make a list of the translations you need. With this, you would be sure where and what to write.

-1
source

Source: https://habr.com/ru/post/1205355/


All Articles