Devin Crossman
Devin Crossman

Reputation: 7592

cakephp .po files not being used

I'm trying to get CakePHP's i18n component to work. I have extracted my strings to app/Locale/default.pot using the i18n console task. I then copied it into app/Locale/eng/LC_MESSAGES/default.po and app/Locale/fra/LC_MESSAGES/default.po making sure to change the extension. I used the program Virtaal (similar to Poedit) to translate some of the strings.

In my app/Config/core.php I have set my default language to english with Configure::write('Config.language', 'eng'); if I change it to Configure::write('Config.language', 'fra'); I expected to see the new translated strings but nothing changed. I tried setting the Config.language key in the session as well but it didn't do anything. Printing out the configure value and session values I can see they are being set.

Am I missing something here? also in the many different posts I've been reading about i18n in CakePHP I've seen the key fre being used interchangeably with fra is there a difference?

Upvotes: 0

Views: 2720

Answers (1)

bish
bish

Reputation: 3419

After http://book.cakephp.org/1.3/en/The-Manual/Common-Tasks-With-CakePHP/Internationalization-Localization.html it should be fre for french.

// locale path
/app/locale/fre/LC_MESSAGES/default.po (French)

// To change or set the language for your application, all you need to do is the following:
Configure::write('Config.language', 'fre');

// To set the language for the current user, store the setting in the Session object, like this:
$this->Session->write('Config.language', 'fre');

Further than that: In our cakePHP application I have to restart the apache webserver after changing the files to get the new strings because of caching. Perhaps you have to do that too, but I'm not quite sure as we generate .mo files out of the .po via an POEdit setting. I dont't think you are forced to do this, because the cookboke doesn't say anything about that (or I didn't found it now :D ).

edit: Looks like cake is using the bibliographic codes for french but the terminology for german. That's very confusing :/ : http://www.loc.gov/standards/iso639-2/php/code_list.php

Upvotes: 1

Related Questions