From The Blog

CakePHP: generate .po localization files using Shell

12 October 2013, in CakePHP

 

Using the bake command, cakephp will read all your source files and it will extract all the text to translate. So it's very important that you write the string in the i18n function and don't pass just variables. For example to extract the text, using the command line go to you app directory, and execute the i18n command:

$ cd /var/www/mysite/app
$ ./Console/cake i18n

You'll see:

Welcome to CakePHP v2.0.6 Console
---------------------------------------------------------------
App : app
Path: /var/www/mysite/app/
---------------------------------------------------------------
I18n Shell
---------------------------------------------------------------
[E]xtract POT file from sources
[I]nitialize i18n database table
[H]elp
[Q]uit
What would you like to do? (E/I/H/Q)

Choose "E", to extract the text. Now you'll see:

What is the path you would like to extract?
[Q]uit [D]one
[/var/www/mysite/app/] >

then edit the generated .po file with your translations.

 



Post a Comment