CakePHP 2.1.po files / translation does not work
I use <?php echo __("this is my string"); ?>inside my views to display text in several languages. I created a directory of .po files for German:
=> app / Locale / ger / LC_MESSAGES / default.po
msgstr "this is my line"
msgstr "dying from meine zeichenkette"
When I add Configure::write('Config.language','ger');beforeController.php to my function AppController.php, the text still remains “this is my line”. Even if I create .po for English with another msgstr, the text remains the same.
Do I need to change a specific parameter to activate the translation?
I have a problem: I added Configure::write('Config.language','eng');in core.php to set my default language, but now I can’t change the value even if I try to override it in AppController.php beforeFilter with:
Configure::write('Config.language', 'deu'); //'de' also doesn't work
CakeSession::write('Config.language', 'deu'); //'de' also doesn't work
If I changed the value in core.php, it works fine, but after installing in core.php I can’t change it.
resolved: ah, I forgot to add parent::beforeFilter();all the controllers to the beforeFilter function.
Additional Information:
- If you want to define the default language (and usually will), add
Configure::write('Config.language', 'eng');in core.php
"deu" "ger"
CakePHP (T) http://www.loc.gov/standards/iso639-2/php/code_list.php, CakePHP 1.3 :
ISO 639-2, , (en_US, en_GB ..) ) , .
ISO 639-2 | ISO 639-1 | English name | French name | German name |
Code | Code | of Language | of Language | of Language |
-------------------------------------------------------------------
ger (B) | | | | |
deu (T) | de | German | allemand | Deutsch |