You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The docs for "Internationalizing games" are great, but I couldn't find a simple example of how TranslationServer should be used to switch between languages:
Mainly whether TranslationServer.set_locale("en") is valid and should be used as such.
Context:
If I understand correctly locale commonly refers to language + region (e.g. en_US English in USA or en_DE for English in Germany)
But the locale in Project Settings > Internationalization > Locale > Fallback is set by default to en and TranslationServer.set_locale("en") does work as well (so without a region)
It seems to me Godot is not too strict about locale vs. language
Enhancement
I'd propose to add an example that follows the following principles (which should be good enough for most games):
Use the user's preferred language (obtained from the OS) -> Godot doesn't seem to do this automatically if I didn't miss anything
Allow to override manually
Important in bi- or multilingual countries
Important for user preference (e.g. when a translation is low quality)
Ignore region as for smaller games it's often not relevant
Default to user's preferred language
If this is not available it will fall back to Project Settings > Internationalization > Locale > Fallback (which in most cases should be en for English)
It's recommended in your game's settings that you have one option "auto" which uses the computer's default language but allow the players to change languages and store this preference in a file.
How to switch to languages from GD-script
TranslationServer.set_locale("en") # Switch to EnglishTranslationServer.set_locale("en_GB") # Switch to British EnglishTranslationServer.set_locale("de") # Switch to German
💡 If something like the above would be desirable I am happy to write a docs entry.
URL to the documentation page (if already existing):
Your Godot version:
Not relevant
Issue description:
The docs for "Internationalizing games" are great, but I couldn't find a simple example of how TranslationServer should be used to switch between languages:
Mainly whether
TranslationServer.set_locale("en")
is valid and should be used as such.Context:
en_US
English in USA oren_DE
for English in Germany)Project Settings > Internationalization > Locale > Fallback
is set by default toen
andTranslationServer.set_locale("en")
does work as well (so without a region)Enhancement
I'd propose to add an example that follows the following principles (which should be good enough for most games):
Default to user's preferred language
If this is not available it will fall back to
Project Settings > Internationalization > Locale > Fallback
(which in most cases should been
for English)Settings
It's recommended in your game's settings that you have one option "auto" which uses the computer's default language but allow the players to change languages and store this preference in a file.
How to switch to languages from GD-script
💡 If something like the above would be desirable I am happy to write a docs entry.
URL to the documentation page (if already existing):
The text was updated successfully, but these errors were encountered: