Translate EasyOS to your language

6 giorni 8 ore ago

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, originally written by Barry Kauler (BarryK in the forum) and now maintained by Lutz Ulrich (L18L in the forum). Here is the original announcement, in February 2012:

https://bkhome.org/archive/blog2/201202/introducing-momanager.html

MoManager may be used to translate just one file, or many, and may optionally create a "langpack" PET package of all the translations for a particular language. If someone decided to translate or update the translation of one file (document, application, script, or whatever), they may do so, and submit it to the language translation maintainer. Or if there is no maintainer for a particular langpack, they may send it to Barry.

A langpack may be installed in a running EasyOS, to convert to a particular language, which is fine. However, EasyOS now favours building a release with the langpack already builtin. EasyOS is built with woofQ, and the script that creates the easy-<version>-<arch>.img.gz file, does a lot of looking around for more translations than may be in the langpack PET. Thus, the build is a more complete translation than provided by the PET. Also, at the very first bootup, all the bootup text is already translated, which creates a very favourable impression to the user.

The download host site has these already-translated releases of EasyOS. Currently, there are only French and German builds. For example, see the 'de' (German) build here:

http://distro.ibiblio.org/easyos/amd64/releases/buster/2.2/de/

This webpage is in three parts. Firstly, the experience of booting an already-translated EasyOS is described. The second part considers internationalization when coding, and the third part describes usage of MoManager.

EasyOS built for a particular language

If Barry is provided with an up-to-date langpack PET, he may then create a build in woofQ for that language. It will be named like easy-<version>-<language>-<arch>.img.gz, for example, easy-2.2-de-amd64.img.gz. Continuing with the example of a 'de' build...

Download easy-<version>-de-amd64.img.gz and write it to a USB-stick, and boot it. This is the very first thing seen on the screen:


At the very first bootup there is a GUI window that asks for keyboard layout and password. Keyboard layout, so that you can use any keyboard, not just the 'de' layout. On subsequent boots, only the password is asked for (unless you opted for no password on the first boot):


And you end up with a desktop, with everything in German, including all of the applications. Here is the desktop:


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, and submit the fix to Lutz Ulrich (L18L). For the French build, submit fixes to JJ Moulinier (esmourguit). Though, esmourguit is not much involved in Puppy/easy translation these days -- in his retirement he spends most of his time sailing the French canals! So, fixes may also be sent direct to Barry.

Now for the technical details. Firstly, 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. This could be in a PET package of your application. 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.

The vast majority of utilities and applications developed by Puppy and 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...

Scripts internationalized with 'gettext'

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 translation manager

MoManager is easier to use than explain. Much easier, just use it, and it should be obvious. There are plenty of help buttons on the GUI window.

Go to the menu "Utility -> MoManager create non-English EasyOS", and you will have a GUI window. This snapshot is for German (de) translating:


...click on all of the help buttons, to get a feel for what can be done. You will notice in the menu that there is also an older version of MoManager, "Utility -> MoManager translation manager, old version". This is what it looks like:


...you may use the old one, however the newer one has some extra useful features. The old one lacks "t12s" translation, that some PETs use -- though this has mostly disappeared in favour of gettext method). The old one will probably be phased out, but that depends on user feedback.

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.

There is no need for further explanation on this page. Start MoManager, and you should be good-to-go. If there is already a langpack PET for the language you want to translate to, install that first. It will be used as the basis and your translations will be added to it when you create a new langpack PET.

Old langpacks can be found here:

http://distro.ibiblio.org/easyos/noarch/packages/pet/pet_packages-noarch/

...or just start PETget (see "petget" icon on the screen) and do a search for "langpack".

If you want to discuss anything related to translation specifically for EasyOS, go to this forum thread:

http://murga-linux.com/puppy/viewtopic.php?t=109958

Or, if you want to discuss about the new MoManager, not necessarily EasyOS-specific, go here:

http://murga-linux.com/puppy/viewtopic.php?t=81259

Have fun! 

Tags: dev

BarryK

Checked

19 minuti 26 secondi ago
EasyOS Linux distribution
SubscribeIscriviti a Feed EasyOS