site  news  contact

Translate EasyOS to your language

June 11, 2023 — BarryK

Originally posted January 12, 2020.
Updated: Feb. 9, 2020. June 11, 2023

It is quite easy to create a complete translation of EasyOS to any desired language. The tool used is MoManager, that was created for Puppy Linux in 2012, and is now used in various derivatives and forks of Puppy, including EasyOS. MoManager is a GUI application, written by Barry Kauler (BarryK in the Puppy Forum). A fork was maintained by Lutz Ulrich (L18L in the forum) and that one is used in the current Puppy Linux.

MoManager may be used to translate just one file, or many, and will generate a tarball of changes made in the current session (newtranslations-<language>-<date>.tar.gz) as well as a tarball of all translations (translations-<language>-<date>.tar.gz).

The usual sequence is the user would do some translations, exit with generated 'newtranslations-<language>-<date>.tar.gz' and then post the tarball to the forum here:

https://forum.puppylinux.com/viewtopic.php?t=8070

Barry will then download the tarball, check it and hopefully merge the translations into woofQ, the EasyOS build system. Note, woofQ is a project on github; however, currently Barry only accepts translations as tarballs via the forum.

The steps are pretty straightforward, and it is made even easier as MoManager can help with automatic translations. You will find MoManager in the "Utility" section of the menu. Choose it, and this is the first window:

img1

Choose "Automatic" and then you get the main window, for the example of French translating:

img2

The procedure is that you choose a file on the right-side and click the "Create" button. The great time-saver is that auto-translation will occur, and a file will open in Geany text editor, with entries like this:

#: easyshare.sh:37
msgid "Close"
msgstr "Fermer"

#: easyshare.sh:66
msgid "Scanned for remote shares, no change"
msgstr "Analyse des partages distants, aucune modification"

#: easyshare.sh:68
msgid "Scanned for remote printers, no change"
msgstr "Numérisation pour les imprimantes distantes, aucun changement"

#: easyshare.sh:88
msgid "The full 'hostname' utility is required, that supports the '-I' option."
msgstr "L’utilitaire 'hostname' complet est requis, qui prend en charge l’option '-I'."
#: easyshare.sh:169
msgid "You must click the <b>Network Connect</b> button, or <b>connect</b> icon on the desktop, to setup a connection to a local network."
msgstr "Vous devez cliquer sur le bouton Connexion réseau ou sur l’icône de connexion sur le bureau pour configurer une connexion à un réseau local."

You do need to check that the translations are sane. Also, notice the last translation of "<b>Network Connect</b>" -- the tags are missing in the fr translation. Some formatting, such as html tags, are removed before submitting to the Google or Bing translator, so as not to confuse them. But, this means you will have to put the tags back in -- well, in the case of "<b>...</b>" it isn't essential, as it just causes "Network Connect" to display as bold.

So, go through, checking that translations are correct, choose to Save, then Exit from Geany. Translate as many files as you want, then at the bottom of the window click on the "Click OK to exit and create translations tarball" button.

Then, you will find /root/newtranslations-<language>-<date>.tar.gz and also expanded as folder /root/newtranslations-<language>-<date> so that you can see what is in the tarball. These are all translations created or edited since power-on. An example is 'newtranslations-fr-20230611.tar.gz'.

There will also be accumulated translations to-date, for example 'translations-fr-20230611.tar.gz' as well as an expanded folder; however, Barry would prefer that you only post the newtranslations-* tarball to the forum.

The good thing is, you only have to translate as many files that you feel comfortable doing. One hour, two hours, whatever, create the tarball and post to the forum. The translations will accumulate, so every little bit helps.

EasyOS is currently supporting these languages:

bg:български cs:čeština da:dansk de:Deutsch el:Ελληνικά en:English es:Español et:eesti-keel fi:Suomalainen fr:Français hr:Hrvatski hu:mađarski is:íslenskur it:Italiano lt:lietuvių lv:latviski mk:македонски nl:Nederlands no:norsk pl:Polski pt:Português ro:Română ru:Русский sk:slovenský sl:slovenska sq:shqiptare sr:Српски sv:svenska tr:Türkçe uk:українська uz:Ózbekça

...so, if you are proficient in English and one of those languages, you are invited to contribute!

Language choice when booting Easy

At the very first bootup of Easy, you will be greeted with this window:

img3

...it is a text-mode interface, so press the down arrow to select your language, press the ENTER key, then at bootup the desktop will be in your language. For example, German:

img3

For the German build, you will see some English untranslated text here and there. If you want to fix those, you may use MoManager to do so.

The most-translated are currently French and German, followed by Russian and Spanish, then Turkish.

Now for some technical details. Some generic notes about translating various types of files...


Translating different types of files

There are different types of files that require translation. These can be roughly classified as two types: documentation files, and applications. Applications may be scripts or compiled executables. In EasyOS, compiled applications written by Puppy and EasyOS developers, are written in C or BaCon. Other applications may have been written in C++, Vala, etc.

A pre-compiled application will usually be provided with a ".pot" file. This file is what you use to create the translation, or rather, MoManager does. For example, look at /usr/share/doc/nls/audacious/audacious.pot -- this is the translation file for the Audacious music player.

BaCon is a BASIC compiler, that some Puppy/EasyOS developers use, due to it's relative simplicity compared with C or C++, in particular the ease of creating GUIs. So, some notes on translation of BaCon programs...

Applications written in BaCon

BaCon is a BASIC compiler. For a developer writing an application in BaCon, you will need to know how to compile it so that it produces both the binary executable and the .pot file. Internationalization is supported by the compiler, as explained here:

https://bkhome.org/archive/bacon/international.htm

The .bac file is the BaCon source code. The .pot file is the language translation file. When you compile a BaCon application, place the .pot file into /usr/share/doc/nls/<app>/<app>.pot. MoManager searches this path for .pot files to be translated.

Actually, the same thing holds for any application, written in C, C++, Vala, Genie, or whatever, place the .pot file at /usr/share/doc/nls/<domainname>/<domainname>.pot and MoManager will use it.

Applications written in C

There is a blog post:

https://bkhome.org/news/202010/how-to-internationalize-any-c-program.html

Scripts internationalized with 'gettext'

The vast majority of utilities and applications developed by EasyOS developers are shell scripts, written in Bash/Ash. See the 'Coding for EasyOS' page:

https://easyos.org/dev/coding-for-easyos.html

Incorporating internationalization support in shell scripts is easy...

There are a lot of scripts in EasyOS that use 'gettext' for translating. Here are some in /usr/sbin:

bootmanager
connectwizard
quicksetup
qwallpaper

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, in the above example that will be 'myapp.pot'. Note that multiple scripts can have the same domainname 'myapp' and just the one 'myapp.pot' will be created. So, if your application has several scripts, you don't have to have a .pot for each (but you can if you want), just have the one .pot -- this is more efficient if there are common text strings to be translated in the scripts, and is simpler just to have the one .pot file.

One technical detail: please place the "export ..." at column one, and do not place quotes around "myapp", the line in the script should look just like shown above.

.pot files are "translation files", which you then have to insert the translations for a particular language. When that is done, it becomes a .po file, and 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.

MoManager and scripts

In the case of updating an existing translation file, MoManager automatically synchronises with the latest script, and will identify any changed strings -- if you see the text "fuzzy" anywhere in the translation file, it is likely that the original English text has changed and you will need to update the translation.

Although it is fairly easy 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, it is helpful to readup a bit on the topic. Suggested links:

http://docs.translatehouse.org/projects/localization-guide/en/latest/guide/project/howto.html

https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/gettext.html#PO-Files

...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.

Have fun!  

Tags: dev