0
Fork 0
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:
Alejandro Gómez 2016-02-09 20:28:12 +01:00
parent 773f67b09b
commit 3a31abac5a

View file

@ -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))))