HOWTO internationalize applications

Page Updated: Jan 14, 2023

Internationalization of applications and scripts in Puppy Linux has become extremely easy, with MoManager, a GUI application.

If you are writing software for Puppy and want that your application be internationalized, or if you want to create translations of Puppy in your language, please read this help page.

Creating your own scripts that need internationalization

There are a lot of scripts in Puppy that use gettext for translating. For example, here are some in the woof-CE:

Inside each script you will find a line like this: export TEXTDOMAIN=myapp MoManager finds all scripts with this entry, which confirms that it uses gettext, and offers a GUI interface for translating each script. You do not have to learn the commandline tools for translating, the GUI interface makes it easy.

Basically, MoManager will create a .pot file for the application; for example if the app is named myapp, then the .pot file will be myapp.pot. Note that multiple scripts can have the same domain-name (TEXTDOMAIN) set as myapp (for example), and hence just one .pot file, named myapp.pot, will be created. So, if your application has several scripts, you don't have to have a .pot for each, if you want then you can use a single .pot as well (i.e. set the same domain-name) -- this is more efficient if there are common text strings to be translated in the scripts, and is easier to be translated as well.

NOTE: Please place the export ... at column one, and do not place quotes around myapp (like "myapp" or 'myapp'). The line in the script should look just like this: export TEXTDOMAIN=myapp

.pot files are 'translation files', for which you then have to insert the translations for a particular language. When that is done, it becomes a .po file, and then it is then compiled to a binary form and becomes a .mo file. The compiled .mo files are kept at /usr/share/locale. MoManager handles these conversions for you.

Pre-existing .pot files

MoManager use command-line tool- xgettext to extract text strings from a script and create a .pot file from it. However this command-line tool may not always work properly. So, whenever MoManager finds an already created .pot for a program, at the location /usr/share/doc/nls/xxx/xxx.pot, it uses that .pot file instead.

Note that MoManager only searches the directory /usr/share/doc/nls for any existing .pot file.

Internationalizing Content using MoManager

MoManager is a GUI application written by Barry Kauler that makes it very easy for anyone to create non-English translations for applications in Puppy. All latest Puppies will have MoManager in them, which was firstly introduced to Puppy through 'Woof' (later moved to woof-CE) on 'February 14, 2012'. If you want to use MoManager to create a 'langpack' for a particular language it is recommended to use the very latest Puppy built from latest woof-CE, which is not more than a month older. So, you may need to build your own Puppy for this process - the procedure can be found at 'Building a Puppy on GitHub' Github Wiki page.

MoManager is for creating and updating translation files for scripts, XML files, menu files, any other data text files, and binary executables.

Scripts are applications that are executable text files, usually written in Bash or Ash, or interpreted programming languages like Perl, Python, Tcl, etc. (a more technical term for scripts would be - 'source files of interpreted languages'). This section of the help file deals with 'creating langpacks for applications' only, and not about creating scripts themselves.

You can find MoManager in Utility menu. Once started, you will see two columns of drop-down lists, one list is of files that already have a translation file for your language (on left side), the other list is for files that do not yet have a translation file. if you select a file from the formerlist, you may update the translation, and in the latter case you may create a new translation file.

Here is a snapshot of the main window, Puppy running with hi_IN locale:
MoManager main window

Updating an existing translation file

(Information on translation files can be found above.)

In the case of updating an existing translation file, MoManager automatically synchronises with the latest script, and will identify any changed strings. Check if you see the text fuzzy anywhere in the translation file -- you can do something like this for the purpose: cat path/to/translation_file.pot | grep "fuzzy" If you see that the word fuzzy is found, it is likely that the original English text in the script has changed and you will need to update the translation.

Editing a translation file (Creating a translation)

Although it is probably possible to figure out how to edit a translation file, known as a po file in it's editable form, or mo file in it's compiled form, these links give some extra information on the topic:

...note though, reading all of that can be confusing! It is possible to use MoManager without understanding all of those details. MoManager uses a normal text editor to edit .po files rather than a specialized po-editor (such as poedit) and this is quite easy to do, you just need a very basic understanding of the format of .po files.

The very basic thing to understand to begin creating a translation for your language is the use of msgid and msgstr pair. When you select to edit/create a translation file using MoManager, it will open up the text editor for you with the translation file. The translation file will have few lines of this form:- msgid "sometext"
msgstr "sometext"
(Here msgstr can be empty if you are creating a new translation.)
msgid means the original English text, and msgstr means its translation in your selected language. So, you will only need to read msgid and put its translation in msgstr.

poedit

This is a special text editor for editing .po files. Although MoManager uses the default text editor (usually geany in most puppies), but if poedit is installed then MoManager can use it -- you will see a checkbox in the main window of MoManager to choose poedit over the default text editor.

To install poedit, look in the Puppy Package Manager.

Langpack

You will also see in the MoManager window, a button to generate a "langpack" PET package. If you would like to translate Puppy for a particular language, this button is very nice. It will gather up all the translations you have created/modified for your language and will put them into a PET package, which you can then send to BarryK, through PuppyLinux Forum, and he may place it along with the other langpacks at ibiblio.org. See the existing langpacks at pet_packages-noarch sub-directory of PuppyLinux directory under ibiblio.org. The langpacks will be named as langpack_*.pet.

Note that the langpack is accumulative. Say for example that you install langpack_de-20120729.pet (German), you can then create some more translations, or update existing ones, then click the Create langpack PET button, and a new updated PET will be created. Please let us know if this mechanism leaves anything out!

There are already maintainers for some languages. If you want to contribute to a translations for a specific language please do it through its maintainer. If there is no maintainer for the langauge you want to translate Puppy to, then you can directly contact BarryK. Note you can contact the maintainers through PuppyLinux Forum, and can even post your langpack at Internationalization sub-forum in PuppyLinux forum.

At the time of writing, these are the maintainers:

da Danish maans
de German L18L
el Greek kounelii
es Spanish vicmz
fr French esmourguit
it Italian vicmz (temporary)
nl Dutch Bert
pl Polish robwoj44
pt Portuguese vicmz
ru Russian rodin.s

Further information

For more news on MoManager, visit BarryK's News Site and search for "MoManager" there.

To interact with others working on translating Puppy, including asking questions about anything that puzzles you, please post your issue at Internationalization sub-forum in PuppyLinux forum.