Creating Translations

From Tuxepedia
Jump to navigation Jump to search

Tuxemon has basic support for changing the in-game language. Currently, most menus and items have translations into different languages. Some dialogs have been changed as well.

Overview[edit | edit source]

Most of the text in Tuxemon is stored as short descriptive names, called keys. These names are also part of "locale dictionaries" stored in a JSON format. Don't let the technical names scare you, its a very simple concept.

In the Tuxemon code, these short names match a longer phrase translated into a native language. For example, the key named "combat_player_run" is "You have run away!" in English, or "Podařilo se ti utéct!".

By creating a new dictionary for a language, or adding entries in an existing one, the game can be further translated.

Using translations in game[edit | edit source]

Right now this is how in-game translation is currently handled:

  • Game language is determined via the locale config option under the [game] section in ~/.tuxemon/tuxemon.cfg.
  • Based on locale setting, in-game text will be pulled from resources/db/locale/<locale>.json
  • If no locale is set in tuxemon.cfg, "en_US" is selected by default.
  • If a translation does not exist for a certain word/phrase in a given language, translation will fall back to "en_US". If a translation doesn't exist in "en_US" either, "Locale Error" text will be displayed instead.
  • All items and techniques have a name_trans and description_trans property that will be used for translation lookup. The name and description properties will be loaded as a fall back.

Creating a new translation[edit | edit source]

The most simple way will be to copy the en_US.json copy, name it after your locale, and then translate each line. Be sure to leave the words that look like $Template:Name, as they will be used by the game to fill in different words when shown to the player. Do not translate the words inside the brackets.

Translating Items and Techniques[edit | edit source]

Currently, to add a translation for a particular item or technique, first lookup the json file for the item/technique and find entry call "description_trans" and remember that value (ie: "item_berry_descr"). Then open the dictionary (ie: en_US) and add a new entry with that name ("item_berry_descr"). Then fill in your translated text.

Final notes[edit | edit source]

The translation feature is new and there are a limitations right now:

  • All of the formatting was made for English, so some menus may not render correctly
  • Asian languages are supported, but the fonts render incorrectly (translation in progress)
  • Translations in the map dialog boxes is currently not implemented.