diff --git a/tutorials/i18n/internationalizing_games.rst b/tutorials/i18n/internationalizing_games.rst index 111f3d806..74a5cd876 100644 --- a/tutorials/i18n/internationalizing_games.rst +++ b/tutorials/i18n/internationalizing_games.rst @@ -6,11 +6,10 @@ Internationalizing games Introduction ------------ -While indie or niche games usually -do not need localization, games targeting a more massive market -often require localization. Godot offers many tools to make this process -more straightforward, so this tutorial is more like a collection of -tips and tricks. +While indie or niche games usually do not need localization, games targeting +a more massive market often require localization. Godot offers many tools to +make this process more straightforward, so this tutorial is more like a +collection of tips and tricks. Localization is usually done by specific studios hired for the job. Despite the huge amount of software and file formats available for this, the most common way @@ -60,10 +59,14 @@ Select the resource to be remapped then add some alternatives for each locale. Automatically setting a language -------------------------------- -It is recommended to default to the user's preferred language which can be obtained via :ref:`OS.get_locale_language() `. -If your game is not available in that language, it will fall back to the :ref:`Fallback ` + +It is recommended to default to the user's preferred language which can be +obtained via :ref:`OS.get_locale_language() `. +If your game is not available in that language, it will fall back to the +:ref:`Fallback ` in **Project Settings > Internationalization > Locale**, or to ``en`` if empty. -Nevertheless letting players change the language in game is recommended for various reasons (e.g. translation quality or player preference). +Nevertheless, letting players change the language in game is recommended for +various reasons (e.g. translation quality or player preference). .. tabs:: .. code-tab:: gdscript @@ -78,7 +81,9 @@ Nevertheless letting players change the language in game is recommended for vari Locale vs. language ------------------- -A :ref:`locale ` is commonly a combination of a language with a region or country, but can also contain information like a script or a variant. + +A :ref:`locale ` is commonly a combination of a language with a +region or country, but can also contain information like a script or a variant. Examples: @@ -87,21 +92,26 @@ Examples: - ``en_US``: English in the USA / American English - ``en_DE``: English in Germany -Indie games generally only need to care about language, but read on for more information. +Indie games generally only need to care about language, but read on for more +information. -Why locales exist can be illustrated through the USA and Great Britain. Both speak the same language (English), yet differ in many aspects: -- Spelling: E.g. gray (USA), grey (GB) -- Use of words: E.g. eggplant (USA), aubergine (GB) -- Units or currencies: E.g. feet/inches (USA), metres/cm (GB) +Why locales exist can be illustrated through the USA and Great Britain. +Both speak the same language (English), yet differ in many aspects: -It can get more complex however. Imagine you offer different content in Europe and in China (e.g. in an MMO). You will need to translate each of those content variations into many languages and store and load them accordingly. +- Spelling: e.g. gray (USA), grey (GB) +- Use of words: e.g. eggplant (USA), aubergine (GB) +- Units or currencies: e.g. feet/inches (USA), metres/cm (GB) + +It can get more complex however. Imagine you offer different content in Europe +and in China (e.g. in an MMO). You will need to translate each of those content +variations into many languages and store and load them accordingly. Converting keys to text ----------------------- Some controls, such as :ref:`Button ` and :ref:`Label `, will automatically fetch a translation if their text matches a translation key. -For example, if a label's text is "MAIN_SCREEN_GREETING1" and that key exists +For example, if a label's text is ``MAIN_SCREEN_GREETING1`` and that key exists in the current translation, then the text will automatically be translated. This automatic translation behavior may be undesirable in certain cases. For @@ -160,6 +170,8 @@ allow translators to choose the *order* in which placeholders appear: # Additionally, this form gives more context for translators to work with. message.text = tr("{character} picked up the {weapon}").format({character = "Ogre", weapon = "Sword"}) +.. _doc_internationalizing_games_translation_contexts: + Translation contexts ~~~~~~~~~~~~~~~~~~~~ @@ -187,6 +199,8 @@ identical: // "Close", as in a distance (opposite of "far"). GetNode