i18n and l10n in cakephp
In order to add I18n and l10n into Jqcms, I have been searching internet to implement this feature.
And this is my final solution of I18n and l10n in cakephp .
Please note my current cakephp version is 1.2.1 .
1.Create your locale file.
The file path is app/locale/eng/LC_MESSAGES/default.po.
You could create your customized locale file such as app/locale/fre/LC_MESSAGES/default.po.
app/locale/rus/LC_MESSAGES/default.po.
whereas, default.po is the actually locale file which contains the content.
It is recommanded to use po edit to edit this locale file due to its encoding.
However, when I used notepad to edit it, it works still fine.
The content of the file looks like this:
msgid is the id of the string , msgstr is the string content. You could create as many pairs as you need. 2.Initialize your locale To tell cakephp which locale you want to use, or change current locale file. I did this in my controller: However, I found out that doing this is fine too 3.View your locale String After two simple steps above, now you can make use of it by doing : Please note it is a double underscore __ instead of single underscore _ If you wish to use po editor create or edit your locale file, refer to http://www.bunchacode.com/programming/internationalization-and-localization-in-cakephp/ Thanks for reading. Please comment if you have any problem or I have made any mistakes.
</code></code></code>
msgid "add"
msgstr "Add Content"
<code>
</code>
$this->Session->write('Config.language','en');
<code>
</code>
Configure::write('Config.language','rus');
<code>
</code>
__("add")
<code>
