The points below should help to illustrate this process using getopenoffice and German as an example. Please amend the example for your language.
1) create a new empty directory and copy the bash-program (getopenoffice) in there
2) to setup the pot-file, open a konsole in this directory, and enter the command:
bash --dump-po-strings getopenoffice | xgettext -L PO -o getopenoffice.pot -
3) to setup a German po-file from the pot-file, enter the command (just press enter, provide your email-address if you want to, ignore the urlget error and wait for the command to finish):
msginit -l de -i getopenoffice.pot -o getopenoffice.po
or for a Spanish file you would use:
msginit -l es -i getopenoffice.pot -o getopenoffice.po
Note: if you translate more than one language make sure to use a different filename for each po-file to not overwrite the previous language po-file!
4) open the po-file with poedit (install poedit from Synaptic) In poedit, go to Catalog -> Settings -> Project Info tab: you must specify a valid project name and version (here, getopenoffice 1.0), otherwise you can not save your translation work!
Please also insert your language and country and under 'Source code charset': utf-8. Then select any original string with a mouse-click and enter the corresponding translated text in the bottom field in poedit. A good idea is to copy the entire displayed text in the first window at the bottom of poedit and then copy it to the last bottom window for translation. This way you will maintain the text layout including the special characters like linebreak (\\n) or exclamation mark (\\!), or other parameter variables like '$idx', just leave those as they are. Please note that the translated text will be moved to the bottom of the list in poedit when you save your project.
5) In case of a new program version you can easily update your existing work from the po-file of the previous version:
a) follow the step 1 above on the new program version to setup an updated pot-file.
b) open your previous po-file in poedit and then choose: Catalog -> Update from POT file...
and then select the new updated pot-file. This will show you the new changes and merge them into your existing po-file.
After that, don't forget to also change the version number in the Catalog -> Settings -> Project Info tab of your updated po-file.
6) when you finished translating, save your project. Poedit will save it as editable po-file as well as a compiled mo-file. To control your work and to see if all works as expected, follow these steps (again, exemplified for German, amend for your language):
- ensure to have a localized system of your language used for the translation. For our German example, you must work in a German localized PCLinuxOS and the current version of the (getopenoffice) script should be in its final place (here, /usr/bin/).
- Ok, now open a konsole in the directory where you worked on the translation and enter
cp getopenoffice-de.mo getopenoffice.mo
- as root do:
cp getopenoffice.mo /usr/share/locale/de/LC_MESSAGES/
(or i.e. for Spanish you would have to copy to /usr/share/locale/es/LC_MESSAGES/)
- execute the script:
and you should now see and can control your translated text.
7) Once you are satiesfied with your results submit the (po and) mo-file (maybe best with an added language extension, i.e., getopenoffice-GERMAN.mo to avoid the risk of overwriting different localized mo-files) to the package translation section
. The packagers can then download these mo-files, remove the Language notation and put the locale in the appropriate place. Please use the following notation in the title when submitting a mo-file (here for the German example, amend to your language):
[ -T- getopenoffice] translation to German (done)
Since you are all eagerly waiting to test the steps above, please find attached the latest GOO 1.0. Download, remove the .txt, md5sum: d13132a6858d75fc0fb899e4b6457db3
Thank you for your help!
Edit: changed the attached version from 0.9 to 1.0
[attachment deleted by admin]