X Tutup
Skip to content

Make text-related nodes translation domain aware#110378

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
timothyqiu:rtl-preview
Oct 16, 2025
Merged

Make text-related nodes translation domain aware#110378
Repiteo merged 1 commit intogodotengine:masterfrom
timothyqiu:rtl-preview

Conversation

@timothyqiu
Copy link
Member

@timothyqiu timothyqiu commented Sep 10, 2025

Follow-up to #96921
Closes #97893
Supersedes #97918

In this PR:

  • Makes is_layout_rtl() translation domain aware.
    • The translation domain's locale of current node is used instead of global TranslationServer.get_tool_locale().
    • When using inherited layout direction, the search stops at the last parent sharing the same translation domain.
  • Makes various text-drawing controls translation domain aware.
  • When translation preview is disabled, text won't be translated, but things like layout direction and font language are determined by the fallback locale project setting.

An internal Object::_get_locale() helper method is added to simplify getting the actual locale / language to use.

Peek.2025-09-10.17-36.mp4

Test project used in the video (font not included): rtl-preview.zip

There're lots of controls containing the word "Diameter" in the test project. They are to show how the language affects glyph rendering. Both Chinese and Japanese uses the word 直径 for diameter, but the two characters should be rendered differently: 直径 vs 直径.

@timothyqiu timothyqiu added this to the 4.6 milestone Sep 10, 2025
@timothyqiu timothyqiu requested review from a team as code owners September 10, 2025 09:57
@timothyqiu timothyqiu requested a review from a team September 10, 2025 09:57
@timothyqiu timothyqiu requested a review from a team as a code owner September 10, 2025 09:57
- Makes `is_layout_rtl()` translation domain aware
- Makes various text-drawing controls translation domain aware
- Makes translation preview use the project's fallback locale when disabled
@timothyqiu
Copy link
Member Author

Instead of adding TranslationDomain::get_locale(), this PR now adds an internal helper method Object::_get_locale() to further simplify getting the actual locale.

@akien-mga akien-mga requested a review from KoBeWi October 15, 2025 20:45
@Repiteo Repiteo merged commit 9e96c7d into godotengine:master Oct 16, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Oct 16, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

5 participants

X Tutup