From 0139a8ab58f13e6fdf4a87254a95de25f95f24b0 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 8 Jan 2016 01:44:27 +0200 Subject: [PATCH] Start using translation strings in some parts of dashboard. --- frontend/uxbox/ui/dashboard/colors.cljs | 18 +++++++++--------- frontend/uxbox/ui/dashboard/header.cljs | 9 +++++---- frontend/uxbox/ui/dashboard/icons.cljs | 18 +++++++----------- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/frontend/uxbox/ui/dashboard/colors.cljs b/frontend/uxbox/ui/dashboard/colors.cljs index 7897a41b8..4a562e4d9 100644 --- a/frontend/uxbox/ui/dashboard/colors.cljs +++ b/frontend/uxbox/ui/dashboard/colors.cljs @@ -3,6 +3,7 @@ [rum.core :as rum] [cuerdas.core :as str] [cats.labs.lens :as l] + [uxbox.locales :as t :refer (tr)] [uxbox.state :as st] [uxbox.rstore :as rs] [uxbox.schema :as sc] @@ -49,13 +50,11 @@ own? (:builtin coll false)] (html [:div.dashboard-title {} - (if coll - [:h2 {} - [:span "Library: "] - [:span {:content-editable "" - :on-key-up on-title-edited} - (:name coll)]] - [:h2 "No library selected"]) + [:h2 {} + [:span #ux/tr "ds.library-title"] + [:span {:content-editable "" + :on-key-up on-title-edited} + (:name coll)]] (if (and (not own?) coll) [:div.edition {} #_[:span i/pencil] @@ -97,13 +96,14 @@ [:a.btn-primary {:on-click #(rs/emit! (dd/mk-color-collection))} "+ New library"]]) - (for [props collections] + (for [props collections + :let [num (count (:colors props))]] [:li {:key (str (:id props)) :on-click #(rs/emit! (dd/set-collection (:id props))) :class-name (when (= (:id props) collid) "current")} [:span.element-title (:name props)] [:span.element-subtitle - (str (count (:colors props)) " elements")]])]]]))) + (tr "ds.num-elements" (t/c num))]])]]]))) (def ^:static nav (util/component diff --git a/frontend/uxbox/ui/dashboard/header.cljs b/frontend/uxbox/ui/dashboard/header.cljs index cea61edb7..297463961 100644 --- a/frontend/uxbox/ui/dashboard/header.cljs +++ b/frontend/uxbox/ui/dashboard/header.cljs @@ -2,6 +2,7 @@ (:require [sablono.core :as html :refer-macros [html]] [rum.core :as rum] [cats.labs.lens :as l] + [uxbox.locales] [uxbox.router :as r] [uxbox.rstore :as rs] [uxbox.state :as s] @@ -34,13 +35,13 @@ (header-link :dashboard/projects i/logo)] [:ul.main-nav [:li {:class (when projects? "current")} - (header-link :dashboard/projects "PROJECTS")] + (header-link :dashboard/projects #ux/tr "ds.projects")] [:li {:class (when elements? "current")} - (header-link :dashboard/elements "ELEMENTS")] + (header-link :dashboard/elements #ux/tr "ds.elements")] [:li {:class (when icons? "current")} - (header-link :dashboard/icons "ICONS")] + (header-link :dashboard/icons #ux/tr "ds.icons")] [:li {:class (when colors? "current")} - (header-link :dashboard/colors "COLORS")]] + (header-link :dashboard/colors #ux/tr "ds.colors")]] (ui.u/user)]))) (def ^:static header diff --git a/frontend/uxbox/ui/dashboard/icons.cljs b/frontend/uxbox/ui/dashboard/icons.cljs index 2fd0c2b09..6d46daf25 100644 --- a/frontend/uxbox/ui/dashboard/icons.cljs +++ b/frontend/uxbox/ui/dashboard/icons.cljs @@ -35,13 +35,11 @@ own? (:builtin coll false)] (html [:div.dashboard-title {} - (if coll - [:h2 {} - [:span "Library: "] - [:span {:content-editable "" - :on-key-up (constantly nil)} - (:name coll)]] - [:h2 "No library selected"]) + [:h2 {} + [:span #ux/tr "ds.library-title"] + [:span {:content-editable "" + :on-key-up (constantly nil)} + (:name coll)]] (if (and (not own?) coll) [:div.edition {} [:span {:on-click (constantly nil)} @@ -53,7 +51,6 @@ :name "page-title" :mixins [mx/static rum/reactive]})) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Nav ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -61,7 +58,6 @@ (defn nav-render [own] (let [dashboard (rum/react dashboard-state) - ;; colors (rum/react collections-state) collid (:collection-id dashboard) own? (= (:collection-type dashboard) :own) builtin? (= (:collection-type dashboard) :builtin) @@ -74,10 +70,10 @@ [:ul.library-tabs [:li {:class-name (when builtin? "current") :on-click #(rs/emit! (dd/set-collection-type :builtin))} - "STANDARD"] + #ux/tr "ds.standard-title"] [:li {:class-name (when own? "current") :on-click #(rs/emit! (dd/set-collection-type :own))} - "YOUR LIBRARIES"]] + #ux/tr "ds.your-libraries-title"]] [:ul.library-elements (when own? [:li