diff options
Diffstat (limited to 'core/string/translation.cpp')
-rw-r--r-- | core/string/translation.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/core/string/translation.cpp b/core/string/translation.cpp index df8a26e5ce..7b8c28e2e2 100644 --- a/core/string/translation.cpp +++ b/core/string/translation.cpp @@ -34,6 +34,11 @@ #include "core/io/resource_loader.h" #include "core/os/os.h" +#ifdef TOOLS_ENABLED +#include "editor/editor_settings.h" +#include "main/main.h" +#endif + // ISO 639-1 language codes, with the addition of glibc locales with their // regional identifiers. This list must match the language names (in English) // of locale_names. @@ -1214,6 +1219,22 @@ void TranslationServer::set_tool_translation(const Ref<Translation> &p_translati tool_translation = p_translation; } +Ref<Translation> TranslationServer::get_tool_translation() const { + return tool_translation; +} + +String TranslationServer::get_tool_locale() { +#ifdef TOOLS_ENABLED + if (TranslationServer::get_singleton()->get_tool_translation().is_valid() && (Engine::get_singleton()->is_editor_hint() || Main::is_project_manager())) { + return tool_translation->get_locale(); + } else { +#else + { +#endif + return get_locale(); + } +} + StringName TranslationServer::tool_translate(const StringName &p_message, const StringName &p_context) const { if (tool_translation.is_valid()) { StringName r = tool_translation->get_message(p_message, p_context); |