diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2023-10-05 21:12:10 +0800 |
---|---|---|
committer | Haoyu Qiu <timothyqiu32@gmail.com> | 2024-03-31 18:40:14 +0800 |
commit | 479b7afa8e83607b05a39da71b370b3aee78688e (patch) | |
tree | 30d3528eb9138477e5cefe6e3b3431e0559ca509 /editor/editor_property_name_processor.h | |
parent | 29b3d9e9e538f0aa8effc8ad8bf19a2915292a89 (diff) | |
download | redot-engine-479b7afa8e83607b05a39da71b370b3aee78688e.tar.gz |
Add context support for editor property name i18n
Diffstat (limited to 'editor/editor_property_name_processor.h')
-rw-r--r-- | editor/editor_property_name_processor.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/editor/editor_property_name_processor.h b/editor/editor_property_name_processor.h index 8e3cecb45b..2c68423c84 100644 --- a/editor/editor_property_name_processor.h +++ b/editor/editor_property_name_processor.h @@ -42,9 +42,14 @@ class EditorPropertyNameProcessor : public Node { HashMap<String, String> capitalize_string_remaps; LocalVector<String> stop_words; // Exceptions that shouldn't be capitalized. + HashMap<String, HashMap<String, StringName>> translation_contexts; + // Capitalizes property path segments. String _capitalize_name(const String &p_name) const; + // Returns the translation context for the given name. + StringName _get_context(const String &p_name, const String &p_property, const StringName &p_class) const; + public: // Matches `interface/inspector/capitalize_properties` editor setting. enum Style { @@ -62,7 +67,8 @@ public: static bool is_localization_available(); // Turns property path segment into the given style. - String process_name(const String &p_name, Style p_style) const; + // `p_class` and `p_property` are only used for `STYLE_LOCALIZED`, associating the name with a translation context. + String process_name(const String &p_name, Style p_style, const String &p_property = "", const StringName &p_class = "") const; // Translate plain text group names. String translate_group_name(const String &p_name) const; |