diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/map.h | 1 | ||||
| -rw-r--r-- | core/script_language.h | 1 | ||||
| -rw-r--r-- | core/set.h | 1 | ||||
| -rw-r--r-- | core/translation.cpp | 13 | ||||
| -rw-r--r-- | core/translation.h | 4 |
5 files changed, 18 insertions, 2 deletions
diff --git a/core/map.h b/core/map.h index f01062ebed..fb24a5868c 100644 --- a/core/map.h +++ b/core/map.h @@ -438,7 +438,6 @@ private: Element *rp = ((p_node->left == _data._nil) || (p_node->right == _data._nil)) ? p_node : p_node->_next; Element *node = (rp->left == _data._nil) ? rp->right : rp->left; - node->parent = rp->parent; Element *sibling; if (rp == rp->parent->left) { diff --git a/core/script_language.h b/core/script_language.h index 25767a2f7a..c243ef781b 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -202,6 +202,7 @@ public: virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = NULL) const = 0; virtual Script *create_script() const = 0; virtual bool has_named_classes() const = 0; + virtual bool supports_builtin_mode() const = 0; virtual bool can_inherit_from_file() { return false; } virtual int find_function(const String &p_function, const String &p_code) const = 0; virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const = 0; diff --git a/core/set.h b/core/set.h index 0f48e07520..331979d4e3 100644 --- a/core/set.h +++ b/core/set.h @@ -424,7 +424,6 @@ private: Element *rp = ((p_node->left == _data._nil) || (p_node->right == _data._nil)) ? p_node : p_node->_next; Element *node = (rp->left == _data._nil) ? rp->right : rp->left; - node->parent = rp->parent; Element *sibling; if (rp == rp->parent->left) { diff --git a/core/translation.cpp b/core/translation.cpp index 27e3b202d0..54dbaf6ed5 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -957,6 +957,12 @@ String TranslationServer::get_locale() const { return locale; } +String TranslationServer::get_locale_name(const String &p_locale) const { + + if (!locale_name_map.has(p_locale)) return String(); + return locale_name_map[p_locale]; +} + void TranslationServer::add_translation(const Ref<Translation> &p_translation) { translations.insert(p_translation); @@ -1122,6 +1128,8 @@ void TranslationServer::_bind_methods() { ClassDB::bind_method(D_METHOD("set_locale", "locale"), &TranslationServer::set_locale); ClassDB::bind_method(D_METHOD("get_locale"), &TranslationServer::get_locale); + ClassDB::bind_method(D_METHOD("get_locale_name", "locale"), &TranslationServer::get_locale_name); + ClassDB::bind_method(D_METHOD("translate", "message"), &TranslationServer::translate); ClassDB::bind_method(D_METHOD("add_translation", "translation"), &TranslationServer::add_translation); @@ -1147,4 +1155,9 @@ TranslationServer::TranslationServer() : locale("en"), enabled(true) { singleton = this; + + for (int i = 0; locale_list[i]; ++i) { + + locale_name_map.insert(locale_list[i], locale_names[i]); + } } diff --git a/core/translation.h b/core/translation.h index cf59583ad6..5fec1d9f45 100644 --- a/core/translation.h +++ b/core/translation.h @@ -73,6 +73,8 @@ class TranslationServer : public Object { Set<Ref<Translation> > translations; Ref<Translation> tool_translation; + Map<String, String> locale_name_map; + bool enabled; static TranslationServer *singleton; @@ -91,6 +93,8 @@ public: void set_locale(const String &p_locale); String get_locale() const; + String get_locale_name(const String &p_locale) const; + void add_translation(const Ref<Translation> &p_translation); void remove_translation(const Ref<Translation> &p_translation); |