Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the .po file from .pot files

I use cakePHP 2.0 and use the console tool to create one .../app/locale/default.pot . Now, I would like to get my site translated into multiple languages. I read the paragraph about internationalization in the cakephp cook book (http://book.cakephp.org/1.2/en/view/162/Internationalizing-Your-Application).

I copy the default.pot files into

  • .../app/locale/eng/LC_MESSAGES/default.pot
  • .../app/locale/fre/LC_MESSAGES/default.pot
  • .../app/locale/pol/LC_MESSAGES/default.pot
  • ...

And enter the tranalations string with an utf-8 text editor (as gedit). And ... my site do not get translated at all.

I have noticed the AppController may implement some code to change the Configure::write('Config.language', some_three_letters_language), as the configuration changed nothing, I have implemented some very simple code.

// in AppController
public function beforeFilter() {
        Configure::write('Config.language', 'fre');
}

Why does the translation function always return it arguments and not the translated string in .pot files ( in views, __('Something') -answers-> 'Something')?

I found nowhere were .pot files are translated into .po. How can I get those .po files, with REHL or CentOS (cannot get any suitable packet with po or poeditor in the name)?

Thanks for your answer.

like image 864
MUY Belgium Avatar asked Apr 10 '12 07:04

MUY Belgium


1 Answers

.pot and .po files are the same file format. .pot stands for "PO template". The difference being that you're supposed to use this template file and give it to your translators, who will produce the translated .po files. The .pot file is the template for several localized .po files. See http://www.gnu.org/software/gettext/manual/gettext.html#Files.

In other words, just renaming .pot to .po will do.
In the proper gettext workflow, there's the msginit tool for doing this, which will also set a number of headers to the correct values for the chosen locale.

like image 83
deceze Avatar answered Sep 20 '22 12:09

deceze