Maybe we can use this post to collect/update/amend any useful translation-relevant info/hints/tools/tricks, etc. More info on any command listed below can be found from the konsole using 'man <command>' (where <command> can be rpm, msgfmt, etc.) and of course there is also Google...
Assume we look at the application 'synaptic' (the same is true for any other application) and are interested in the locale 'fr' ('fr' being French or in general this is a 2-letter abbreviation like 'de' for German 'it' for Italian, etc., say generically '<yy>'). The language-relevant information inside a rpm-package is contained in the so-called 'mo'-files which are usually stored under /usr/share/locale/<yy>/LC_MESSAGES/. The mo-files are the compiled version of the editable so-called 'po'-files, so the po-files are the ones where the actual translation takes place. Once you finished translating the po-file and converted it into a mo-file, this mo-file should be submitted for inclusion into an updated rpm-package for the given application to the PCLOS packagers.Howto translate/edit po-files=======================
Use Synaptic to install the application 'poedit', which is a great tool to translate. Under the option 'Catalog' is even an entry to 'automatically translate' but I never tried that. Make sure to look into: Catalog -> Settings -> Project Info tab: you must specify a valid project name and version, otherwise you can not save your translation work. Please also set the other fields, especially 'Charset: iso-8859-15' and 'Source code charset: utf-8'. Howto convert mo- <-> po-files=========================
To convert a mo-file to an editable po-file use the command:
msgunfmt synaptic.mo -o synaptic.po
and to do the reverse, meaning converting a po-file to a mo-file use:
msgfmt synaptic.po -o synaptic.moHowto list/extract mo-files =====================
a) from rpm/deb packages
- to see which language files are already available inside a rpm:
rpm -qlp <full path to>/synaptic-0.57.2-20pclos2007.i586.rpm |grep synaptic.mo
or use the same command without "|grep synaptic.mo" to simply list the content of the rpm archive.
Other useful info can be obtained with
rpm -qip <full path to>/synaptic-0.57.2-20pclos2007.i586.rpm
- to extract the files from an archive, copy the archive into a new empty folder, then in the new folder use the command:
rpm2cpio synaptic-0.57.2-20pclos2007.i586.rpm | cpio -idmv
In case you find something interesting inside a deb-archive use the command:
ar xv <something>.deb
b) - from bash scripts
example from the script 'update-notifier' (replace update-notifier with the name of the script you want to translate), go in your home-directory (command: cd ~) and enter:
bash --dump-po-strings /usr/bin/update-notifier | xgettext -L PO -o ~/update-notifier.pot -
msginit -l fr -i ~/update-notifier.pot -o ~/fr.po
this example was for extracting the French language info (fr), change fr to the locale
you work on. Additional info: Localizing Bash scriptsNote:
you must insert the Dollar-sign ($) in front of each text entry in your bash-script in order to make the 'bash --dump-po-strings' command above recognize such a string for translation, for example:
zenity --error --text=$"Please run this script as root.\n\nExiting..."Edit a po-file:
(example for GetOpenOffice)
Open the po-file with poedit, goto Catalog -> Settings, Project info Tab: in the field 'Project name and version' insert: GetOpenOffice 0.6, insert your language and country and under 'Source code charset': utf-8. You must insert these fields or you can not save the edited file! Localization info on the web=======================
, the 'KlipOQuery'-panelapplet can be installed via Synaptic and will transfer clipboard content to the selected translation service.
If you know of any other useful tools, applications, links, magical tricks, whatever, then please let us know so we can add this here.
hope this helps, good luck,