Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n: Fix get_tool_locale() not return current locale at runtime #101184

Closed
wants to merge 1 commit into from

Conversation

zaevi
Copy link
Contributor

@zaevi zaevi commented Jan 6, 2025

According to documentation, TranslationServer::get_tool_locale() should return the same value as get_locale() at runtime, but now it returns fixed value en when no Translation loaded. This causes some issues about text shaping as #100642 (comment) explained.

@@ -503,7 +503,7 @@ String TranslationServer::get_tool_locale() {
// Look for best matching loaded translation.
Ref<Translation> t = main_domain->get_translation_object(locale);
if (t.is_null()) {
return "en";
return locale;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not how it supposed to work, if no translation is provided it should return en, since everything assumes default locale is English. Otherwise, any untranslated app will use whatever current user locale, which will result in multiple undesired effects (flipping UI if user locale is right-to-left for example).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so, then I can only set the Bidi Language for each control when I don't have translation loaded? (even if I've already specified the language for the project)
Is it possible to let TextServer use get_locale() instead to get the current language?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even if I've already specified the language for the project

Not sure if there's option to set language for the project (only internationalization/locale/test, which should probably be used instead of hardcoded en if set).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it only affects get_locale()

@zaevi
Copy link
Contributor Author

zaevi commented Jan 6, 2025

Closed as #100642 (comment) discussed

@zaevi zaevi closed this Jan 6, 2025
@zaevi zaevi deleted the fix_locale_fallback branch January 6, 2025 16:59
@AThousandShips AThousandShips removed this from the 4.4 milestone Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TextServer] Some texts are shaped accidently when use system font
3 participants