feat: updated engine

This commit is contained in:
Sara Gerretsen 2026-07-10 17:04:34 +02:00
parent cbe99774ff
commit f4cf6b3999
6607 changed files with 910135 additions and 430025 deletions

View file

@ -30,6 +30,7 @@
#include "translation_domain.h"
#include "core/object/class_db.h"
#include "core/string/translation.h"
#include "core/string/translation_server.h"
#include "core/variant/typed_array.h"
@ -286,7 +287,7 @@ void TranslationDomain::clear() {
}
const HashSet<Ref<Translation>> TranslationDomain::get_translations() const {
return translations;
return HashSet<Ref<Translation>>(translations);
}
HashSet<Ref<Translation>> TranslationDomain::find_translations(const String &p_locale, bool p_exact) const {
@ -356,8 +357,9 @@ StringName TranslationDomain::translate(const StringName &p_message, const Strin
const 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 && fallback.length() >= 2) {
if (!res && allow_fallback && fallback.length() >= 2) {
res = get_message_from_translations(fallback, p_message, p_context);
}
@ -375,8 +377,9 @@ StringName TranslationDomain::translate_plural(const StringName &p_message, cons
const 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 && fallback.length() >= 2) {
if (!res && allow_fallback && fallback.length() >= 2) {
res = get_message_from_translations(fallback, p_message, p_message_plural, p_n, p_context);
}