summaryrefslogtreecommitdiffstats
path: root/core/object/object.cpp
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2023-03-17 01:58:30 +0100
committerkobewi <kobewi4e@gmail.com>2023-03-22 23:57:12 +0100
commit8f8178bda6d74e09283df85d4cb34a52843e1892 (patch)
tree074fa921a80ff53da77c6f474c598a372665e0da /core/object/object.cpp
parent0291fcd7b66bcb315a49c44de8031e5596de4216 (diff)
downloadredot-engine-8f8178bda6d74e09283df85d4cb34a52843e1892.tar.gz
Fix auto-translations in editor
Diffstat (limited to 'core/object/object.cpp')
-rw-r--r--core/object/object.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/object/object.cpp b/core/object/object.cpp
index 57aa1339ec..c324eab9bb 100644
--- a/core/object/object.cpp
+++ b/core/object/object.cpp
@@ -1378,7 +1378,12 @@ String Object::tr(const StringName &p_message, const StringName &p_context) cons
if (!_can_translate || !TranslationServer::get_singleton()) {
return p_message;
}
- return TranslationServer::get_singleton()->translate(p_message, p_context);
+
+ if (Engine::get_singleton()->is_editor_hint()) {
+ return TranslationServer::get_singleton()->tool_translate(p_message, p_context);
+ } else {
+ return TranslationServer::get_singleton()->translate(p_message, p_context);
+ }
}
String Object::tr_n(const StringName &p_message, const StringName &p_message_plural, int p_n, const StringName &p_context) const {
@@ -1389,7 +1394,12 @@ String Object::tr_n(const StringName &p_message, const StringName &p_message_plu
}
return p_message_plural;
}
- return TranslationServer::get_singleton()->translate_plural(p_message, p_message_plural, p_n, p_context);
+
+ if (Engine::get_singleton()->is_editor_hint()) {
+ return TranslationServer::get_singleton()->tool_translate_plural(p_message, p_message_plural, p_n, p_context);
+ } else {
+ return TranslationServer::get_singleton()->translate_plural(p_message, p_message_plural, p_n, p_context);
+ }
}
void Object::_clear_internal_resource_paths(const Variant &p_var) {