Version at: 23/02/2014, 01:33 vs. version at: 23/02/2014, 01:34
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]
4
5
64
75
86##Markup for internationalized strings in the code
97
108In 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.
119
1210Examples, with the equivalent actions:
1311
1412* __(‘some text’) => echo ‘some text’;
1513* __(‘some text’, true) => return ‘some text’;
1614
1715The language used in the code will be English.
1816
1917##Running cake i18n
2018
2119* Open a console on a Linux machine or Linux virtual machine.
2220* Type : /var/http/tatoeba/cake/console/cake i18n
2321* Choose : E (Extract POT file from source)
2422* When asked if you want to merge all translations into a single file, say yes
2523* Type in the path to app: /home/tatoeba/tatoeba-www/app
2624* Type in the path to locale: /home/tatoeba/tatoeba-www/app/locale
2725* Choose a name for the file that will be generated (in this example, default.pot): default.pot
2826* Choose: Q (quit)
2927
3028##Modifying the header
3129
3230Before you upload the POT file, you may need to open it and change the header into this:
31
32msgid ""
3333
34> msgid ""
35> msgstr ""
36> "Project-Id-Version: \n"
37> "POT-Creation-Date: \n"
38> "PO-Revision-Date: \n"
39> "Last-Translator: \n"
40> "Language-Team: \n"
41> "MIME-Version: 1.0\n"
42> "Content-Type: text/plain; charset=utf-8\n"
43> "Content-Transfer-Encoding: 8bit\n"
34msgstr ""
35
36"Project-Id-Version: \n"
37
38"POT-Creation-Date: \n"
39
40"PO-Revision-Date: \n"
41
42"Last-Translator: \n"
43
44"Language-Team: \n"
45
46"MIME-Version: 1.0\n"
47
48"Content-Type: text/plain; charset=utf-8\n"
49
50"Content-Transfer-Encoding: 8bit\n"
4451
4552Otherwise, Launchpad may reject the file.
4653
4754##Uploading default.pot to Launchpad
4855
4956Go to this URL:
5057
5158https://translations.launchpad.net/tatoeba/trunk/+translations-upload
5259
5360 [1]: https://www.assembla.com/spaces/tatoeba2/wiki/Internationalization
5461
diff view generated by jsdifflib

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

#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, 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

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.