Version at: 23/02/2014, 01:34 vs. version at: 23/02/2014, 02:01
11#Extracting UI Strings
22
33These instructions describe how to extract UI strings so that they can be translated. The original source of these instructions, stored on Assembla, is here: [1]
44
55
66##Markup for internationalized strings in the code
77
88In the code, whenever developers write strings that will have to be translated, they use a special function whose name consists of a double underscore. A script (CakePHP's "i18n extract" script) can later be run to scan the code and extract the strings that are passed to this function.
99
1010Examples, with the equivalent actions:
1111
1212* __(‘some text’) => echo ‘some text’;
1313* __(‘some text’, true) => return ‘some text’;
1414
1515The language used in the code will be English.
1616
1717##Running cake i18n
1818
1919* Open a console on a Linux machine or Linux virtual machine.
2020* Type : /var/http/tatoeba/cake/console/cake i18n
2121* Choose : E (Extract POT file from source)
2222* When asked if you want to merge all translations into a single file, say yes
2323* Type in the path to app: /home/tatoeba/tatoeba-www/app
2424* Type in the path to locale: /home/tatoeba/tatoeba-www/app/locale
2525* Choose a name for the file that will be generated (in this example, default.pot): default.pot
2626* Choose: Q (quit)
2727
2828##Modifying the header
2929
3030Before you upload the POT file, you may need to open it and change the header into this:
3131
3232msgid ""
3333
3434msgstr ""
3535
3636"Project-Id-Version: \n"
3737
3838"POT-Creation-Date: \n"
3939
4040"PO-Revision-Date: \n"
4141
4242"Last-Translator: \n"
4343
4444"Language-Team: \n"
4545
4646"MIME-Version: 1.0\n"
4747
4848"Content-Type: text/plain; charset=utf-8\n"
4949
5050"Content-Transfer-Encoding: 8bit\n"
5151
5252Otherwise, Launchpad may reject the file.
5353
5454##Uploading default.pot to Launchpad
5555
5656Go to this URL:
5757
5858https://translations.launchpad.net/tatoeba/trunk/+translations-upload
59
60Upload the file.
61
62You may need to wait a day or so for the translation files to be updated.
63
64##Editing .po files
65
66You may need to edit the .po files manually at this stage if you want to restore translations for UI strings that have changed. Skip this step if you don't know what is entailed.
67
68##Check .po files
69
70Use this command on each .po file to ensure that it has the correct syntax:
71
72msgfmt -c filename.po
73
74The Launchpad site executes this step after the .po files are uploaded and approved, but checking the files first will save you more work in the long run.
75
76##Upload .po files
77
78Put all the .po files that have changed into a "tarball", which is a file with the extension .tar.gz or .tar.bz2 . You can use a zipfile utility such as [7Zip](http://www.7-zip.org/) command on Windows or *tar* on Linux to produce the tarball. Then upload them at the same URL that you used to upload the default.pot file.
5979
6080 [1]: https://www.assembla.com/spaces/tatoeba2/wiki/Internationalization
6181
diff view generated by jsdifflib

Version at: 23/02/2014, 01:34

#Extracting UI Strings

These instructions describe how to extract UI strings so that they can be translated. The original source of these instructions, stored on Assembla, is here: [1]


##Markup for internationalized strings in the code

In the code, whenever developers write strings that will have to be translated, they use a special function whose name consists of a double underscore. A script (CakePHP's "i18n extract" script) can later be run to scan the code and extract the strings that are passed to this function.

Examples, with the equivalent actions:

* __(‘some text’) => echo ‘some text’;
* __(‘some text’, true) => return ‘some text’;

The language used in the code will be English.

##Running cake i18n

* Open a console on a Linux machine or Linux virtual machine.
* Type : /var/http/tatoeba/cake/console/cake i18n
* Choose : E (Extract POT file from source)
* When asked if you want to merge all translations into a single file, say yes
* Type in the path to app: /home/tatoeba/tatoeba-www/app
* Type in the path to locale: /home/tatoeba/tatoeba-www/app/locale
* Choose a name for the file that will be generated (in this example, default.pot): default.pot
* Choose: Q (quit)

##Modifying the header

Before you upload the POT file, you may need to open it and change the header into this:
 
msgid ""

msgstr ""

"Project-Id-Version: \n"

"POT-Creation-Date: \n"

"PO-Revision-Date: \n"

"Last-Translator: \n"

"Language-Team: \n"

"MIME-Version: 1.0\n"

"Content-Type: text/plain; charset=utf-8\n"

"Content-Transfer-Encoding: 8bit\n"

Otherwise, Launchpad may reject the file.

##Uploading default.pot to Launchpad

Go to this URL:
 
https://translations.launchpad.net/tatoeba/trunk/+translations-upload

  [1]: https://www.assembla.com/spaces/tatoeba2/wiki/Internationalization

version at: 23/02/2014, 02:01

#Extracting UI Strings

These instructions describe how to extract UI strings so that they can be translated. The original source of these instructions, stored on Assembla, is here: [1]


##Markup for internationalized strings in the code

In the code, whenever developers write strings that will have to be translated, they use a special function whose name consists of a double underscore. A script (CakePHP's "i18n extract" script) can later be run to scan the code and extract the strings that are passed to this function.

Examples, with the equivalent actions:

* __(‘some text’) => echo ‘some text’;
* __(‘some text’, true) => return ‘some text’;

The language used in the code will be English.

##Running cake i18n

* Open a console on a Linux machine or Linux virtual machine.
* Type : /var/http/tatoeba/cake/console/cake i18n
* Choose : E (Extract POT file from source)
* When asked if you want to merge all translations into a single file, say yes
* Type in the path to app: /home/tatoeba/tatoeba-www/app
* Type in the path to locale: /home/tatoeba/tatoeba-www/app/locale
* Choose a name for the file that will be generated (in this example, default.pot): default.pot
* Choose: Q (quit)

##Modifying the header

Before you upload the POT file, you may need to open it and change the header into this:
 
msgid ""

msgstr ""

"Project-Id-Version: \n"

"POT-Creation-Date: \n"

"PO-Revision-Date: \n"

"Last-Translator: \n"

"Language-Team: \n"

"MIME-Version: 1.0\n"

"Content-Type: text/plain; charset=utf-8\n"

"Content-Transfer-Encoding: 8bit\n"

Otherwise, Launchpad may reject the file.

##Uploading default.pot to Launchpad

Go to this URL:
 
https://translations.launchpad.net/tatoeba/trunk/+translations-upload

Upload the file. 

You may need to wait a day or so for the translation files to be updated.

##Editing .po files

You may need to edit the .po files manually at this stage if you want to restore translations for UI strings that have changed. Skip this step if you don't know what is entailed.

##Check .po files

Use this command on each .po file to ensure that it has the correct syntax:

msgfmt -c filename.po

The Launchpad site executes this step after the .po files are uploaded and approved, but checking the files first will save you more work in the long run.

##Upload .po files

Put all the .po files that have changed into a "tarball", which is a file with the extension .tar.gz or .tar.bz2 . You can use a zipfile utility such as [7Zip](http://www.7-zip.org/) command on Windows or *tar* on Linux to produce the tarball. Then upload them at the same URL that you used to upload the default.pot file. 

  [1]: https://www.assembla.com/spaces/tatoeba2/wiki/Internationalization

Note

The lines in green are the lines that have been added in the new version. The lines in red are those that have been removed.