From 99666de00fb30cb86473257776504ca70b4469c3 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Thu, 3 Sep 2020 14:22:16 +0300 Subject: [Complex Text Layouts] Refactor Font class, default themes and controls to use Text Server interface. Implement interface mirroring. Add TextLine and TextParagraph classes. Handle UTF-16 input on macOS and Windows. --- core/string/translation.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'core/string/translation.cpp') 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 &p_translati tool_translation = p_translation; } +Ref 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); -- cgit v1.2.3