summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2022-12-27 10:58:01 +0800
committerRĂ©mi Verschelde <rverschelde@gmail.com>2023-02-07 14:20:40 +0100
commit5d7e003b29cf9b57168e459469e13468a49c3da6 (patch)
tree2303ec8b584f3949acc4acf1396ef47b6a2d86ca /core
parentbdad9770d64914da3b77bee49916419b5df87d1c (diff)
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.
Diffstat (limited to 'core')
-rw-r--r--core/string/translation.cpp14
-rw-r--r--core/string/translation.h3
2 files changed, 17 insertions, 0 deletions
diff --git a/core/string/translation.cpp b/core/string/translation.cpp
index 60dca8ebc6..b9d5d3b538 100644
--- a/core/string/translation.cpp
+++ b/core/string/translation.cpp
@@ -768,6 +768,20 @@ StringName TranslationServer::doc_translate_plural(const StringName &p_message,
return p_message_plural;
}
+void TranslationServer::set_property_translation(const Ref<Translation> &p_translation) {
+ property_translation = p_translation;
+}
+
+StringName TranslationServer::property_translate(const StringName &p_message) const {
+ if (property_translation.is_valid()) {
+ StringName r = property_translation->get_message(p_message);
+ if (r) {
+ return r;
+ }
+ }
+ return p_message;
+}
+
bool TranslationServer::is_pseudolocalization_enabled() const {
return pseudolocalization_enabled;
}
diff --git a/core/string/translation.h b/core/string/translation.h
index 8646635eb8..01d239f81c 100644
--- a/core/string/translation.h
+++ b/core/string/translation.h
@@ -78,6 +78,7 @@ class TranslationServer : public Object {
HashSet<Ref<Translation>> translations;
Ref<Translation> tool_translation;
Ref<Translation> doc_translation;
+ Ref<Translation> property_translation;
bool enabled = true;
@@ -174,6 +175,8 @@ public:
void set_doc_translation(const Ref<Translation> &p_translation);
StringName doc_translate(const StringName &p_message, const StringName &p_context = "") const;
StringName doc_translate_plural(const StringName &p_message, const StringName &p_message_plural, int p_n, const StringName &p_context = "") const;
+ void set_property_translation(const Ref<Translation> &p_translation);
+ StringName property_translate(const StringName &p_message) const;
void setup();