diff options
Diffstat (limited to 'core/ustring.cpp')
-rw-r--r-- | core/ustring.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index 1f0eadc03f..a039ba11cd 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -3635,7 +3635,7 @@ String String::percent_decode() const { CharString cs = utf8(); for(int i=0;i<cs.length();i++) { - + uint8_t c = cs[i]; if (c=='%' && i<length()-2) { @@ -3963,11 +3963,31 @@ String String::sprintf(const Array& values, bool* error) const { #include "translation.h" +#ifdef TOOLS_ENABLED String TTR(const String& p_text) { if (TranslationServer::get_singleton()) { - return TranslationServer::get_singleton()->translate(p_text); + return TranslationServer::get_singleton()->tool_translate(p_text); } return p_text; } + +#endif + +String RTR(const String& p_text) { + + + + if (TranslationServer::get_singleton()) { + String rtr = TranslationServer::get_singleton()->tool_translate(p_text); + if (rtr==String() || rtr==p_text) { + return TranslationServer::get_singleton()->translate(p_text); + } else { + return rtr; + } + } + + return p_text; +} + |