Howto:Translate FlightGear: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
m (URL capitalisation fix.)
(Add shortcut file and man pages translation instructions)
Line 1: Line 1:
How to '''translate [[FlightGear]]''''s menus and messages to your language.
FlightGear supports localization, that is, showing the user interface in the user's native language rather than in English. At the time of writing (June 2017), not all parts of the simulator are localized, but efforts are underway to make it so.


# Check whether your language already has a subdirectory below {{fg root file|Translations}}. Also check the master repository [{{fgdata url|path=Translations}}] - maybe someone has just recently created the language resources. If so, please download the files from the repository, as the ones on your system might be outdated.
This page will help you translate FlightGear to a new language or improve the existing translations.
#* The two letter language code can be obtained from the [http://www.loc.gov/standards/iso639-2/php/code_list.php ISO 639 list]. If it does exist, skip to step 2, else do the following:
## Create an empty directory with your language's code.
## Download the latest English language resources from {{fgdata source|path=Translations/en}}.
## Copy all the downloaded files to the directory of your language (e.g. "menu.xml" and "options.xml").
# Translate the English strings in your language's xml files.
#* '''Do not''' translate the filenames!
#* Please do not change the order, structure or indentation of the XML files - only translate the English text content itself. This helps with future maintenance when the language resource need to be updated for another FG version, since the files can more easily be compared with the default English resource.
# Edit the file {{fg root file|Translations/locale.xml}} and add the section for your language if it's not already there.
# Start FlightGear
#* FlightGear selects the language resource based on your computer's main language setting (operations system's locale).
#* When FlightGear does not select your preferred language automatically (i.e. you have configured your machine to another language), you can explicitly select a language using the command-line switch <code>--language=<language code></code>, or, when starting via [[FGRun]], select the language at <tt>Advanced > General</tt>.


=== Supported Versions ===
== What can be translated ==
Menu translations are only supported as of FG 2.7.0 and later.
The following parts of the simulator can be translated:
* the menus, splash screens, startup tips and the text shown when the <code>--help</code> 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).


=== Supported Character Sets ===
== How to translate the interface ==
Currently, FlightGear has very limited character set support. Only plain [http://en.wikipedia.org/w/index.php?title=American_Standard_Code_for_Information_Interchange&section=5#ASCII_printable_characters ASCII] characters and its [http://en.wikipedia.org/wiki/Latin1 Latin1/ISO-8859-1] extension are supported - which covers Western European languages only (Portuguese to German, Italian to Norwegian).
# Determine the two letter ISO 639-1 language code for the language you want to translate FlightGear to. A list can be found on the [https://www.loc.gov/standards/iso639-2/php/code_list.php Library of Congress Web site].
# Check whether your language already has a subdirectory below [{{fgdata url|path=Translations}} the Translations directory]. If it does not, create an empty directory in it named after the language code, then [{{fgdata url|path=Translations/en}} download the latest English resources] and copy the files to the directory of your language.
# Open the XML files in the subdirectory of your language and translate the English strings in them. Do not translate the filenames and do not change the order, structure or indentation of the XML files (this helps with future maintenance when the language resources need to be updated for another FlightGear version).
# Start FlightGear to test your translation. 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 <code>--language=<i>language code</i></code>.


However, FlightGear's GUI is currently being reworked (PLIB is ported to OSG). Once the work is complete, it should be possible to support arbitrary fonts and languages - so even Russian, Japanese, Chinese, ... fonts will be supported.
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 {{Mailing list e-mail address|flightgear-devel}}.
 
== How to translate the shortcut file ==
Open [{{flightgear url|path=package/org.flightgear.FlightGear.desktop}} the FlightGear <code>.desktop</code> file] and translate the ''GenericName'', ''Comment'' and ''Keywords'' keys (add the ''GenericName[xx]'', ''Comment[xx]'' and ''Keywords[xx]'' keys, where ''xx'' is the two letter ISO 639-1 code of the language).
 
== How to translate the man pages ==
# Determine the two letter ISO 639-1 language code for the language you want to translate the man pages to.
# Check whether your language already has a subdirectory below [{{flightgear url|path=man}} the man pages directory]. If it does not, create an empty directory in it named after the language code, then copy <code>man1</code> and <code>man5</code> from the man pages directory to the directory of your language.
# Edit [{{flightgear url|path=man/CMakeLists.txt}} man/CMakeLists.txt] and add the instruction <code>add_subdirectory(xx)</code> in the <code>if(NOT WIN32)</code> block (where ''xx'' is the language code).
# Edit <code>man/xx/man1/CMakeLists.txt</code> and <code>man/xx/man5/CMakeLists.txt</code>: on the last row, set the installation directory (<code>DESTINATION</code>), respectively, to <code>${CMAKE_INSTALL_MANDIR}/xx/man1</code> and <code>${CMAKE_INSTALL_MANDIR}/xx/man5</code>.
# Open the man pages in the subdirectory of your language and translate them.


== Related content ==
== Related content ==

Revision as of 22:08, 28 June 2017

FlightGear supports localization, that is, showing the user interface in the user's native language rather than in English. At the time of writing (June 2017), 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

  1. Determine the two letter ISO 639-1 language code for the language you want to translate FlightGear to. A list can be found on the Library of Congress Web site.
  2. Check whether your language already has a subdirectory below the Translations directory. If it does not, create an empty directory in it named after the language code, then download the latest English resources and copy the files to the directory of your language.
  3. Open the XML files in the subdirectory of your language and translate the English strings in them. Do not translate the filenames and do not change the order, structure or indentation of the XML files (this helps with future maintenance when the language resources need to be updated for another FlightGear version).
  4. Start FlightGear to test your translation. 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[xx], Comment[xx] and Keywords[xx] keys, where xx 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(xx) in the if(NOT WIN32) block (where xx is the language code).
  4. Edit man/xx/man1/CMakeLists.txt and man/xx/man5/CMakeLists.txt: on the last row, set the installation directory (DESTINATION), respectively, to ${CMAKE_INSTALL_MANDIR}/xx/man1 and ${CMAKE_INSTALL_MANDIR}/xx/man5.
  5. Open the man pages in the subdirectory of your language and translate them.

Related content