I'm running into a very frustrating issue with Cakephp 3. I've just updated all my .ctp files to use (double _ ) but I can't get it to print the localized strings.
I've set the default locale to en_150 in config/app.php:
App' => [
'namespace' => 'App',
'encoding' => env('APP_ENCODING', 'UTF-8'),
'defaultLocale' => env('APP_DEFAULT_LOCALE', 'en_150'),
...
I've tried setting the locale directly in config/bootstrap.php but it had no effect:
ini_set('intl.default_locale', Configure::read('App.defaultLocale'));
I generated the .pot files with cake i18n extract, and then did cake i18n init for the en_150 locale. I believe they are in the correct path:
$ find src/Locale/
src/Locale/
src/Locale/default.po
src/Locale/cake.pot
src/Locale/default.pot
src/Locale/en_150
src/Locale/en_150/default.po
src/Locale/en_150/default.po.po
src/Locale/en_150/cake.po
src/Locale/en_150/default.mo.po
src/Locale/default.mo
The weirdest thing is, I updated the Translator class (vendor/cakephp/cakephp/src/I18n/Translator.php) to log every message key that's being looked up, and I see my keys and debugKit's keys. However, debugKit's keys are looked up twice, once from memory and then from fallback. However, my keys are never looked up w/ fallback.
debugkit's keys:
2017-02-27 13:47:16 Fallback lookup Event: Controller.beforeRender
2017-02-27 13:47:16 Event: Controller.beforeRender
2017-02-27 13:47:16 View Render start
2017-02-27 13:47:16 Fallback lookup View Render start
2017-02-27 13:47:16 View Render start
my keys:
2017-02-27 13:47:16 AppName
2017-02-27 13:47:16 Sign in to start your session
2017-02-27 13:47:16 Email
2017-02-27 13:47:16 Password
2017-02-27 13:47:16 Remember Me
2017-02-27 13:47:16 Sign In
This kinda makes me think that the 'fallback' is actually what goes into the file and reads the translations. And this isn't happening for my translations for some reason.
What I've tried so far:
- delete cache (over 100 times)
- set the default locale (in config/app.php) to something other than en_150 (I was worried this would be an invalid locale name for cakephp)
- switch between .pot <-> .po file extensions for the translation files
- updating .po files in nano & poedit
I've tried to fix this for the last 4 days, so I've definitely tried many other things I can't recall right now.
I'll appreciate any pointers anyone can provide