Prepare for moving editor and classref translations to godot-editor-l10n repo

- Separate editor interface and property translations.
- Add property translation in TranslationServer.
- The split and merge of the POT/PO/Makefiles and extract scripts is done
  directly in godot-editor-l10n, the files will be removed in the next commit.
- Remove the hardcoded "to_include" lists from the SCsub, we'll only commit the
  files which are ready to inclue.
This commit is contained in:
Haoyu Qiu 2022-12-27 10:58:01 +08:00 committed by Rémi Verschelde
parent bdad9770d6
commit 5d7e003b29
No known key found for this signature in database
GPG key ID: C3336907360768E1
10 changed files with 82 additions and 11 deletions

View file

@ -30,6 +30,7 @@
#include "editor_property_name_processor.h"
#include "core/string/translation.h"
#include "editor_settings.h"
EditorPropertyNameProcessor *EditorPropertyNameProcessor::singleton = nullptr;
@ -92,18 +93,30 @@ String EditorPropertyNameProcessor::process_name(const String &p_name, Style p_s
} break;
case STYLE_LOCALIZED: {
return TTRGET(_capitalize_name(p_name));
const String capitalized = _capitalize_name(p_name);
if (TranslationServer::get_singleton()) {
return TranslationServer::get_singleton()->property_translate(capitalized);
}
return capitalized;
} break;
}
ERR_FAIL_V_MSG(p_name, "Unexpected property name style.");
}
String EditorPropertyNameProcessor::translate_group_name(const String &p_name) const {
if (TranslationServer::get_singleton()) {
return TranslationServer::get_singleton()->property_translate(p_name);
}
return p_name;
}
EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
ERR_FAIL_COND(singleton != nullptr);
singleton = this;
// The following initialization is parsed in `editor/translations/extract.py` with a regex.
// The following initialization is parsed by the l10n extraction script with a regex.
// The map name and value definition format should be kept synced with the regex.
// https://github.com/godotengine/godot-editor-l10n/blob/main/scripts/common.py
capitalize_string_remaps["2d"] = "2D";
capitalize_string_remaps["3d"] = "3D";
capitalize_string_remaps["aa"] = "AA";
@ -263,7 +276,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
capitalize_string_remaps["yz"] = "YZ";
// Articles, conjunctions, prepositions.
// The following initialization is parsed in `editor/translations/extract.py` with a regex.
// The following initialization is parsed in `editor/translations/scripts/common.py` with a regex.
// The word definition format should be kept synced with the regex.
stop_words = LocalVector<String>({
"a",