Version at: 23/02/2014, 02:15 vs. version at: 23/02/2014, 02:24
11#Checking in Extracted UI Strings and Their Translations
22
3These 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
3These instructions describe how to extract UI strings so that they can be translated, upload the strings and translations, and finally commit them to a repository.
54
65##Markup for internationalized strings in the code
76
87In 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.
98
109Examples, with the equivalent actions:
1110
1211* __(‘some text’) => echo ‘some text’;
1312* __(‘some text’, true) => return ‘some text’;
1413
1514The language used in the code will be English.
1615
1716##Running cake i18n
1817
1918* Open a console on a Linux machine or Linux virtual machine.
2019* Type : /var/http/tatoeba/cake/console/cake i18n
2120* Choose : E (Extract POT file from source)
2221* When asked if you want to merge all translations into a single file, say yes
2322* Type in the path to app: /home/tatoeba/tatoeba-www/app
2423* Type in the path to locale: /home/tatoeba/tatoeba-www/app/locale
2524* Choose a name for the file that will be generated (in this example, default.pot): default.pot
2625* Choose: Q (quit)
2726
2827##Modifying the header
2928
3029Before you upload the POT file, you may need to open it and change the header into this:
3130
3231msgid ""
3332
3433msgstr ""
3534
3635"Project-Id-Version: \n"
3736
3837"POT-Creation-Date: \n"
3938
4039"PO-Revision-Date: \n"
4140
4241"Last-Translator: \n"
4342
4443"Language-Team: \n"
4544
4645"MIME-Version: 1.0\n"
4746
4847"Content-Type: text/plain; charset=utf-8\n"
4948
5049"Content-Transfer-Encoding: 8bit\n"
5150
5251Otherwise, Launchpad may reject the file.
5352
5453##Uploading default.pot to Launchpad
5554
5655Go to this URL:
5756
5857https://translations.launchpad.net/tatoeba/trunk/+translations-upload
5958
6059Set the following:
6160* file type: template
6261* path: default.pot
6362* template: default
6463
6564You can leave name and translation domain empty.
6665
6766Upload the file.
6867
6968You may need to wait a day or so for the translation files to be updated.
7069
7170##Editing .po files
7271
7372You may need to edit the .po files manually at this stage if you want to restore translations for UI strings that have changed. A merge tool such as WinMerge or KDiff3 may be useful here. Skip this step if you don't know what is entailed.
7473
7574##Check .po files
7675
7776Use this command on each .po file to ensure that it has the correct syntax:
7877
7978msgfmt -c filename.po
8079
8180The 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.
8281
8382##Upload .po files
8483
8584Put 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.
8685
8786##Run update-translations.sh
8887
8988If you do not already have bzr installed on your Linux virtual machine, install it with this command: "apt-get install bzr" . You may need to issue a "su -" (superuser) command to perform the installation.
9089
9190Run this script:
9291
9392tatoeba-www/docs/update-translations.sh
9493
9594It will do the following:
9695
9796* check out the files from the Launchpad repository (using Bazaar)
9897* place them in a temporary directory
9998* check them into the final Tatoeba2 repository
10099
101100Note that the script currently commits to the old Assembla SVN repository rather than the new GitHub Git repository. This needs to be changed (see [issue #96](https://github.com/Tatoeba/tatoeba2/issues/96)).
102101
102##Historical information only
103
104The original source of these instructions, stored on Assembla, is here: [1]
105
103106 [1]: https://www.assembla.com/spaces/tatoeba2/wiki/Internationalization
104107
108
diff view generated by jsdifflib

Version at: 23/02/2014, 02:15

#Checking in Extracted UI Strings and Their Translations

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

Set the following:
* file type: template
* path: default.pot
* template: default

You can leave name and translation domain empty.

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. A merge tool such as WinMerge or KDiff3 may be useful here. 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. 

##Run update-translations.sh

If you do not already have bzr installed on your Linux virtual machine, install it with this command: "apt-get install bzr" . You may need to issue a "su -" (superuser) command to perform the installation.
 
Run this script:

tatoeba-www/docs/update-translations.sh

It will do the following:

* check out the files from the Launchpad repository (using Bazaar)
* place them in a temporary directory
* check them into the final Tatoeba2 repository

Note that the script currently commits to the old Assembla SVN repository rather than the new GitHub Git repository. This needs to be changed (see [issue #96](https://github.com/Tatoeba/tatoeba2/issues/96)).

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

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

#Checking in Extracted UI Strings and Their Translations

These instructions describe how to extract UI strings so that they can be translated, upload the strings and translations, and finally commit them to a repository. 

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

Set the following:
* file type: template
* path: default.pot
* template: default

You can leave name and translation domain empty.

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. A merge tool such as WinMerge or KDiff3 may be useful here. 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. 

##Run update-translations.sh

If you do not already have bzr installed on your Linux virtual machine, install it with this command: "apt-get install bzr" . You may need to issue a "su -" (superuser) command to perform the installation.
 
Run this script:

tatoeba-www/docs/update-translations.sh

It will do the following:

* check out the files from the Launchpad repository (using Bazaar)
* place them in a temporary directory
* check them into the final Tatoeba2 repository

Note that the script currently commits to the old Assembla SVN repository rather than the new GitHub Git repository. This needs to be changed (see [issue #96](https://github.com/Tatoeba/tatoeba2/issues/96)).

##Historical information only

The original source of these instructions, stored on Assembla, is here: [1]

  [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.