Übersetzung von Spielen¶
Einführung¶
Sería excelente que el mundo hablara solo un idioma (Es wäre gut wenn die Welt nur eine Sprache sprechen würde). Zum Leidwesen für uns Entwickler ist dem nicht so. Kleine Indie oder Nischen Spiele benötigen keine Lokalisierung, größere Spiele die auf den breiten Massenmarkt zielen benötigen dies aber auf jeden Fall. Godot bietet viele Tools, um diesen Prozess einfacher zu gestalten. Daher ähnelt diese Anleitung eher einer Sammlung von Tipps und Tricks.
Localization is usually done by specific studios hired for the job and, despite the huge amount of software and file formats available for this, the most common way to do localization to this day is still with spreadsheets. The process of creating the spreadsheets and importing them is already covered in the Übersetzungen importieren tutorial, so this one could be seen more like a follow-up to that one.
Bemerkung
Wir werden die offizielle Demo als Beispiel verwenden. Sie können es aus der Bestandsbibliothek herunterladen.
Konfigurieren der importierten Übersetzung¶
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:

Der obige Dialog wird verwendet, um Übersetzungen projektweit hinzuzufügen oder zu entfernen.
Ressourcen lokalisieren¶
It is also possible to instruct Godot to use alternate versions of assets (resources) depending on the current language. The Remaps tab can be used for this:

Wählen Sie die Ressource aus, die neu zugeordnet werden soll und fügen Sie dann für jedes Gebietsschema einige Alternativen hinzu.
Schlüssel in Text konvertieren¶
Some controls, such as Button and 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 in the current translation, then the text will automatically be translated.
In code, the Object.tr() function can be used. This will just look up the text in the translations and convert it if found:
level.set_text(tr("LEVEL_5_NAME"))
status.set_text(tr("GAME_STATUS_" + str(status_index)))
In der Größe veränderbare Steuerelementen erzeugen¶
The same text in different languages can vary greatly in length. For this, make sure to read the tutorial on Größe und Bezugspunkte (Anker), as dynamically adjusting control sizes may help. Container can be useful, as well as the text wrapping options available in Label.
Übersetzungsserver¶
Godot has a server handling low-level translation management called the TranslationServer. Translations can be added or removed during run-time; the current language can also be changed at run-time.
Kommandozeile¶
Die Sprache kann getestet werden, wenn Godot über die Befehlszeile ausgeführt wird. Um beispielsweise ein Spiel auf Französisch zu testen, kann das folgende Argument angegeben werden:
godot --language fr
Übersetzen des Projektnamens¶
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, create a new setting application/name
in the Project
Settings and append the locale identifier to it.
For instance, for Spanish, this would be application/name_es
:

If you are unsure about the language code to use, refer to the list of locale codes.