Skip to content
Prashant Shah edited this page Dec 26, 2015 · 9 revisions

Steps to translate Webzash into your own language

Lets assume you are going to translate the application in "French" (fra)

Step 1: Create a folder for your language in the app/Plugin/Webzash/Locale folder called "fra"

$mkdir app/Plugin/Webzash/Locale/fra

Step 2: Create a folder called "LC_MESSAGES" inside the above (Step 1) folder.

$mkdir app/Plugin/Webzash/Locale/fra/LC_MESSAGES

Step 3: Create a translation file from the translation template inside the above folder (Step 2). This is done by copying app/Plugin/Webzash/Locale/webzash.pot to app/Plugin/Webzash/Locale/fra/LC_MESSAGES/webzash.po

Note : File extension for the translation template is .pot and the file extension for the translation file is .po

$cp app/Plugin/Webzash/Locale/webzash.pot app/Plugin/Webzash/Locale/fra/LC_MESSAGES/webzash.po

Step 4: Edit the translation file app/Plugin/Webzash/Locale/fra/LC_MESSAGES/webzash.po and replace the msgstr for each msgid in the entire file.

It works similar to Gettext implementations. There are free tools such as PoEdit available which make editing and updating your po files an easy task.

Step 5: Enable translation in the application by uncommenting any of the line numbered 83 OR line numbered 84 in app/Plugin/Webzash/Controller/WebzashAppController.php and setting the correct language as per the folder name created in Step 1.

// Configure::write('Config.language', 'fra');

OR

// CakeSession::write('Config.language', 'fra');

That's it !


Links

http://book.cakephp.org/2.0/en/console-and-shells/i18n-shell.html

http://book.cakephp.org/2.0/en/core-libraries/internationalization-and-localization.html

http://www.localizingjapan.com/blog/2011/11/10/localizing-a-cakephp-application/

$Console/cake i18n extract --plugin Webzash