🌐 Translate several dashboards

This commit is contained in:
mathieu.brunot 2019-02-21 04:36:22 +01:00
parent edbab7f8d5
commit e06bc2cc95
No known key found for this signature in database
GPG key ID: 81584BEAF692D7E0
14 changed files with 193 additions and 102 deletions

View file

@ -92,7 +92,7 @@
(defrecord CreateCollection [id] (defrecord CreateCollection [id]
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
(let [item {:name "Unnamed collection" (let [item {:name (str "Unnamed Collection (" (gensym "c") ")")
:id id :id id
:created-at (dt/now) :created-at (dt/now)
:type :own :type :own

View file

@ -146,7 +146,7 @@
(defrecord CreateCollection [] (defrecord CreateCollection []
ptk/WatchEvent ptk/WatchEvent
(watch [_ state s] (watch [_ state s]
(let [coll {:name "Unnamed collection" (let [coll {:name (str "Unnamed Collection (" (gensym "c") ")")
:id (uuid/random)}] :id (uuid/random)}]
(->> (rp/req :create/image-collection coll) (->> (rp/req :create/image-collection coll)
(rx/map :payload) (rx/map :payload)

View file

@ -12,30 +12,63 @@
"ds.num-projects" ["No projects" "ds.num-projects" ["No projects"
"%s project" "%s project"
"%s projects"] "%s projects"]
"ds.num-colors" ["No colors" "ds.project-title" "Your projects"
"%s color" "ds.project-new" "+ New project"
"%s colors"]
"ds.num-images" ["No images" "ds.ordering" "Sort by"
"%s image" "ds.ordering.by-name" "name"
"%s images"] "ds.ordering.by-last-update" "last update"
"ds.ordering.by-creation-date" "creation date"
"ds.search.placeholder" "Search..."
"ds.uploaded-at" "Uploaded at %s"
"ds.confirm-title" "Are you sure?"
"ds.confirm-ok" "Ok"
"ds.confirm-cancel" "Cancel"
"ds.multiselect-bar.copy" "Copy"
"ds.multiselect-bar.copy-to-library" "Copy to library"
"ds.multiselect-bar.move" "Move"
"ds.multiselect-bar.move-to-library" "Move to library"
"ds.multiselect-bar.rename" "Rename"
"ds.multiselect-bar.delete" "Delete"
"ds.elements" "ELEMENTS"
"ds.num-elements" ["%s element"
"%s elements"]
"ds.icons" "ICONS"
"ds.num-icons" ["No icons" "ds.num-icons" ["No icons"
"%s icon" "%s icon"
"%s icons"] "%s icons"]
"ds.project-ordering" "Sort by" "ds.your-icons-title" "YOUR ICONS"
"ds.project-ordering.by-name" "name" "ds.store-icons-title" "ICONS STORE"
"ds.project-ordering.by-last-update" "last update" "ds.icons-collection.new" "+ New collection"
"ds.project-ordering.by-creation-date" "creation date" "ds.icon.new" "+ New icon"
"ds.project-search.placeholder" "Search..."
"ds.elements" "ELEMENTS"
"ds.icons" "ICONS"
"ds.images" "IMAGES" "ds.images" "IMAGES"
"ds.num-images" ["No images"
"%s image"
"%s images"]
"ds.your-images-title" "YOUR IMAGES"
"ds.store-images-title" "IMAGES STORE"
"ds.images-collection.new" "+ New library"
"ds.image-new" "+ New image"
"ds.colors" "COLORS" "ds.colors" "COLORS"
"ds.num-colors" ["No colors"
"%s color"
"%s colors"]
"ds.your-colors-title" "YOUR COLORS"
"ds.store-colors-title" "COLORS STORE"
"ds.colors-collection.new" "+ New library"
"ds.color-new" "+ New color"
"ds.color-lightbox.title" "New color"
"ds.color-lightbox.add" "+ Add color"
"ds.library-title" "Library: " "ds.library-title" "Library: "
"ds.standard-title" "STANDARD" "ds.standard-title" "STANDARD"
"ds.your-libraries-title" "YOUR LIBRARIES" "ds.your-libraries-title" "YOUR LIBRARIES"
"ds.num-elements" ["%s element"
"%s elements"]
"ds.recent-colors" "Recent colors" "ds.recent-colors" "Recent colors"
"ds.element-options" "Element options" "ds.element-options" "Element options"
@ -51,6 +84,11 @@
"ds.help.curve" "Curve" "ds.help.curve" "Curve"
"ds.help.ruler" "Ruler" "ds.help.ruler" "Ruler"
"ds.user.profile" "Profile"
"ds.user.password" "Password"
"ds.user.notifications" "Notifications"
"ds.user.exit" "Exit"
"auth.message.recovery-token-sent" "Password recovery link sent to your inbox." "auth.message.recovery-token-sent" "Password recovery link sent to your inbox."
"auth.message.password-recovered" "Password successfully recovered." "auth.message.password-recovered" "Password successfully recovered."
@ -59,6 +97,12 @@
"settings.notifications" "NOTIFICATIONS" "settings.notifications" "NOTIFICATIONS"
"settings.profile-saved" "Profile saved successfully!" "settings.profile-saved" "Profile saved successfully!"
"settings.password-saved" "Password saved successfully!" "settings.password-saved" "Password saved successfully!"
"settings.wrong-old-password" "Wrong old password"
"settings.change-password" "Change password"
"settings.old-password" "Old password"
"settings.new-password" "New password"
"settings.confirm-password" "Confirm password"
"settings.update-settings" "Update settings"
"history.alert-message" "You are seeing version %s" "history.alert-message" "You are seeing version %s"
"errors.api.form.old-password-not-match" "Incorrect old password" "errors.api.form.old-password-not-match" "Incorrect old password"

View file

@ -12,30 +12,63 @@
"ds.num-projects" ["Nb projets" "ds.num-projects" ["Nb projets"
"%s projet" "%s projet"
"%s projets"] "%s projets"]
"ds.num-colors" ["Nb couleurs" "ds.project-title" "Vos projets"
"%s couleur" "ds.project-new" "+ Nouveau projet"
"%s couleurs"]
"ds.num-images" ["Nb images" "ds.ordering" "Trier par"
"%s image" "ds.ordering.by-name" "nom"
"%s images"] "ds.ordering.by-last-update" "dernière mise à jour"
"ds.ordering.by-creation-date" "date de création"
"ds.search.placeholder" "Rechercher..."
"ds.uploaded-at" "Mise en ligne : %s"
"ds.confirm-title" "Êtes-vous sûr ?"
"ds.confirm-ok" "Ok"
"ds.confirm-cancel" "Annuler"
"ds.multiselect-bar.copy" "Copier"
"ds.multiselect-bar.copy-to-library" "Copier vers la librairie"
"ds.multiselect-bar.move" "Déplacer"
"ds.multiselect-bar.move-to-library" "Déplacer vers la librairie"
"ds.multiselect-bar.rename" "Renommer"
"ds.multiselect-bar.delete" "Supprimer"
"ds.elements" "ÉLÉMENTS"
"ds.num-elements" ["%s élément"
"%s éléments"]
"ds.icons" "ICÔNES"
"ds.num-icons" ["Nb icônes" "ds.num-icons" ["Nb icônes"
"%s icône" "%s icône"
"%s icônes"] "%s icônes"]
"ds.project-ordering" "Trier par" "ds.your-icons-title" "VOS ICÔNES"
"ds.project-ordering.by-name" "nom" "ds.store-icons-title" "BOUTIQUE"
"ds.project-ordering.by-last-update" "dernière mise à jour" "ds.icons-collection.new" "+ Nouvelle collection"
"ds.project-ordering.by-creation-date" "date de création" "ds.icon.new" "+ Nouvel icône"
"ds.project-search.placeholder" "Rechercher..."
"ds.elements" "ÉLÉMENTS"
"ds.icons" "ICÔNES"
"ds.images" "IMAGES" "ds.images" "IMAGES"
"ds.num-images" ["Nb images"
"%s image"
"%s images"]
"ds.your-images-title" "VOS IMAGES"
"ds.store-images-title" "BOUTIQUE"
"ds.images-collection.new" "+ Nouvelle librairie"
"ds.image-new" "+ New image"
"ds.colors" "COULEURS" "ds.colors" "COULEURS"
"ds.num-colors" ["Nb couleurs"
"%s couleur"
"%s couleurs"]
"ds.your-colors-title" "YOUR COLORS"
"ds.store-colors-title" "BOUTIQUE"
"ds.colors-collection.new" "+ Nouvelle librairie"
"ds.color-new" "+ Nouvelle color"
"ds.color-lightbox.title" "Nouvelle couleur"
"ds.color-lightbox.add" "+ Ajouter couleur"
"ds.library-title" "Librairie : " "ds.library-title" "Librairie : "
"ds.standard-title" "STANDARD" "ds.standard-title" "STANDARD"
"ds.your-libraries-title" "VOS LIBRAIRIES" "ds.your-libraries-title" "VOS LIBRAIRIES"
"ds.num-elements" ["%s élément"
"%s éléments"]
"ds.recent-colors" "Couleurs récentes" "ds.recent-colors" "Couleurs récentes"
"ds.element-options" "Options d'élément" "ds.element-options" "Options d'élément"
@ -51,6 +84,11 @@
"ds.help.curve" "Courbe" "ds.help.curve" "Courbe"
"ds.help.ruler" "Règle" "ds.help.ruler" "Règle"
"ds.user.profile" "Profil"
"ds.user.password" "Mot de passe"
"ds.user.notifications" "Notifications"
"ds.user.exit" "Quitter"
"auth.message.recovery-token-sent" "Password recovery link sent to your inbox." "auth.message.recovery-token-sent" "Password recovery link sent to your inbox."
"auth.message.password-recovered" "Password successfully recovered." "auth.message.password-recovered" "Password successfully recovered."
@ -59,6 +97,12 @@
"settings.notifications" "NOTIFICATIONS" "settings.notifications" "NOTIFICATIONS"
"settings.profile-saved" "Profil enregistré avec succès !" "settings.profile-saved" "Profil enregistré avec succès !"
"settings.password-saved" "Mot de passe enregistré avec succès !" "settings.password-saved" "Mot de passe enregistré avec succès !"
"settings.wrong-old-password" "Ancien mot de passe incorrect"
"settings.change-password" "Changement de mot de passe"
"settings.old-password" "Ancien mot de passe"
"settings.new-password" "Nouveau mot de passe"
"settings.confirm-password" "Confirmez mot de passe"
"settings.update-settings" "Mettre à jour les paramètres"
"history.alert-message" "Vous voyez la version %s" "history.alert-message" "Vous voyez la version %s"
"errors.api.form.old-password-not-match" "Ancien mot de passe incorrect" "errors.api.form.old-password-not-match" "Ancien mot de passe incorrect"
@ -81,6 +125,4 @@
"errors.network" "Impossible de se connecter au serveur principal." "errors.network" "Impossible de se connecter au serveur principal."
"errors.generic" "Quelque chose c'est mal passé." "errors.generic" "Quelque chose c'est mal passé."
"errors.conflict" "Conflit sur la sauvegarde des données, actualisez et réessayez." "errors.conflict" "Conflit sur la sauvegarde des données, actualisez et réessayez."})
})

View file

@ -9,6 +9,7 @@
(:require [uxbox.main.data.lightbox :as udl] (:require [uxbox.main.data.lightbox :as udl]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[rumext.core :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.i18n :refer (tr)]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.main.ui.lightbox :as lbx])) [uxbox.main.ui.lightbox :as lbx]))
@ -24,17 +25,17 @@
(when on-cancel (when on-cancel
(on-cancel (dissoc ctx :on-accept :on-cancel))))] (on-cancel (dissoc ctx :on-accept :on-cancel))))]
[:div.lightbox-body.confirm-dialog [:div.lightbox-body.confirm-dialog
[:h3 "Are you sure?"] [:h3 (tr "ds.confirm-title")]
(if hint (if hint
[:span hint]) [:span hint])
[:div.row-flex [:div.row-flex
[:input.btn-success.btn-small [:input.btn-success.btn-small
{:type "button" {:type "button"
:value "Ok" :value (tr "ds.confirm-ok")
:on-click accept}] :on-click accept}]
[:input.btn-delete.btn-small [:input.btn-delete.btn-small
{:type "button" {:type "button"
:value "Cancel" :value (tr "ds.confirm-cancel")
:on-click cancel}]] :on-click cancel}]]
[:a.close {:href "#" [:a.close {:href "#"
:on-click #(do (dom/prevent-default %) :on-click #(do (dom/prevent-default %)

View file

@ -137,7 +137,7 @@
[:ul.library-elements {} [:ul.library-elements {}
(when own? (when own?
[:li {} [:li {}
[:a.btn-primary {:on-click #(st/emit! (dc/create-collection))} "+ New library"]]) [:a.btn-primary {:on-click #(st/emit! (dc/create-collection))} (tr "ds.colors-collection.new")]])
(mx/doseq [{:keys [id] :as coll} colls] (mx/doseq [{:keys [id] :as coll} colls]
(let [selected? (= (:id coll) selected)] (let [selected? (= (:id coll) selected)]
(-> (nav-item coll selected?) (-> (nav-item coll selected?)
@ -161,10 +161,10 @@
[:ul.library-tabs {} [:ul.library-tabs {}
[:li {:class-name (when (= type :own) "current") [:li {:class-name (when (= type :own) "current")
:on-click (partial select-tab :own)} :on-click (partial select-tab :own)}
"YOUR COLORS"] (tr "ds.your-colors-title")]
[:li {:class-name (when (= type :builtin) "current") [:li {:class-name (when (= type :builtin) "current")
:on-click (partial select-tab :builtin)} :on-click (partial select-tab :builtin)}
"COLORS STORE"]] (tr "ds.store-colors-title")]]
(nav-section type id colls)]])) (nav-section type id colls)]]))
;; --- Grid ;; --- Grid
@ -172,7 +172,7 @@
(mx/defc grid-form (mx/defc grid-form
[coll-id] [coll-id]
[:div.grid-item.small-item.add-project {:on-click #(udl/open! :color-form {:coll coll-id})} [:div.grid-item.small-item.add-project {:on-click #(udl/open! :color-form {:coll coll-id})}
[:span {} "+ New color"]]) [:span {} (tr "ds.color-new")]])
(mx/defc grid-options-tooltip (mx/defc grid-options-tooltip
{:mixins [mx/reactive mx/static]} {:mixins [mx/reactive mx/static]}
@ -225,22 +225,22 @@
;; if editable ;; if editable
[:div.multiselect-nav {} [:div.multiselect-nav {}
[:span.move-item.tooltip.tooltip-top [:span.move-item.tooltip.tooltip-top
{:on-click on-toggle-copy :alt "Copy"} {:on-click on-toggle-copy :alt (tr "ds.multiselect-bar.copy")}
(when (:show-copy-tooltip @local) (when (:show-copy-tooltip @local)
(grid-options-tooltip :selected id (grid-options-tooltip :selected id
:title "Copy to library" :title (tr "ds.multiselect-bar.copy-to-library")
:on-select on-copy)) :on-select on-copy))
i/copy] i/copy]
[:span.move-item.tooltip.tooltip-top [:span.move-item.tooltip.tooltip-top
{:on-click on-toggle-move :alt "Move"} {:on-click on-toggle-move :alt (tr "ds.multiselect-bar.move")}
(when (:show-move-tooltip @local) (when (:show-move-tooltip @local)
(grid-options-tooltip :selected id (grid-options-tooltip :selected id
:title "Move to library" :title (tr "ds.multiselect-bar.move-to-library")
:on-select on-move)) :on-select on-move))
i/move] i/move]
[:span.delete.tooltip.tooltip-top [:span.delete.tooltip.tooltip-top
{:alt "Delete" {:alt (tr "ds.multiselect-bar.delete")
:on-click on-delete} :on-click on-delete}
i/trash]] i/trash]]
@ -250,7 +250,7 @@
{:on-click on-toggle-copy} {:on-click on-toggle-copy}
(when (:show-copy-tooltip @local) (when (:show-copy-tooltip @local)
(grid-options-tooltip :selected id (grid-options-tooltip :selected id
:title "Copy to library" :title (tr "ds.multiselect-bar.copy-to-library")
:on-select on-copy)) :on-select on-copy))
i/organize]])])) i/organize]])]))
@ -342,14 +342,14 @@
(on-close [event] (on-close [event]
(udl/close!))] (udl/close!))]
[:div.lightbox-body {} [:div.lightbox-body {}
[:h3 {} "New color"] [:h3 {} (tr "ds.color-lightbox.title")]
[:form {} [:form {}
[:div.row-flex.center {} [:div.row-flex.center {}
(colorpicker (colorpicker
:value (or (:hex @local) color "#00ccff") :value (or (:hex @local) color "#00ccff")
:on-change #(swap! local assoc :hex %))] :on-change #(swap! local assoc :hex %))]
[:input#project-btn.btn-primary {:value "+ Add color" [:input#project-btn.btn-primary {:value (tr "ds.color-lightbox.add")
:on-click on-submit :on-click on-submit
:type "button"}]] :type "button"}]]
[:a.close {:on-click on-close} i/close]])) [:a.close {:on-click on-close} i/close]]))

View file

@ -29,8 +29,8 @@
;; --- Helpers & Constants ;; --- Helpers & Constants
(def +ordering-options+ (def +ordering-options+
{:name "ds.project-ordering.by-name" {:name "ds.ordering.by-name"
:created "ds.project-ordering.by-creation-date"}) :created "ds.ordering.by-creation-date"})
(defn- sort-icons-by (defn- sort-icons-by
[ordering icons] [ordering icons]
@ -181,7 +181,7 @@
[:li {} [:li {}
[:a.btn-primary [:a.btn-primary
{:on-click #(st/emit! (di/create-collection))} {:on-click #(st/emit! (di/create-collection))}
"+ New collection"]]) (tr "ds.icons-collection.new")]])
(when own? (when own?
(nav-item nil (nil? selected))) (nav-item nil (nil? selected)))
(mx/doseq [coll colls] (mx/doseq [coll colls]
@ -206,10 +206,10 @@
[:ul.library-tabs {} [:ul.library-tabs {}
[:li {:class-name (when own? "current") [:li {:class-name (when own? "current")
:on-click (partial select-tab :own)} :on-click (partial select-tab :own)}
"YOUR ICONS"] (tr "ds.your-icons-title")]
[:li {:class-name (when builtin? "current") [:li {:class-name (when builtin? "current")
:on-click (partial select-tab :builtin)} :on-click (partial select-tab :builtin)}
"ICONS STORE"]] (tr "ds.store-icons-title")]]
(nav-section type id colls)]]))) (nav-section type id colls)]])))
@ -224,7 +224,7 @@
(let [files (dom/get-event-files event)] (let [files (dom/get-event-files event)]
(st/emit! (di/create-icons coll-id files))))] (st/emit! (di/create-icons coll-id files))))]
[:div.grid-item.small-item.add-project {:on-click forward-click} [:div.grid-item.small-item.add-project {:on-click forward-click}
[:span {} "+ New icon"] [:span {} (tr "ds.icon.new")]
[:input.upload-image-input [:input.upload-image-input
{:style {:display "none"} {:style {:display "none"}
:multiple true :multiple true
@ -288,26 +288,26 @@
(if editable? (if editable?
[:div.multiselect-nav {} [:div.multiselect-nav {}
[:span.move-item.tooltip.tooltip-top [:span.move-item.tooltip.tooltip-top
{:on-click on-toggle-copy :alt "Copy"} {:on-click on-toggle-copy :alt (tr "ds.multiselect-bar.copy")}
(when (:show-copy-tooltip @local) (when (:show-copy-tooltip @local)
(grid-options-tooltip :selected id (grid-options-tooltip :selected id
:title "Copy to library" :title (tr "ds.multiselect-bar.copy-to-library")
:on-select on-copy)) :on-select on-copy))
i/copy] i/copy]
[:span.move-item.tooltip.tooltip-top [:span.move-item.tooltip.tooltip-top
{:on-click on-toggle-move :alt "Move"} {:on-click on-toggle-move :alt (tr "ds.multiselect-bar.move")}
(when (:show-move-tooltip @local) (when (:show-move-tooltip @local)
(grid-options-tooltip :selected id (grid-options-tooltip :selected id
:title "Move to library" :title (tr "ds.multiselect-bar.move-to-library")
:on-select on-move)) :on-select on-move))
i/move] i/move]
(when (= 1 (count selected)) (when (= 1 (count selected))
[:span.move-item.tooltip.tooltip-top [:span.move-item.tooltip.tooltip-top
{:alt "Rename" {:alt (tr "ds.multiselect-bar.rename")
:on-click on-rename} :on-click on-rename}
i/pencil]) i/pencil])
[:span.delete.tooltip.tooltip-top [:span.delete.tooltip.tooltip-top
{:alt "Delete" {:alt (tr "ds.multiselect-bar.delete")
:on-click on-delete} :on-click on-delete}
i/trash]] i/trash]]
[:div.multiselect-nav [:div.multiselect-nav
@ -315,7 +315,7 @@
{:on-click on-toggle-copy} {:on-click on-toggle-copy}
(when (:show-copy-tooltip @local) (when (:show-copy-tooltip @local)
(grid-options-tooltip :selected id (grid-options-tooltip :selected id
:title "Copy to library" :title (tr "ds.multiselect-bar.copy-to-library")
:on-select on-copy)) :on-select on-copy))
i/organize]])]))) i/organize]])])))
@ -364,7 +364,7 @@
:default-value (:name icon)}] :default-value (:name icon)}]
[:h3 {:on-double-click on-edit} [:h3 {:on-double-click on-edit}
(:name icon)]) (:name icon)])
(str "Uploaded at " (dt/format created-at "L"))]])) (str (tr "ds.uploaded-at" (dt/format created-at "L")))]]))
(mx/defc grid (mx/defc grid
{:mixins [mx/static mx/reactive]} {:mixins [mx/static mx/reactive]}
@ -421,7 +421,7 @@
;; Sorting ;; Sorting
[:div {} [:div {}
[:span {} (tr "ds.project-ordering")] [:span {} (tr "ds.ordering")]
[:select.input-select [:select.input-select
{:on-change on-ordering-change {:on-change on-ordering-change
:value (pr-str ordering)} :value (pr-str ordering)}
@ -435,7 +435,7 @@
:type "text" :type "text"
:on-change on-term-change :on-change on-term-change
:auto-focus true :auto-focus true
:placeholder (tr "ds.project-search.placeholder") :placeholder (tr "ds.search.placeholder")
:value (or filtering "")}] :value (or filtering "")}]
[:div.clear-search {:on-click on-clear} i/close]]]]))) [:div.clear-search {:on-click on-clear} i/close]]]])))

View file

@ -24,8 +24,8 @@
;; --- Helpers & Constants ;; --- Helpers & Constants
(def +ordering-options+ (def +ordering-options+
{:name "ds.project-ordering.by-name" {:name "ds.ordering.by-name"
:created "ds.project-ordering.by-creation-date"}) :created "ds.ordering.by-creation-date"})
(defn- sort-images-by (defn- sort-images-by
[ordering images] [ordering images]
@ -176,7 +176,7 @@
[:li {} [:li {}
[:a.btn-primary [:a.btn-primary
{:on-click #(st/emit! (di/create-collection))} {:on-click #(st/emit! (di/create-collection))}
"+ New library"]]) (tr "ds.images-collection.new")]])
(when own? (when own?
(nav-item nil (nil? selected))) (nav-item nil (nil? selected)))
(mx/doseq [coll collections] (mx/doseq [coll collections]
@ -205,10 +205,10 @@
[:ul.library-tabs {} [:ul.library-tabs {}
[:li {:class-name (when own? "current") [:li {:class-name (when own? "current")
:on-click (partial select-tab :own)} :on-click (partial select-tab :own)}
"YOUR IMAGES"] (tr "ds.your-images-title")]
[:li {:class-name (when builtin? "current") [:li {:class-name (when builtin? "current")
:on-click (partial select-tab :builtin)} :on-click (partial select-tab :builtin)}
"IMAGES STORE"]] (tr "ds.store-images-title")]]
(nav-section type id colls)]]))) (nav-section type id colls)]])))
@ -227,7 +227,7 @@
[:div.grid-item.add-project {:on-click forward-click} [:div.grid-item.add-project {:on-click forward-click}
(if uploading? (if uploading?
[:div {} ^:inline i/loader-pencil] [:div {} ^:inline i/loader-pencil]
[:span {} "+ New image"]) [:span {} (tr "ds.image-new")])
[:input.upload-image-input [:input.upload-image-input
{:style {:display "none"} {:style {:display "none"}
:multiple true :multiple true
@ -290,26 +290,26 @@
;; If editable ;; If editable
[:div.multiselect-nav {} [:div.multiselect-nav {}
[:span.move-item.tooltip.tooltip-top [:span.move-item.tooltip.tooltip-top
{:on-click on-toggle-copy :alt "Copy"} {:on-click on-toggle-copy :alt (tr "ds.multiselect-bar.copy")}
(when (:show-copy-tooltip @local) (when (:show-copy-tooltip @local)
(grid-options-tooltip :selected id (grid-options-tooltip :selected id
:title "Copy to library" :title (tr "ds.multiselect-bar.copy-to-library")
:on-select on-copy)) :on-select on-copy))
^:inline i/copy] ^:inline i/copy]
[:span.move-item.tooltip.tooltip-top [:span.move-item.tooltip.tooltip-top
{:on-click on-toggle-move :alt "Move"} {:on-click on-toggle-move :alt (tr "ds.multiselect-bar.move")}
(when (:show-move-tooltip @local) (when (:show-move-tooltip @local)
(grid-options-tooltip :selected id (grid-options-tooltip :selected id
:title "Move to library" :title (tr "ds.multiselect-bar.move-to-library")
:on-select on-move)) :on-select on-move))
^:inline i/move] ^:inline i/move]
(when (= 1 (count selected)) (when (= 1 (count selected))
[:span.move-item.tooltip.tooltip-top [:span.move-item.tooltip.tooltip-top
{:alt "Rename" {:alt (tr "ds.multiselect-bar.rename")
:on-click on-rename} :on-click on-rename}
^:inline i/pencil]) ^:inline i/pencil])
[:span.delete.tooltip.tooltip-top [:span.delete.tooltip.tooltip-top
{:alt "Delete" {:alt (tr "ds.multiselect-bar.delete")
:on-click on-delete} :on-click on-delete}
^:inline i/trash]] ^:inline i/trash]]
@ -319,7 +319,7 @@
{:on-click on-toggle-copy} {:on-click on-toggle-copy}
(when (:show-copy-tooltip @local) (when (:show-copy-tooltip @local)
(grid-options-tooltip :selected id (grid-options-tooltip :selected id
:title "Copy to library" :title (tr "ds.multiselect-bar.copy-to-library")
:on-select on-copy)) :on-select on-copy))
^:inline i/organize]])])) ^:inline i/organize]])]))
@ -358,7 +358,7 @@
:on-click on-edit :on-click on-edit
:default-value (:name image)}] :default-value (:name image)}]
[:h3 {:on-double-click on-edit} (:name image)]) [:h3 {:on-double-click on-edit} (:name image)])
[:span.date {} (str "Uploaded at " (dt/format created-at "L"))]]])) [:span.date {} (str (tr "ds.uploaded-at" (dt/format created-at "L")))]]]))
(mx/defc grid (mx/defc grid
{:mixins [mx/static mx/reactive]} {:mixins [mx/static mx/reactive]}
@ -417,7 +417,7 @@
;; Sorting ;; Sorting
[:div {} [:div {}
[:span {} (tr "ds.project-ordering")] [:span {} (tr "ds.ordering")]
[:select.input-select {:on-change on-ordering-change [:select.input-select {:on-change on-ordering-change
:value (pr-str ordering)} :value (pr-str ordering)}
(mx/doseq [[key value] (seq +ordering-options+)] (mx/doseq [[key value] (seq +ordering-options+)]
@ -430,7 +430,7 @@
:type "text" :type "text"
:on-change on-term-change :on-change on-term-change
:auto-focus true :auto-focus true
:placeholder (tr "ds.project-search.placeholder") :placeholder (tr "ds.search.placeholder")
:value (or filtering "")}] :value (or filtering "")}]
[:div.clear-search {:on-click on-clear} i/close]]]]))) [:div.clear-search {:on-click on-clear} i/close]]]])))

View file

@ -30,8 +30,8 @@
;; --- Helpers & Constants ;; --- Helpers & Constants
(def +ordering-options+ (def +ordering-options+
{:name "ds.project-ordering.by-name" {:name "ds.ordering.by-name"
:created "ds.project-ordering.by-creation-date"}) :created "ds.ordering.by-creation-date"})
;; --- Refs ;; --- Refs
@ -97,7 +97,7 @@
;; Sorting ;; Sorting
[:div {} [:div {}
[:span {} (tr "ds.project-ordering")] [:span {} (tr "ds.ordering")]
[:select.input-select [:select.input-select
{:on-change on-ordering-change {:on-change on-ordering-change
:value (pr-str ordering)} :value (pr-str ordering)}
@ -111,7 +111,7 @@
:type "text" :type "text"
:on-change on-term-change :on-change on-term-change
:auto-focus true :auto-focus true
:placeholder (tr "ds.project-search.placeholder") :placeholder (tr "ds.search.placeholder")
:value (or filtering "")}] :value (or filtering "")}]
[:div.clear-search {:on-click on-clear} i/close]]]]))) [:div.clear-search {:on-click on-clear} i/close]]]])))
@ -216,12 +216,12 @@
(dom/prevent-default e) (dom/prevent-default e)
(udl/open! :create-project))] (udl/open! :create-project))]
[:section.dashboard-grid {} [:section.dashboard-grid {}
[:h2 {} "Your projects"] [:h2 {} (tr "ds.project-title")]
[:div.dashboard-grid-content {} [:div.dashboard-grid-content {}
[:div.dashboard-grid-row {} [:div.dashboard-grid-row {}
[:div.grid-item.add-project [:div.grid-item.add-project
{:on-click on-click} {:on-click on-click}
[:span {} "+ New project"]] [:span {} (tr "ds.project-new")]]
(mx/doseq [item projects] (mx/doseq [item projects]
(-> (grid-item item) (-> (grid-item item)
(mx/with-key (:id item))))]]]))) (mx/with-key (:id item))))]]])))

View file

@ -13,6 +13,7 @@
[potok.core :as ptk] [potok.core :as ptk]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[rumext.core :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.i18n :refer [tr]]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.main.ui.settings.header :refer (header)])) [uxbox.main.ui.settings.header :refer (header)]))

View file

@ -53,7 +53,7 @@
(on-error [{:keys [code] :as payload}] (on-error [{:keys [code] :as payload}]
(case code (case code
:uxbox.services.users/old-password-not-match :uxbox.services.users/old-password-not-match
(st/emit! (assoc-error :password-old "Wrong old password")) (st/emit! (assoc-error :password-old (tr "settings.wrong-old-password")))
:else :else
(throw (ex-info "unexpected" {:error payload})))) (throw (ex-info "unexpected" {:error payload}))))
@ -62,34 +62,34 @@
:on-success on-success :on-success on-success
:on-error on-error)))] :on-error on-error)))]
[:form.password-form [:form.password-form
[:span.user-settings-label "Change password"] [:span.user-settings-label (tr "settings.change-password")]
[:input.input-text [:input.input-text
{:type "password" {:type "password"
:class (fm/error-class errors :password-old) :class (fm/error-class errors :password-old)
:value (:password-old data "") :value (:password-old data "")
:on-change (partial on-change :password-old) :on-change (partial on-change :password-old)
:placeholder "Old password"}] :placeholder (tr "settings.old-password")}]
(fm/input-error errors :password-old) (fm/input-error errors :password-old)
[:input.input-text [:input.input-text
{:type "password" {:type "password"
:class (fm/error-class errors :password-1) :class (fm/error-class errors :password-1)
:value (:password-1 data "") :value (:password-1 data "")
:on-change (partial on-change :password-1) :on-change (partial on-change :password-1)
:placeholder "New password"}] :placeholder (tr "settings.new-password")}]
(fm/input-error errors :password-1) (fm/input-error errors :password-1)
[:input.input-text [:input.input-text
{:type "password" {:type "password"
:class (fm/error-class errors :password-2) :class (fm/error-class errors :password-2)
:value (:password-2 data "") :value (:password-2 data "")
:on-change (partial on-change :password-2) :on-change (partial on-change :password-2)
:placeholder "Confirm password"}] :placeholder (tr "settings.confirm-password")}]
(fm/input-error errors :password-2) (fm/input-error errors :password-2)
[:input.btn-primary [:input.btn-primary
{:type "button" {:type "button"
:class (when-not valid? "btn-disabled") :class (when-not valid? "btn-disabled")
:disabled (not valid?) :disabled (not valid?)
:on-click on-submit :on-click on-submit
:value "Update settings"}]]))) :value (tr "settings.update-settings")}]])))
;; --- Password Page ;; --- Password Page

View file

@ -15,6 +15,7 @@
[uxbox.main.ui.settings.header :refer [header]] [uxbox.main.ui.settings.header :refer [header]]
[uxbox.main.ui.messages :refer [messages-widget]] [uxbox.main.ui.messages :refer [messages-widget]]
[uxbox.main.data.users :as udu] [uxbox.main.data.users :as udu]
[uxbox.util.i18n :refer [tr]]
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]
[uxbox.util.router :as r] [uxbox.util.router :as r]
[rumext.core :as mx :include-macros true] [rumext.core :as mx :include-macros true]

View file

@ -13,6 +13,7 @@
[uxbox.main.data.lightbox :as udl] [uxbox.main.data.lightbox :as udl]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.main.ui.navigation :as nav] [uxbox.main.ui.navigation :as nav]
[uxbox.util.i18n :refer (tr)]
[uxbox.util.router :as rt] [uxbox.util.router :as rt]
[rumext.core :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
@ -24,16 +25,16 @@
[:ul.dropdown {:class (when-not open? "hide")} [:ul.dropdown {:class (when-not open? "hide")}
[:li {:on-click #(st/emit! (rt/navigate :settings/profile))} [:li {:on-click #(st/emit! (rt/navigate :settings/profile))}
i/user i/user
[:span "Profile"]] [:span (tr "ds.user.profile")]]
[:li {:on-click #(st/emit! (rt/navigate :settings/password))} [:li {:on-click #(st/emit! (rt/navigate :settings/password))}
i/lock i/lock
[:span "Password"]] [:span (tr "ds.user.password")]]
[:li {:on-click #(st/emit! (rt/navigate :settings/notifications))} [:li {:on-click #(st/emit! (rt/navigate :settings/notifications))}
i/mail i/mail
[:span "Notifications"]] [:span (tr "ds.user.notifications")]]
[:li {:on-click #(st/emit! (da/logout))} [:li {:on-click #(st/emit! (da/logout))}
i/exit i/exit
[:span "Exit"]]]) [:span (tr "ds.user.exit")]]])
;; --- User Widget ;; --- User Widget
@ -49,7 +50,8 @@
photo (if (str/empty? (:photo profile "")) photo (if (str/empty? (:photo profile ""))
"/images/avatar.jpg" "/images/avatar.jpg"
(:photo profile))] (:photo profile))]
[:div.user-zone {:on-mouse-enter #(swap! local assoc :open true) [:div.user-zone {:on-click #(st/emit! (rt/navigate :settings/profile))
:on-mouse-enter #(swap! local assoc :open true)
:on-mouse-leave #(swap! local assoc :open false)} :on-mouse-leave #(swap! local assoc :open false)}
[:span (:fullname profile)] [:span (:fullname profile)]
[:img {:src photo}] [:img {:src photo}]

View file

@ -12,7 +12,7 @@
(defn format (defn format
"Returns a string representation of the Instant "Returns a string representation of the Instant
instace with optional `fmt` format parameter. instance with optional `fmt` format parameter.
You can use `:iso` and `:unix` shortcuts as You can use `:iso` and `:unix` shortcuts as
format parameter. format parameter.