| 1 | # Internationalization Tools |
| 2 | |
| 3 | by @sgk at SwitchScience. |
| 4 | |
| 5 | ## Reflect the source code change |
| 6 | |
| 7 | Sometimes, the developers add/delete/modify the strings which should be translated. You have to reflect the source code change to your translation. This can be done as below given your language code `xx`. |
| 8 | |
| 9 | % ./update.sh xx |
| 10 | |
| 11 | This will extract the up-to-date set of strings from the source code, set the translated strings from the current "`Resources_xx.po`" file, and then write back to "`Resources_xx.po`" file. If the developers delete/modify the strings, corresponding translated strings disappear from the file. You may want to do like this. |
| 12 | |
| 13 | % git commit |
| 14 | % ./update.sh xx |
| 15 | % git diff Resrouces_xx.po |
| 16 | % git add Resources_xx.po Resources_xx.properties |
| 17 | % git commit |
| 18 | |
| 19 | ## Get the translated catalog from Transifex |
| 20 | |
| 21 | You may want to retrieve the translation contribution from Transifex. This can be done as below given your language code `xx`. |
| 22 | |
| 23 | % ./pull.sh xx |
| 24 | |
| 25 | Translation strings for only strings already in "`Resources_xx.po`" file will be updated. If Transifex has translated strings which are not in "`Resources_xx.po`" file, the strings will not appear in the file. |
| 26 | |
| 27 | If you want to retrieve the newly translated language which is not in the Git repository, you will want to do like this. |
| 28 | |
| 29 | % cp Resources_en.po Resources_xx.po |
| 30 | % ./pull.sh xx |
| 31 | % more Resources_xx.po |
| 32 | % git add Resources_xx.po Resources_xx.properties |
| 33 | % git commit |
| 34 | |
| 35 | ## Send the translated catalog to Transifex |
| 36 | |
| 37 | You can send the translated catalog file "`Resources_xx.po`" to Transifex using the following command line where `xx` is the language code. |
| 38 | |
| 39 | % ./push.sh xx |
| 40 | |
| 41 | Be aware that this will overwrite the current result on Transifex. You may want to do "./update.sh" and "./pull.sh" before doing "./push.sh". |
| 42 | |
| 43 | ## Select "all" languages |
| 44 | |
| 45 | **For the comitter only.** For all above scripts, you can select all languages by specifying "-a" instead of language codes like this. |
| 46 | |
| 47 | % ./update.sh -a |
| 48 | |
| 49 | The "all" means all the languages currently in your working directory. This does not mean the languages on Transifex. |