3

I have cake 3 fresh installation.

I have a simple po file in this location src/Locale/de_DE/default.po with the following content.

msgid "test"
msgstr "test in german"

On my home page template file I have simple <?php echo __('test'); ?>

I need to set the locale on the fly, so I add this to my AppController's beforeFilter(or initialize) - I18n::locale('de_DE'); however test is not being translated. I can't figure out, what Im missing. I tried renaming all to iso2 - de, but it did not translate either.

Thanks

dav
  • 8,931
  • 15
  • 76
  • 140

2 Answers2

5

Open your Terminal, cd to your project folder (the one which contains the bin folder) and type:

bin/cake cache clear_all

That's all. Refresh your page right after. One last thing, be sure to place your .po files in:

Locale/de_DE/your_translations.po

I like to use POEdit to manage my translations. Cheers.

0

Maybe this helps:

If you are working on a local maschine and use bin/cake i18nto generate the translation files, make sure the files are readable by your local webspace.

This drove me cracy.

Harald Ernst
  • 364
  • 4
  • 10