Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

User:Elgaton/Draft:Translate FlightGear

From FlightGear wiki
< User:Elgaton
Revision as of 10:38, 8 August 2018 by Elgaton (Talk | contribs) (Initial version)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
WIP.png Work in progress
This article or section will be worked on in the upcoming hours or days.
See history for the latest developments.

FlightGear supports localization, that is, showing the user interface in the user's native language rather than in English. At the time of writing (August 2018), not all parts of the simulator are localized, but efforts are underway to make it so.

This page will help you translate FlightGear to a new language or improve the existing translations.

What can be translated

The following parts of the simulator can be translated:

  • the menus, splash screens, startup tips and the text shown when the --help command-line option is used (FlightGear 2.7.0 and later);
  • the shortcut file on Linux systems (FlightGear 2017.1 and later);
  • the man pages (FlightGear 2017.3 and later).

How to translate the interface

Each language in the world has an associated two-letter code (the ISO 639-1 language code). You can find their list on the Library of Congress Web site.

Interface language files are saved in the Translations directory in the FGDATA repository; each language is stored inside a directory having the corresponding ISO 639-1 code as its name.

There is also a set of translation helper scripts which help you create a new translation or update an existing one.

Preparing the translation environment

On the machine you are going to use to translate FlightGear, install:

  • Python 3: on Microsoft Windows and Mac OS X systems, download the latest 3.x build from the official site; on Linux, install it from your distribution's package manager;
  • Git: on Microsoft Windows, download it from the official site; on Mac OS X, run git --help from a terminal to have it downloaded and installed if needed; on Linux, install it from your distribution's package manager;
  • an editor for XLIFF files, like QT Linguist.

Open a terminal, go into the directory you would like to clone the repositories into and type the following command to clone the FGMeta repository:

$ git clone git://git.code.sf.net/p/flightgear/fgmeta/ fgmeta

Then, follow the instructions in FlightGear Git: data developers#Preparations to clone FGData inside the fgmeta directory.

Translating the interface into a new language

If there is no translation for your language:

  1. Check the PLURAL_FORMS variable inside python3-flightgear/flightgear/meta/i18n.py to make sure that your language is listed. If it is not, add a new entry for it - it should have the following form:
    "LANGUAGE_CODE": ["singular", "plural"],
    where LANGUAGE_CODE is the language code and what follows is an array of plural forms for the language (in the same order as they are displayed in the Qt Linguist tool).
  2. Open a terminal and change into the python3-flightgear directory inside your FGData clone.
  3. Run ./fg-new-translations --transl-dir="FGDATA_CLONE_PATH/Translations" LANGUAGE_CODE to create the new files. Replace FGDATA_CLONE_PATH with the path of the directory you cloned FGData into and LANGUAGE_CODE with the language code.

Updating an existing translation

If a translation for your language already exists:

  1. Open a terminal and change into the python3-flightgear directory inside your FGData clone.
  2. Run ./fg-update-translation-files --transl-dir="FGDATA_CLONE_PATH/Translations" merge-new-master LANGUAGE_CODE to update the translation files. Replace FGDATA_CLONE_PATH with the path of the directory you cloned FGData into and LANGUAGE_CODE with the language code.

Translating the files

  1. Open the XLT files inside FGDATA_CLONE_PATH/Translations/LANGUAGE_CODE with the XLIFF file editor and translate them.
  2. If you want to test your translation, you will need to build the latest FlightGear version from source. After you have built it, start FlightGear to test your translation, passing the --fg-root=FGDATA_CLONE_PATH option to have it read the translations from your FGData clone. By default, the simulator will select the locale of your operating system as the language to use; you can explicitly select a language using the command-line option --language=LANGUAGE_CODE.

Note that the user interface might have not full Unicode support (some special/accented characters might not be shown): should you encounter such a location, please write to the flightgear-devel mailing list at flightgear-devel@lists.sourceforge.net.

How to translate the shortcut file

Open the FlightGear .desktop file and translate the GenericName, Comment and Keywords keys (add the GenericName[LANGUAGE_CODE], Comment[LANGUAGE_CODE] and Keywords[LANGUAGE_CODE] keys, where LANGUAGE_CODE is the two letter ISO 639-1 code of the language).

How to translate the man pages

  1. Determine the two letter ISO 639-1 language code for the language you want to translate the man pages to.
  2. Check whether your language already has a subdirectory below the man pages directory. If it does not, create an empty directory in it named after the language code, then copy man1 and man5 from the man pages directory to the directory of your language.
  3. Edit man/CMakeLists.txt and add the instruction add_subdirectory(LANGUAGE_CODE) in the if(NOT WIN32) block (where LANGUAGE_CODE is the language code).
  4. Edit man/LANGUAGE_CODE/man1/CMakeLists.txt and man/LANGUAGE_CODE/man5/CMakeLists.txt: on the last row, set the installation directory (DESTINATION), respectively, to ${CMAKE_INSTALL_MANDIR}/LANGUAGE_CODE/man1 and ${CMAKE_INSTALL_MANDIR}/LANGUAGE_CODE/man5.
  5. Open the man pages in the subdirectory of your language and translate them.

Related content