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

@ -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;
}

View file

@ -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();