mirror of
https://github.com/penpot/penpot.git
synced 2025-03-13 08:11:30 -05:00
Support 0, 1 or more in plural translations
This commit is contained in:
parent
773f67b09b
commit
3a31abac5a
1 changed files with 8 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue