Howto:Translate FlightGear: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Translation notice}}
{{Translation notice}}


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.
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.
This page will help you translate FlightGear to a new language or improve the existing translations.
Line 7: Line 7:
== What can be translated ==
== What can be translated ==
The following parts of the simulator 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 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 shortcut file on Linux systems (FlightGear 2017.1 and later)
* the man pages (FlightGear 2017.3 and later).
* the man pages (FlightGear 2017.3 and later)
* the built-in launcher (FlightGear 2018.3 and later)


== How to translate the interface ==
== 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].
# 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.
# 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 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).
# 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.
# 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>.
# 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>.



Revision as of 15:47, 27 August 2018

Note

Note that the new translation infrastructure will be based on the XLIFF 1.2 format (*.xlf files in [1], the French file is complete). These files can be translated with Qt Linguist, which is much more convenient than the old (current) system, especially to detect new strings and strings which have changed since they were last translated. However, the C++ code to use the XLIFF files in FlightGear is not quite ready. It's okay if the translation is made in the old format for now, we have a script to convert it, cf. fg-convert-translation-files at [2].[1]

References
  1. Florent Rougon  (Oct 11th, 2017).  Re: [Flightgear-devel] Translating the Flight Gear .

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.
  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