From 3a31abac5a46e30c7f4e972d975e9f1da9bcba95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20G=C3=B3mez?= Date: Tue, 9 Feb 2016 20:28:12 +0100 Subject: [PATCH] Support 0, 1 or more in plural translations --- src/uxbox/locales.cljs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/uxbox/locales.cljs b/src/uxbox/locales.cljs index 4c3d05bb0d..f6bcc86075 100644 --- a/src/uxbox/locales.cljs +++ b/src/uxbox/locales.cljs @@ -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))))