The internationalization process is not working.
I ran cake i18n export
. After that I put the translations into the file ".po" in the folder app/locale/por/LC_MESSAGES/default.po.
.
I called the method beforeFilter()
in the AppController Configure::write('Config.language', 'por');
.
But the translation isn't shown in __()
-methods.
Here are some possible suggestions:
• Clear the Cake cache in PATH_YOUR_APP/tmp/cache
. Delete the files in models
and persistent
, but not the directories itself. I believe persistent is where the localised strings are saved, but empty both to be sure.
• Do you override the beforeFilter
in any of your controllers, other than the AppController
? If so call parent::beforeFilter();
in the controller's beforeFilter
method, before processing other stuff, like so:
public function beforeFilter() {
parent:beforeFilter();
//Do stuff here
}
• How did you create the translation files? Is there a .mo
file in the .po
directory as well? I believe directly editing .po
and .pot
files is not recommended due to character encoding issues (but I could be mistaken). Poedit is a good tool for manipulating .po
files, though it could be more robust.
Some more things to check
- Check whether your browser's language is selected properly Portuguese as the first language of choice
- Is your msgid and msgstr keys in individual lines and properly enclosed the text within double quotes?
- I'm not a CakePHP expert, but try moving the configuration to the bootstrap.php. Your code seems logical there.