Helping with Localization

Helping with Localization

Wikis > Helping with Localization

Page Contents

Bodhi Linux Localization Guide

Introduction:

Helping out with translating the Moksha desktop, modules and Bodhi Linux installers is a great way to contribute and spread the distro to many countries around the world!

Translations mainly consist of working with .po files and sometimes html files.

PO files are textual, editable files based on a POT file and contain the original program text and its translation.

• An HTML file is a document written in Hypertext Markup Language (HTML) that structures content for web pages. It contains elements like headings, paragraphs, and links which web browsers use to display the content visually. These files use so-called tags that often surround text.

An example of a po file with Italian translations:

An example of a html file:

How to work on .po files:

How to obtain source?

– install git and clone the whole repository to your work folder
– or download lang.po file directly from git

How to edit po file?

– in common text editor
– in specialized code editor example: Geany (syntax highlight – useful)
– in Poedit (application for translators) -likely the the best solution

What to edit and how?

You can see code file names with English text in first line ‘msgid’ and empty or filled line ‘msgstr’ in another language. Check the translation or add new one. In case you can see ‘fuzzy’ in front of the lines, the translation will be ignored. This is probably the automatically generated text with a dictionary and may not be precise.

Be aware of plural in some languages; in Slovak, for example, there are some special rules for plural which must be taken into account.

#: src/modules/ibar/e_mod_config.c:147
msgid "Icon focus flash"
msgstr "Animácia ikony"

Plural example:

#: src/bin/e_utils.c:1201
#, c-format
msgid "A second"
msgid_plural "%li Seconds"
msgstr[0] "sekunda"
msgstr[1] "%li sekundy"
msgstr[2] "%li sekúnd"

Also pay attention to the UTF-8 charset -> make sure that the line:”Content-Type: text/plain; charset=UTF-8\n” is present at the beginning of your .po file.

What if your language is not included?

Do not worry! You have to add your language shortcut to LINGUAS file, then start editing clean pot file and save it as lang.po

A better way:

msginit --locale=sk –input=moksha.pot

Inside the folder of the program you are translating you will most likely find a .desktop file. Inside this file you can add the “Name“, “GenericName“, “Comment” and/or “Keywords” in your language.

Note: Please respect the alphabetical order

What to do next?

Best solution for advanced users: fork repo to your git, make changes and pull request. We will merge to the origin.

If you are new to GitHub, it is advisable to familiarize yourself with it, or work from the GitHub web page. This way, while slightly more cumbersome, you can become familiar with the GitHub functions and contribute without terminal commands.

How to check your translations:

You have to create the .mo file from .po file – this is our goal! It is possible via CLI with msgfmt command or using in Poedit (file->compile to mo).

If you want to do it via terminal, make sure you have gettex installed.

sudo apt update && sudo apt install gettext

For example, if the .po file you are working on is in:

/home/<user>/Documents

To get the .mo file in:

/home/<user>/Documents

msgfmt -o /home/<user>/Documents/lang.mo /home/<user>/Documents/lang.po

(where first path == destination. Second path == .po file you are working on)

Where to place .mo file for testing?

If you make an translation for Moksha, rename lang.mo (sk.mo for example) to enlightenment.mo and and you should place it to:

/usr/share/locale/lang/LC_MESSAGES

lang means sk in this case.

/usr/share/locale/sk/LC_MESSAGES

Restart the app to test.

About html files:

Sometimes you may find yourself having to translate html files. As mentioned above, the text to be translated is found between tags.

Once you have found the original html in English, the translation consists of copying the file and deleting the English text to place the translated one. The name of the file must not be changed!

If the original is “welcome.html“, the copied and translated file must remain “welcome.html“. There will be no confusion since the translated files will end up in the folder named after your language code. For example, the file welcome.html translated in Italian will be placed inside an “it” folder.


Testing html translation:

Most html files to be translated are part of one of our installers. These installers often have a script inside that starts the installer and allows you to read your translations. The instructions for starting this type of script may vary but are usually included in the README file.

Sources:

Much of the .po file guide was taken from a post created some time ago by one of our devs, thewaiter – his guide is still valid:

https://bodhilinux.boards.net/thread/231/moksha-translating

More info about gettext:

en.wikipedia.org/wiki/Gettext

www.gnu.org/software/gettext/

This Wiki is available in PDF form here -> Localization Guide

Author:
Diego “diekrz2” K.

2025 Bodhi Linux

Category: