mirror of
https://github.com/penpot/penpot.git
synced 2026-09-08 21:19:49 +00:00
Support 0, 1 or more in plural translations
This commit is contained in:
parent
773f67b09b
commit
3a31abac5a
@ -34,7 +34,14 @@
|
|||||||
(let [value (get-in +locales+ [+locale+ t] (name t))
|
(let [value (get-in +locales+ [+locale+ t] (name t))
|
||||||
plural (first (filter c? args))
|
plural (first (filter c? args))
|
||||||
args (mapv #(if (c? %) @% %) args)
|
args (mapv #(if (c? %) @% %) args)
|
||||||
value (if vector?
|
value (cond
|
||||||
|
(and (vector? value)
|
||||||
|
(= 3 (count value)))
|
||||||
|
(nth value (min 2 @plural))
|
||||||
|
|
||||||
|
(vector? value)
|
||||||
(if (= @plural 1) (first value) (second value))
|
(if (= @plural 1) (first value) (second value))
|
||||||
|
|
||||||
|
:else
|
||||||
value)]
|
value)]
|
||||||
(apply str/format value args))))
|
(apply str/format value args))))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user