summaryrefslogtreecommitdiff
path: root/core/string/translation.cpp
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/string/translation.cpp
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/string/translation.cpp')
-rw-r--r--core/string/translation.cpp14
1 files changed, 14 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;
}