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

Enable changing editor language without restart #102562

Merged
merged 1 commit into from
Mar 24, 2025

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Feb 7, 2025

Currently changing editor language requires editor restart. Godot has a good auto-translation system, which is under-utilized in the editor. For a long time the editor auto-translation was completely disabled. Then there is TTR method which we use everywhere, which makes it impossible to auto-translate, because it immediately translates the string.

#75012 enabled auto-translation to work in the editor, and recently there were some efforts to replace TTR with TTRC (e.g. #99158). Also in 4.4 there were various GUI enhancements that added better localization support to many Control nodes.

This PR makes another step - it actually enables language switching in the editor.

godot.windows.editor.dev.x86_64_U2VP5Pd26j.mp4

Though as you can see, it's very basic right now. For proper language switching we need to use TTRC where possible, and NOTIFICATION_TRANSLATION_CHANGED where not (e.g. in format strings). Thus, while the PR makes changing the language setting have immediate effect, the user is still prompted to restart the editor as before.

IMO enabling this before the editor is ready is harmless, while it allows for easier testing of auto-translation. Eventually we will be able to properly switch editor language without restart at all.

Included some extra changes to the top menu bar, to make it more obvious that the language has changed.

@KoBeWi KoBeWi added this to the 4.x milestone Feb 7, 2025
@KoBeWi KoBeWi force-pushed the edytor_dans_todos_Sprache branch from 11ee6b9 to 4aca348 Compare February 8, 2025 15:13
@KoBeWi KoBeWi requested a review from timothyqiu March 9, 2025 14:27
Copy link
Member

@timothyqiu timothyqiu left a comment

Choose a reason for hiding this comment

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

Perhaps we should also remove this editor hint check in SceneTree. So that NOTIFICATION_TRANSLATION_CHANGED can propagate.

case NOTIFICATION_TRANSLATION_CHANGED: {
if (!Engine::get_singleton()->is_editor_hint()) {
get_root()->propagate_notification(p_notification);
}

@KoBeWi KoBeWi force-pushed the edytor_dans_todos_Sprache branch from 4aca348 to 68d9833 Compare March 10, 2025 12:03
@KoBeWi KoBeWi requested a review from a team as a code owner March 10, 2025 12:03
@KoBeWi
Copy link
Member Author

KoBeWi commented Mar 10, 2025

Removed.
I don't know how it worked before, removing check was required for the switch to actually take effect. Maybe I reverted it by accident before pushing, idk.

@Repiteo
Copy link
Contributor

Repiteo commented Mar 24, 2025

Thanks!

@KoBeWi KoBeWi deleted the edytor_dans_todos_Sprache branch March 24, 2025 20:48
@arkology
Copy link
Contributor

arkology commented Mar 27, 2025

@KoBeWi after changing, for example, "en"->"ar"->"en", editor will keep right-to-left direction.
Issue - #104690

@bruvzg
Copy link
Member

bruvzg commented Mar 27, 2025

Most likely some of the direction dependent editor icons aren't reloaded when direction changes, I'll check it later.

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.

5 participants