See pupmd5sum.sh as a model to follow.
A utility to make minor changes to entries
build_gettext is available.
Shinobar does a good job explaining how to localize HERE
Note to make a mo file for French your $LANG must be French
and devx file for your distribution must be loaded.
Run a recent version of MoManager (Dec 2012) since
there was bugs in early versions.
Here are my experiences with using MoManager on a script...
1)Barry K has instructions (in MoManager help)
about adding a couple of lines near beginning of script.
Near beginning of script put two lines
Code: Select all
export TEXTDOMAIN=script_name
export OUTPUT_CHARSET=UTF-8
if you want to use eval_gettext (rare) then you must also
put the following before eval_gettext is evoked
Code: Select all
. gettext.sh
Go thru script and replace English expressions with
$(gettext "TEXT_to_TRANSLATE")
2) If text has an apostophe see this page
http://murga-linux.com/puppy/viewtopic.php?t=84086
3) Check script file in Geany by using Find 'get' command
This will list all occurrences of 'gettext'. Check the spelling
carefully. I guarantee that there will be mistakes.
4) Run the script in a terminal (you can use ./script_name)
and read error messages. Script must be executable of course.
Line numbers reported by terminal won't be accurate
if you have a gtkdialog script.
5) When your script will run without complaint in the terminal, then
put it in a folder that holds executable apps (example /usr/bin/)
6) I suggest that you install poedit It can be found HERE
7) Launch MoManager from start menu or terminal (it is launched in terminal by typing
'poeditor'). At the top right of window there will be a list of scripts
that need a mo file. --> mo file is the final file of translations.
Tick 'edit with poedit' and click Create button. The procedure is
fairly straight forward but if you haven't prepared your script properly
you will have problems. If you do have problems it is
time to quit. Unfortunately MoManager creates files on your hard disk
that will cause subsequent problems even if you do correct your script.
...But here is the solution to these problems....
1)Trash the folder /tmp/momanager
2) Trash the mo file if it has been created in
/usr/share/locale/fr/LC_MESSAGES/ (assuming French is current
language) In fact you should remove the German,Spanish and other
translations of your script if they exist.
Note: You can check the time of creation if in doubt about who
created the mo file
3) Trash the pot file in /usr/share/doc/nls/script_name
You now have a fresh system that won't confuse MoManager.
Correct your script and run MoManager again.
Another tip ---> I've had problems when I add more gettext
entries to a script. This means that more translation entries are needed.
The method I used ---> make a pet package, holding just the script.
Be careful the correct files are inside!! No mo or pot files inside.
Save old mo files somewhere safe.
Now go through the 3 step procedure I wrote above to obtain a fresh installation.
Now install your script which is easy since
you made a pet package. Now run Momanager and it will
think the script has no tranlation yet and create a mo file from scratch.
It's fairly easy to fill in the entries again.
Alternatively you can put back a mo file (if it is correctly formed!!)
just before launching MoManager and poedit will look
like this (see image) The untranslated expressions will
be on top of list. A nice feature of poedit. Everything
should be straight forward. mo and pot files can be created and saved.
____________________________________________________