Howto:Translate FlightGear: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
(14 intermediate revisions by 8 users not shown)
Line 1: Line 1:
===<font color="red">This feature appears to be broken with recent versions of FlightGear.</font>===
FlightGear supports localization, that is, showing the user interface in the user's native language rather than in English.  


This howto explains translating [[FlightGear]]'s menus and messages to your language.
This page will help you translate FlightGear to a new language or improve the existing translations.


Flightgear has bad I18N (internationalization) support. More information at: http://www.mail-archive.com/flightgear-users@lists.sourceforge.net/msg05761.html
== 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 <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)
* the built-in launcher (FlightGear 2018.3 and later)


'''WARNING:''' You can only use [http://en.wikipedia.org/w/index.php?title=American_Standard_Code_for_Information_Interchange&section=5#ASCII_printable_characters ASCII] characters for translating strings in your language.
== How to translate ==
# 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, ask on the development mailing for the empty translation files to be created for you. (It's better to do this than copying an existing translation, because of data that will be accidentally included otherwise)
# Open the .XLF files in the subdirectory of your language and translate the English strings in them. You can edit the .XLF files in a text editor (such as Notepad++ or GEdit) but you can also use translation tools such as Qt Linguist or any XLIFF editor. Using a structured tool is recommended because it can track the translation state (flagging untranslated strings) and most tools include helpers to partially automate the translation process.
# 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>.
# Submit your updated .XLF files for inclusion via the development mailing list or a SourceForge merge request


== The How to ==
There are two XLF files in each language subdirectory : one for the core simulator strings (startup messages, command line arg help, hints) and one for the launcher.  
# You need to have FlightGear installed on your computer of course. For example: FlightGear on Windows is in the directory: <tt>C:\Program Files\FlightGear-1.0.0</tt>. Strings to translate are between the XML tags <label> and <legend>.
# You need to translate the english strings in the xml file <tt>C:\Program Files\FlightGear-1.0.0\data\gui\menubar.xml</tt>. For example, in the file <tt>menubar.xml</tt>, the english text string <tt><label>Save</label></tt> will become <tt><label>Sauvegarder</label></tt> in French.
# You need to translate the english strings in the xml files that are in the directory <tt>C:\Program Files\FlightGear-1.0.0\data\gui\dialogs</tt>
#* Create a copy of the file <tt>C:\Program Files\FlightGear-1.0.0\data\Translations\strings-default.xml</tt> in the directory <tt>C:\Program Files\FlightGear-1.0.0\data\Translations</tt>.
#* Rename the copy of the file <tt>strings-default.xml</tt> with a new name like <tt>strings-language_code.xml</tt> where <tt>language_code</tt> is the international code for your language. For example, fr for french or de for German.
# Translate all the English text strings in your strings-language_code.xml file in your language.
# Edit the file <tt>C:\Program Files\FlightGear-1.0.0\data\Translations\locale.xml</tt> and add the section for your language:


<locale>
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}}.
<lang type="string">language_code</lang>
<lang type="string">language_code.character_set</lang>
<strings>Translations/strings-language_code.xml</strings>
</locale>


For example, in german, you have this :
== How to translate the shortcut file ==
<locale>
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).
<lang type="string">de</lang>
 
<lang type="string">de_AT</lang>
== How to translate the man pages ==
<lang type="string">de_CH</lang>
# Determine the two letter ISO 639-1 language code for the language you want to translate the man pages to.
<lang type="string">de_AT.ISO8859-15</lang>
# 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.
<lang type="string">de_DE.ISO8859-15</lang>
# 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).
<lang type="string">de_CH.ISO8859-15</lang>
# 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>.
<strings>Translations/strings-de.xml</strings>
# Open the man pages in the subdirectory of your language and translate them.
</locale>


== Related content ==
== Related content ==
* [[Howto: Translate FlightGear Launch Control‎‎]]
* [[Howto: Translate FlightGear Launch Control‎‎]]
* [[Translation requests]]


[[Category:Howto|Translate FlightGear]]
[[Category:Howto|Translate FlightGear]]

Revision as of 15:56, 27 August 2018

FlightGear supports localization, that is, showing the user interface in the user's native language rather than in English.

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)
  • the built-in launcher (FlightGear 2018.3 and later)

How to translate

  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, ask on the development mailing for the empty translation files to be created for you. (It's better to do this than copying an existing translation, because of data that will be accidentally included otherwise)
  3. Open the .XLF files in the subdirectory of your language and translate the English strings in them. You can edit the .XLF files in a text editor (such as Notepad++ or GEdit) but you can also use translation tools such as Qt Linguist or any XLIFF editor. Using a structured tool is recommended because it can track the translation state (flagging untranslated strings) and most tools include helpers to partially automate the translation process.
  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.
  5. Submit your updated .XLF files for inclusion via the development mailing list or a SourceForge merge request

There are two XLF files in each language subdirectory : one for the core simulator strings (startup messages, command line arg help, hints) and one for the launcher.

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