Skip to content

Commit 210810b

Browse files
committed
Fix atr_n() behavior when auto translation is disabled
1 parent 1fc8208 commit 210810b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

scene/main/node.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,13 @@ class Node : public Object {
743743
virtual void set_translation_domain(const StringName &p_domain) override;
744744
void set_translation_domain_inherited();
745745

746-
_FORCE_INLINE_ String atr(const String p_message, const StringName p_context = "") const { return can_auto_translate() ? tr(p_message, p_context) : p_message; }
747-
_FORCE_INLINE_ String atr_n(const String p_message, const StringName &p_message_plural, int p_n, const StringName p_context = "") const { return can_auto_translate() ? tr_n(p_message, p_message_plural, p_n, p_context) : p_message; }
746+
_FORCE_INLINE_ String atr(const String &p_message, const StringName &p_context = "") const { return can_auto_translate() ? tr(p_message, p_context) : p_message; }
747+
_FORCE_INLINE_ String atr_n(const String &p_message, const StringName &p_message_plural, int p_n, const StringName &p_context = "") const {
748+
if (can_auto_translate()) {
749+
return tr_n(p_message, p_message_plural, p_n, p_context);
750+
}
751+
return p_n == 1 ? p_message : String(p_message_plural);
752+
}
748753

749754
/* THREADING */
750755

0 commit comments

Comments
 (0)