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

@@ -71,7 +71,7 @@ static String _get_indent(const String &p_text) {
static String _translate_doc_string(const String &p_text) {
const String indent = _get_indent(p_text);
const String message = p_text.dedent().strip_edges();
const String translated = TranslationServer::get_singleton()->doc_translate(message, "");
const String translated = TranslationServer::get_singleton()->get_doc_domain()->translate(message, StringName());
// No need to restore stripped edges because they'll be stripped again later.
return translated.indent(indent);
}