mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 19:28:12 +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))
|
||||
plural (first (filter 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))
|
||||
|
||||
:else
|
||||
value)]
|
||||
(apply str/format value args))))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user