user606521
user606521

Reputation: 15424

i18n console task - how to use it?

I have cake php app and I am using translating function <?php __('msg'); ?>. I my app/config/bootstrap.php I added line Configure::write('Config.language', 'eng'); - I want english as default language.

I created folder app/Locale/eng/LC_MESSAGES.

Then I opened windows console in my app folder and typed 'cake i18n extract' - there were several prompts - I choosed to scan app directory and output to Locale directory.

After i18n procedure in my folder app/Locale few files appeared:

cake.pot
cake_dev.pot
default.pot

and nothing in app/Locale/eng

So I just copied default.pot into app/Locale/eng/LC_MESSAGES and added some translations, but when I open by website nothing is printed in place of __('') functions...

How to correctly set up this?

Upvotes: 3

Views: 2552

Answers (1)

pleasedontbelong
pleasedontbelong

Reputation: 20102

:) you need to create a .po file for each lang from the .pot file you've just created.. I suggest using poedit to do that

In Poedit, go to File->New Catalog from POT file, then select the default.pot file generated by the cake bake. It will ask you some information and then you'll see all the text to translate, one finished, save it into app/Locale/eng/LC_MESSAGES/default.po

when you add/delete/modify some of those strings in your code, you'll need to run the bake again to extract the text. It will update the .pot file, and in Poedit you need to open your .po file and go to Catalog->Update from POT it will show you all the new lines that you need to translate, and sometimes it will try to translate them for you, based on your previous translations

Hope this helps

Upvotes: 3

Related Questions