1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Cleanup editor translation related methods

- Unify logic for loading editor/property/doc/extractable translations.
- Replace legacy `TranslationServer` methods with translation domains for internal translations.
- Only pre-create editor/property/doc translation domains in editor builds.
- Prevent adding `null` translation.
- Fixes potential loading of duplicated editor translations.
- Add internal `has_translation_for_locale()` instead of calling `get_loaded_translations().has()`.
This commit is contained in:
Haoyu Qiu
2025-06-26 15:16:30 +08:00
parent 8b4b93a82e
commit 3f03260a21
12 changed files with 77 additions and 163 deletions

View File

@@ -578,7 +578,7 @@ void EditorNode::_update_translations() {
if (main->is_enabled()) {
// Check for the exact locale.
// `get_potential_translations("zh_CN")` could return translations for "zh".
if (main->get_loaded_locales().has(main->get_locale_override())) {
if (main->has_translation_for_locale(main->get_locale_override())) {
// The set of translation resources for the current locale changed.
const HashSet<Ref<Translation>> translations = main->get_potential_translations(main->get_locale_override());
if (translations != tracked_translations) {