update localization pages and images
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 7.9 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 13 KiB |
BIN
tutorials/i18n/img/localization_dialog.webp
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 18 KiB |
BIN
tutorials/i18n/img/localization_remaps.webp
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 12 KiB |
@@ -29,9 +29,9 @@ Configuring the imported translation
|
||||
|
||||
Translations can get updated and re-imported when they change, but
|
||||
they still have to be added to the project. This is done in
|
||||
**Project → Project Settings → Localization**:
|
||||
:menu:`Project > Project Settings > Localization > Translations`:
|
||||
|
||||
.. image:: img/localization_dialog.png
|
||||
.. image:: img/localization_dialog.webp
|
||||
|
||||
The above dialog is used to add or remove translations project-wide.
|
||||
|
||||
@@ -42,9 +42,9 @@ It is also possible to instruct Godot to use alternate versions of
|
||||
assets (resources) depending on the current language. This can be used for
|
||||
localized images such as in-game billboards or localized voices.
|
||||
|
||||
The **Remaps** tab can be used for this:
|
||||
The :ui:`Remaps` tab can be used for this:
|
||||
|
||||
.. image:: img/localization_remaps.png
|
||||
.. image:: img/localization_remaps.webp
|
||||
|
||||
Select the resource to be remapped then add some alternatives for each locale.
|
||||
|
||||
@@ -66,7 +66,7 @@ It is recommended to default to the user's preferred language which can be
|
||||
obtained via :ref:`OS.get_locale_language() <class_OS_method_get_locale_language>`.
|
||||
If your game is not available in that language, it will fall back to the
|
||||
:ref:`Fallback <class_ProjectSettings_property_internationalization/locale/fallback>`
|
||||
in **Project Settings > Internationalization > Locale**, or to ``en`` if empty.
|
||||
in :menu:`Project > Project Settings > General > 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).
|
||||
|
||||
@@ -119,8 +119,8 @@ in the current translation, then the text will automatically be translated.
|
||||
This automatic translation behavior may be undesirable in certain cases. For
|
||||
instance, when using a Label to display a player's name, you most likely don't
|
||||
want the player's name to be translated if it matches a translation key. To
|
||||
disable automatic translation on a specific node, disable **Localization > Auto
|
||||
Translate** in the inspector.
|
||||
disable automatic translation on a specific node, set the :ui:`Auto Translate > Mode`
|
||||
to ``Disabled`` in the inspector.
|
||||
|
||||
In code, the :ref:`Object.tr() <class_Object_method_tr>` function can be used.
|
||||
This will just look up the text in the translations and convert it if found:
|
||||
@@ -337,9 +337,9 @@ word and line breaking require more than rules over character sequences.
|
||||
Godot includes ICU rule and dictionary-based break iterator data, but this data
|
||||
is not included in exported projects by default.
|
||||
|
||||
To include it, go to **Project → Project Settings**, enable
|
||||
**Internationalization → Locale → Include Text Server Data**,
|
||||
then export the project. Break iterator data is about 4 MB in size.
|
||||
To include it, go to :menu:`Project > Project Settings > General > Internationalization > Locale`
|
||||
and enable :ui:`Include Text Server Data`, then export the project.
|
||||
Break iterator data is about 4 MB in size.
|
||||
|
||||
Structured text BiDi override
|
||||
-----------------------------
|
||||
@@ -380,8 +380,8 @@ Testing translations
|
||||
You may want to test a project's translation before releasing it. Godot provides three ways
|
||||
to do this.
|
||||
|
||||
First, in the Project Settings, under :menu:`Internationalization > Locale`
|
||||
(with advanced settings enabled), there is a **Test** property. Set this property
|
||||
Under :menu:`Project > Project Settings > General > Internationalization > Locale`
|
||||
(with advanced settings enabled) is a :ui:`Test` property. Set this property
|
||||
to the locale code of the language you want to test. Godot will run the project
|
||||
with that locale when the project is run (either from the editor or when exported).
|
||||
|
||||
@@ -411,12 +411,12 @@ Translating the project name
|
||||
|
||||
The project name becomes the app name when exporting to different
|
||||
operating systems and platforms. To specify the project name in more
|
||||
than one language go to **Project > Project Settings> Application >
|
||||
Config**. From here click on the button that says ``Localizable String
|
||||
(Size 0)``. Now there should be a button below that which says ``Add
|
||||
Translation``. Click on that and it will take you to a page where you
|
||||
can choose the language (and country if needed) for your project name
|
||||
translation. After doing that you can now type in the localized name.
|
||||
than one language go to :menu:`Project > Project Settings > General > Application >
|
||||
Config`. From here click on the :button:`Localizable String (Size 0)` button,
|
||||
then the :button:`Add Translation` button.
|
||||
It will take you to a page where you can choose the language
|
||||
(and country if needed) for your project name translation.
|
||||
After doing that you can now type in the localized name.
|
||||
|
||||
.. image:: img/localized_name.webp
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Localization using gettext (PO files)
|
||||
In addition to importing translations in
|
||||
:ref:`CSV format <doc_localization_using_spreadsheets>`, Godot also
|
||||
supports loading translation files written in the GNU gettext format
|
||||
(text-based ``.po`` and compiled ``.mo`` since Godot 4.0).
|
||||
(text-based ``.po`` and compiled ``.mo``).
|
||||
|
||||
.. note:: For an introduction to gettext, check out
|
||||
`A Quick Gettext Tutorial <https://www.labri.fr/perso/fleury/posts/programming/a-quick-gettext-tutorial.html>`_.
|
||||
@@ -69,23 +69,23 @@ Creating the PO template
|
||||
Automatic generation using the editor
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Since Godot 4.0, the editor can generate a PO template automatically from
|
||||
The editor can generate a PO template automatically from
|
||||
specified scene and GDScript files. This POT generation also supports translation
|
||||
contexts and pluralization if used in a script, with the optional second
|
||||
argument of ``tr()`` and the ``tr_n()`` method.
|
||||
|
||||
Open the Project Settings' **Localization > POT Generation** tab, then use the
|
||||
**Add…** button to specify the path to your project's scenes and scripts that
|
||||
Open :menu:`Project > Project Settings > Localization > Template Generation`, then use the
|
||||
:button:`Add…` button to specify the path to your project's scenes and scripts that
|
||||
contain localizable strings:
|
||||
|
||||
.. figure:: img/localization_using_gettext_pot_generation.webp
|
||||
:align: center
|
||||
:alt: Creating a PO template in the Localization > POT Generation tab of the Project Settings
|
||||
:alt: Creating a PO template in the Localization > Template Generation tab of the Project Settings
|
||||
|
||||
Creating a PO template in the **Localization > POT Generation** tab of the Project Settings
|
||||
Creating a PO template in the :menu:`Localization > Template Generation` tab of the :ui:`Project Settings`
|
||||
|
||||
After adding at least one scene or script, click **Generate POT** in the
|
||||
top-right corner, then specify the path to the output file. This file can be
|
||||
After adding at least one scene or script, click :button:`Generate` in the
|
||||
top-right corner, then specify the path to the output file with a ``pot`` file extension. This file can be
|
||||
placed anywhere in the project directory, but it's recommended to keep it in a
|
||||
subdirectory such as ``locale``, as each locale will be defined in its own file.
|
||||
|
||||
@@ -111,7 +111,7 @@ in the project directory, but it's recommended to keep it in a subdirectory, as
|
||||
each locale will be defined in its own file.
|
||||
|
||||
Create a directory named ``locale`` in the project directory. In this directory,
|
||||
save a file named ``messages.pot`` with the following contents:
|
||||
save a file named ``messages.pot`` with the following content:
|
||||
|
||||
::
|
||||
|
||||
@@ -166,8 +166,8 @@ Loading a messages file in Godot
|
||||
--------------------------------
|
||||
|
||||
To register a messages file as a translation in a project, open the
|
||||
**Project Settings**, then go to the **Localization** tab.
|
||||
In **Translations**, click **Add…** then choose the ``.po`` or ``.mo`` file
|
||||
:ui:`Project Settings`, then go to :menu:`Localization > Translations`,
|
||||
click :button:`Add…` then choose the ``.po`` or ``.mo`` file
|
||||
in the file dialog. The locale will be inferred from the
|
||||
``"Language: <code>\n"`` property in the messages file.
|
||||
|
||||
|
||||
@@ -137,13 +137,13 @@ translations to load when the game runs, specified in project.godot (or the
|
||||
project settings). Godot allows loading and removing translations at
|
||||
runtime as well.
|
||||
|
||||
Select the ``.csv`` file and access the **Import** dock to define import
|
||||
Select the ``.csv`` file and access the :ui:`Import` dock to define import
|
||||
options. You can toggle the compression of the imported translations, and
|
||||
select the delimiter to use when parsing the CSV file.
|
||||
|
||||
.. image:: img/import_csv.webp
|
||||
|
||||
Be sure to click **Reimport** after any change to these options.
|
||||
Be sure to click :button:`Reimport` after any change to these options.
|
||||
|
||||
Loading the CSV file as a translation
|
||||
-------------------------------------
|
||||
|
||||
@@ -25,8 +25,8 @@ Enabling and configuring pseudolocalization
|
||||
|
||||
Enabling pseudolocalization and the configurations related to it is as simple as
|
||||
toggling a checkbox in the project settings. These settings can be found in
|
||||
**Project → Project Settings → General → Internationalization → Pseudolocalization**
|
||||
after enabling the **Advanced** toggle in the project settings dialog:
|
||||
:menu:`Project > Project Settings > General > Internationalization > Pseudolocalization`
|
||||
after enabling the :button:`Advanced` toggle in the project settings dialog:
|
||||
|
||||
.. image:: img/pseudolocalization_settings.webp
|
||||
|
||||
|
||||