Version at: 23/02/2014, 02:07 vs. version at: 23/02/2014, 02:09 | ||
---|---|---|
1 | 1 | #Checking in Extracted UI Strings and Their Translations |
2 | 2 | |
3 | 3 | 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] |
4 | 4 | |
5 | 5 | |
6 | 6 | ##Markup for internationalized strings in the code |
7 | 7 | |
8 | 8 | 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. |
9 | 9 | |
10 | 10 | Examples, with the equivalent actions: |
11 | 11 | |
12 | 12 | * __(‘some text’) => echo ‘some text’; |
13 | 13 | * __(‘some text’, true) => return ‘some text’; |
14 | 14 | |
15 | 15 | The language used in the code will be English. |
16 | 16 | |
17 | 17 | ##Running cake i18n |
18 | 18 | |
19 | 19 | * Open a console on a Linux machine or Linux virtual machine. |
20 | 20 | * Type : /var/http/tatoeba/cake/console/cake i18n |
21 | 21 | * Choose : E (Extract POT file from source) |
22 | 22 | * When asked if you want to merge all translations into a single file, say yes |
23 | 23 | * Type in the path to app: /home/tatoeba/tatoeba-www/app |
24 | 24 | * Type in the path to locale: /home/tatoeba/tatoeba-www/app/locale |
25 | 25 | * Choose a name for the file that will be generated (in this example, default.pot): default.pot |
26 | 26 | * Choose: Q (quit) |
27 | 27 | |
28 | 28 | ##Modifying the header |
29 | 29 | |
30 | 30 | Before you upload the POT file, you may need to open it and change the header into this: |
31 | 31 | |
32 | 32 | msgid "" |
33 | 33 | |
34 | 34 | msgstr "" |
35 | 35 | |
36 | 36 | "Project-Id-Version: \n" |
37 | 37 | |
38 | 38 | "POT-Creation-Date: \n" |
39 | 39 | |
40 | 40 | "PO-Revision-Date: \n" |
41 | 41 | |
42 | 42 | "Last-Translator: \n" |
43 | 43 | |
44 | 44 | "Language-Team: \n" |
45 | 45 | |
46 | 46 | "MIME-Version: 1.0\n" |
47 | 47 | |
48 | 48 | "Content-Type: text/plain; charset=utf-8\n" |
49 | 49 | |
50 | 50 | "Content-Transfer-Encoding: 8bit\n" |
51 | 51 | |
52 | 52 | Otherwise, Launchpad may reject the file. |
53 | 53 | |
54 | 54 | ##Uploading default.pot to Launchpad |
55 | 55 | |
56 | 56 | Go to this URL: |
57 | 57 | |
58 | 58 | https://translations.launchpad.net/tatoeba/trunk/+translations-upload |
59 | ||
60 | Set the following: | |
61 | * file type: template | |
62 | * path: default.pot | |
63 | * template: default | |
64 | ||
65 | You can leave name and translation domain empty. | |
59 | 66 | |
60 | 67 | Upload the file. |
61 | 68 | |
62 | 69 | You may need to wait a day or so for the translation files to be updated. |
63 | 70 | |
64 | 71 | ##Editing .po files |
65 | 72 | |
66 | 73 | 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. |
67 | 74 | |
68 | 75 | ##Check .po files |
69 | 76 | |
70 | 77 | Use this command on each .po file to ensure that it has the correct syntax: |
71 | 78 | |
72 | 79 | msgfmt -c filename.po |
73 | 80 | |
74 | 81 | 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. |
75 | 82 | |
76 | 83 | ##Upload .po files |
77 | 84 | |
78 | 85 | 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. |
79 | 86 | |
80 | 87 | ##Run update-translations.sh |
81 | 88 | |
82 | 89 | Go to your Tatoeba virtual machine and run this script: |
83 | 90 | |
84 | 91 | tatoeba-www/docs/update-translations.sh |
85 | 92 | |
86 | 93 | It will do the following: |
87 | 94 | * check out the files from the Launchpad repository (using Bazaar) |
88 | 95 | * place them in a temporary directory |
89 | 96 | * check them into the final Tatoeba2 repository |
90 | 97 | |
91 | 98 | 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)). |
92 | 99 | |
93 | 100 | [1]: https://www.assembla.com/spaces/tatoeba2/wiki/Internationalization |
94 | 101 | |
diff view generated by jsdifflib |
Version at: 23/02/2014, 02:07
#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 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. ##Run update-translations.sh Go to your Tatoeba virtual machine and 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:09
#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. 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 Go to your Tatoeba virtual machine and 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