Godot Engine – Multi-platform 2D and 3D game engine
Revert "Implement `internationalization/locale/allow_fallback`"
Thaddeus Crewsd5ada603dcd8
diff --git a/core/string/translation_domain.cpp b/core/string/translation_domain.cppindex 1fc0d44c174..48e6fcfbade 100644--- a/core/string/translation_domain.cpp+++ b/core/string/translation_domain.cpp@@ -357,9 +357,8 @@ StringName TranslationDomain::translate(const StringName &p_message, const Strinconst String &locale = locale_override.is_empty() ? TranslationServer::get_singleton()->get_locale() : locale_override;StringName res = get_message_from_translations(locale, p_message, p_context);- const bool &allow_fallback = TranslationServer::get_singleton()->is_fallback_allowed();const String &fallback = TranslationServer::get_singleton()->get_fallback_locale();- if (!res && allow_fallback && fallback.length() >= 2) {+ if (!res && fallback.length() >= 2) {res = get_message_from_translations(fallback, p_message, p_context);}@@ -377,9 +376,8 @@ StringName TranslationDomain::translate_plural(const StringName &p_message, consconst String &locale = locale_override.is_empty() ? TranslationServer::get_singleton()->get_locale() : locale_override;StringName res = get_message_from_translations(locale, p_message, p_message_plural, p_n, p_context);- const bool &allow_fallback = TranslationServer::get_singleton()->is_fallback_allowed();const String &fallback = TranslationServer::get_singleton()->get_fallback_locale();- if (!res && allow_fallback && fallback.length() >= 2) {+ if (!res && fallback.length() >= 2) {res = get_message_from_translations(fallback, p_message, p_message_plural, p_n, p_context);}diff --git a/core/string/translation_server.cpp b/core/string/translation_server.cppindex 918b71257ba..069e53ff43c 100644--- a/core/string/translation_server.cpp+++ b/core/string/translation_server.cpp@@ -498,14 +498,6 @@ String TranslationServer::get_locale() const {return locale;}-void TranslationServer::set_fallback_allowed(const bool &p_allow) {- allow_fallback = p_allow;-}--bool TranslationServer::is_fallback_allowed() const {- return allow_fallback;-}-void TranslationServer::set_fallback_locale(const String &p_locale) {fallback = p_locale;}@@ -609,7 +601,6 @@ void TranslationServer::setup() {}fallback = GLOBAL_DEF("internationalization/locale/fallback", "en");- allow_fallback = GLOBAL_DEF("internationalization/locale/allow_fallback", true);main_domain->set_pseudolocalization_enabled(GLOBAL_DEF("internationalization/pseudolocalization/use_pseudolocalization", false));main_domain->set_pseudolocalization_accents_enabled(GLOBAL_DEF("internationalization/pseudolocalization/replace_with_accents", true));main_domain->set_pseudolocalization_double_vowels_enabled(GLOBAL_DEF("internationalization/pseudolocalization/double_vowels", false));diff --git a/core/string/translation_server.h b/core/string/translation_server.hindex 9176c3b9de7..aa64c81bc88 100644--- a/core/string/translation_server.h+++ b/core/string/translation_server.h@@ -37,7 +37,6 @@ class TranslationServer : public Object {GDCLASS(TranslationServer, Object);String locale = "en";- bool allow_fallback = true;String fallback;Ref<TranslationDomain> main_domain;@@ -110,8 +109,6 @@ public:void set_locale(const String &p_locale);String get_locale() const;- void set_fallback_allowed(const bool &p_allow);- bool is_fallback_allowed() const;void set_fallback_locale(const String &p_locale);String get_fallback_locale() const;diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xmlindex c3b999f56a8..a075db481f2 100644--- a/doc/classes/ProjectSettings.xml+++ b/doc/classes/ProjectSettings.xml@@ -1723,12 +1723,8 @@<member name="input_devices/sensors/enable_magnetometer" type="bool" setter="" getter="" default="false">If [code]true[/code], the magnetometer sensor is enabled and [method Input.get_magnetometer] returns valid data.</member>- <member name="internationalization/locale/allow_fallback" type="bool" setter="" getter="" default="true">- If [code]true[/code], the locale will fall back to [member internationalization/locale/fallback] when a translation isn't available in a given language.- [b]Note:[/b] Not to be confused with [TextServerFallback].- </member><member name="internationalization/locale/fallback" type="String" setter="" getter="" default=""en"">- The locale to fall back to if a translation isn't available in a given language if [member internationalization/locale/allow_fallback] is [code]true[/code]. If left empty, [code]en[/code] (English) will be used.+ The locale to fall back to if a translation isn't available in a given language. If left empty, [code]en[/code] (English) will be used.[b]Note:[/b] Not to be confused with [TextServerFallback].</member><member name="internationalization/locale/include_text_server_data" type="bool" setter="" getter="" default="false">diff --git a/editor/editor_node.cpp b/editor/editor_node.cppindex 9b51f91beda..b634cb50c5c 100644--- a/editor/editor_node.cpp+++ b/editor/editor_node.cpp@@ -487,9 +487,8 @@ void EditorNode::_update_from_settings() {Viewport::DefaultCanvasItemTextureRepeat tr = (Viewport::DefaultCanvasItemTextureRepeat)current_repeat;scene_root->set_default_canvas_item_texture_repeat(tr);}- bool allow_fallback = GLOBAL_GET("internationalization/locale/allow_fallback");String current_fallback_locale = GLOBAL_GET("internationalization/locale/fallback");- if (allow_fallback && current_fallback_locale != TranslationServer::get_singleton()->get_fallback_locale()) {+ if (current_fallback_locale != TranslationServer::get_singleton()->get_fallback_locale()) {TranslationServer::get_singleton()->set_fallback_locale(current_fallback_locale);Ref<TranslationDomain> domain = TranslationServer::get_singleton()->get_main_domain();if (!domain->is_enabled()) {