Version at: 02/05/2015, 18:40 vs. version at: 02/05/2015, 18:40
11#Checking in Extracted UI Strings and Their Translations
22
3These instructions describe how to extract UI strings, upload strings and translations, and finally commit them to a repository. **The sections about uploaded and committing are no longer valid since we have switched from Launchpad to Transifex.**
3These instructions describe how to extract UI strings, upload strings and translations, and finally commit them to a repository. **The sections about uploading and committing are no longer valid since we have switched from Launchpad to Transifex.**
44
55Before executing these steps, follow the instructions in [Installing and Configuring Bazaar](install-bazaar).
66
77##Markup for internationalized strings in the code
88
99In 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.
1010
1111Examples, with the equivalent actions:
1212
1313* __(‘some text’) => echo ‘some text’;
1414* __(‘some text’, true) => return ‘some text’;
1515
1616The language used in the code will be English.
1717
1818##Running cake i18n
1919
2020* Open a console on a Linux machine or Linux virtual machine.
2121* Type : /var/http/tatoeba/cake/console/cake i18n
2222* Choose : E (Extract POT file from source)
2323* When asked if you want to merge all translations into a single file, say yes
2424* Type in the path to app: /home/tatoeba/tatoeba-www/app
2525* Type in the path to locale: /home/tatoeba/tatoeba-www/app/locale
2626* Choose a name for the file that will be generated (in this example, default.pot): default.pot
2727* Choose: Q (quit)
2828
2929##Modifying the header
3030
3131Before you upload the POT file, you may need to open it and change the header into this:
3232
3333msgid ""
3434
3535msgstr ""
3636
3737"Project-Id-Version: \n"
3838
3939"POT-Creation-Date: \n"
4040
4141"PO-Revision-Date: \n"
4242
4343"Last-Translator: \n"
4444
4545"Language-Team: \n"
4646
4747"MIME-Version: 1.0\n"
4848
4949"Content-Type: text/plain; charset=utf-8\n"
5050
5151"Content-Transfer-Encoding: 8bit\n"
5252
5353Otherwise, Launchpad may reject the file.
5454
5555##Uploading default.pot
5656
5757###Uploading default.pot to Launchpad via Bazaar
5858
5959* Commit the file using the Bazaar Explorer GUI.
6060
6161When it comes time to push your changes, go to a Windows command prompt, issue a launchpad-login command, and issue a push command.
6262
6363
6464This is the equivalent of doing the following from the Windows command prompt (for user abc):
6565
6666 cd bzr\trunk\trunk\default
6767 bzr launchpad-login abc
6868 bzr push lp:tatoeba
6969
7070Presumably, this should work from Linux as well (with adjustments to the paths).
7171
7272##Editing .po files
7373
7474You 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.
7575
7676##Check .po files
7777
7878Use this command on each .po file to ensure that it has the correct syntax:
7979
8080msgfmt -c filename.po
8181
8282The 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.
8383
8484##Upload .po files
8585
8686Put 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.
8787
8888##Run update-translations.sh
8989
9090If 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.
9191
9292Run this script:
9393
9494tatoeba-www/docs/update-translations.sh
9595
9696It will do the following:
9797
9898* check out the files from the Launchpad repository (using Bazaar)
9999* place them in a temporary directory
100100* check them into the final Tatoeba2 repository
101101
102102You must include the "-c" switch on the command line if you want the changes to be committed.
103103
104104##Historical information only
105105
106106The original source of these instructions, stored on Assembla, is here: [1]
107107
108108
109109
110110
111111###Uploading default.pot to Launchpad via import queue (deprecated)
112112
113113Go to this URL:
114114
115115https://translations.launchpad.net/tatoeba/trunk/+translations-upload
116116
117117Set the following:
118118* file type: template
119119* path: default.pot
120120* template: default
121121
122122You can leave name and translation domain empty.
123123
124124Upload the file.
125125
126126You may need to wait a day or so for the translation files to be updated.
127127
128128 [1]: https://www.assembla.com/spaces/tatoeba2/wiki/Internationalization
129129
diff view generated by jsdifflib

Version at: 02/05/2015, 18:40

#Checking in Extracted UI Strings and Their Translations

These instructions describe how to extract UI strings, upload strings and translations, and finally commit them to a repository. **The sections about uploaded and committing are no longer valid since we have switched from Launchpad to Transifex.**

Before executing these steps, follow the instructions in [Installing and Configuring Bazaar](install-bazaar).

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

###Uploading default.pot to Launchpad via Bazaar 

* Commit the file using the Bazaar Explorer GUI. 

When it comes time to push your changes, go to a Windows command prompt, issue a launchpad-login command, and issue a push command. 


This is the equivalent of doing the following from the Windows command prompt (for user abc):

    cd bzr\trunk\trunk\default
    bzr launchpad-login abc
    bzr push lp:tatoeba
    
Presumably, this should work from Linux as well (with adjustments to the paths).

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

You must include the "-c" switch on the command line if you want the changes to be committed.

##Historical information only

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




###Uploading default.pot to Launchpad via import queue (deprecated)

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.

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

version at: 02/05/2015, 18:40

#Checking in Extracted UI Strings and Their Translations

These instructions describe how to extract UI strings, upload strings and translations, and finally commit them to a repository. **The sections about uploading and committing are no longer valid since we have switched from Launchpad to Transifex.**

Before executing these steps, follow the instructions in [Installing and Configuring Bazaar](install-bazaar).

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

###Uploading default.pot to Launchpad via Bazaar 

* Commit the file using the Bazaar Explorer GUI. 

When it comes time to push your changes, go to a Windows command prompt, issue a launchpad-login command, and issue a push command. 


This is the equivalent of doing the following from the Windows command prompt (for user abc):

    cd bzr\trunk\trunk\default
    bzr launchpad-login abc
    bzr push lp:tatoeba
    
Presumably, this should work from Linux as well (with adjustments to the paths).

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

You must include the "-c" switch on the command line if you want the changes to be committed.

##Historical information only

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




###Uploading default.pot to Launchpad via import queue (deprecated)

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.

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