Skip to content
Snippets Groups Projects
Commit 7dcbc57c authored by Rahul Gaur's avatar Rahul Gaur Committed by Walter Leibbrandt
Browse files

Fix #10544 trs uses user locale (#10773)

* Fix for  uses user locale #10544

* Removed comments in favor of private declaration

The comments didn't add much useful information.
parent 3656bef0
No related branches found
No related tags found
No related merge requests found
......@@ -23,19 +23,25 @@
to (such as a typo in the translated version of the string), log the failure but return the original (untranslated)
string. This is a workaround for translations that, due to a typo, will fail to parse using Java's message
formatter."
[ns-str msg args]
[locale ns-str msg args]
(try
(apply i18n/translate ns-str (i18n/user-locale) msg args)
(apply i18n/translate ns-str (locale) msg args)
(catch IllegalArgumentException e
;; Not translating this string to prevent an unfortunate stack overflow. If this string happened to be the one
;; that had the typo, we'd just recur endlessly without logging an error.
(log/errorf e "Unable to translate string '%s'" msg)
msg)))
(def ^:private translate-system-locale
(partial translate i18n/system-locale))
(def ^:private translate-user-locale
(partial translate i18n/user-locale))
(p.types/defrecord+ UserLocalizedString [ns-str msg args]
Object
(toString [_]
(translate ns-str msg args))
(translate-user-locale ns-str msg args))
schema.core.Schema
(explain [this]
(str this)))
......@@ -43,7 +49,7 @@
(p.types/defrecord+ SystemLocalizedString [ns-str msg args]
Object
(toString [_]
(translate ns-str msg args))
(translate-system-locale ns-str msg args))
s/Schema
(explain [this]
(str this)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment