From 009720696c63562d9734c87253cb9f98aafc1259 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 24 Apr 2020 13:35:52 +0200 Subject: [PATCH] :sparkles: Update translation strings on text shape options. --- frontend/resources/locales.json | 19 +++ .../ui/workspace/sidebar/options/text.cljs | 120 +++++++++--------- 2 files changed, 78 insertions(+), 61 deletions(-) diff --git a/frontend/resources/locales.json b/frontend/resources/locales.json index 5257a1349..ad1028976 100644 --- a/frontend/resources/locales.json +++ b/frontend/resources/locales.json @@ -922,6 +922,25 @@ }, "unused" : true }, + "workspace.options.font-options.decoration": "Decoration", + "workspace.options.font-options.none": "None", + "workspace.options.font-options.underline": "Underline", + "workspace.options.font-options.strikethrough": "Strikethrough", + "workspace.options.font-options.align-left": "Align left", + "workspace.options.font-options.align-center": "Align center", + "workspace.options.font-options.align-right": "Align right", + "workspace.options.font-options.align-justify": "Justify", + "workspace.options.font-options.line-height": "Line height", + "workspace.options.font-options.letter-spacing": "Letter Spacing", + "workspace.options.font-options.vertical-align": "Vertical align", + "workspace.options.font-options.align-top": "Align top", + "workspace.options.font-options.align-middle": "Align middle", + "workspace.options.font-options.align-bottom": "Align bottom", + "workspace.options.font-options.text-case": "Case", + "workspace.options.font-options.uppercase": "Uppercase", + "workspace.options.font-options.lowercase": "Lowercase", + "workspace.options.font-options.titlecase": "Titlecase", + "workspace.options.font-options" : { "used-in" : [ "src/uxbox/main/ui/workspace/sidebar/options/text.cljs:85" ], "translations" : { diff --git a/frontend/src/uxbox/main/ui/workspace/sidebar/options/text.cljs b/frontend/src/uxbox/main/ui/workspace/sidebar/options/text.cljs index c65b73bc0..575adee0b 100644 --- a/frontend/src/uxbox/main/ui/workspace/sidebar/options/text.cljs +++ b/frontend/src/uxbox/main/ui/workspace/sidebar/options/text.cljs @@ -118,7 +118,7 @@ (mf/defc text-align-options - [{:keys [editor] :as props}] + [{:keys [editor locale] :as props}] (let [on-text-align-change (fn [event type] (dwt/set-text-align! editor type))] @@ -126,25 +126,25 @@ [:div.row-flex.align-icons [:span.tooltip.tooltip-bottom - {:alt "Align left" + {:alt (t locale "workspace.options.font-options.align-left") :class (dom/classnames :current (dwt/text-align-enabled? editor "left")) :on-click #(on-text-align-change % "left")} i/text-align-left] [:span.tooltip.tooltip-bottom - {:alt "Align center" + {:alt (t locale "workspace.options.font-options.align-center") :class (dom/classnames :current (dwt/text-align-enabled? editor "center")) :on-click #(on-text-align-change % "center")} i/text-align-center] [:span.tooltip.tooltip-bottom - {:alt "Align right" + {:alt (t locale "workspace.options.font-options.align-right") :class (dom/classnames :current (dwt/text-align-enabled? editor "right")) :on-click #(on-text-align-change % "right")} i/text-align-right] [:span.tooltip.tooltip-bottom - {:alt "Justify" + {:alt (t locale "workspace.options.font-options.align-justify") :class (dom/classnames :current (dwt/text-align-enabled? editor "justify")) :on-click #(on-text-align-change % "justify")} @@ -222,7 +222,7 @@ }]])) (mf/defc spacing-options - [{:keys [editor] :as props}] + [{:keys [editor locale] :as props}] (let [selection (mf/use-ref) lh (dwt/current-line-height editor {:default "1.2" :at (mf/ref-val selection)}) @@ -231,7 +231,7 @@ [:div.row-flex [:div.input-icon [:span.icon-before.tooltip.tooltip-bottom - {:alt "Line height"} + {:alt (t locale "workspace.options.font-options.line-height")} i/line-height] [:input.input-text {:type "number" @@ -246,7 +246,7 @@ (dwt/set-line-height! editor val sel)))}]] [:div.input-icon [:span.icon-before.tooltip.tooltip-bottom - {:alt "Letter spacing"} + {:alt (t locale "workspace.options.font-options.letter-spacing")} i/letter-spacing] [:input.input-text {:type "number" @@ -260,46 +260,48 @@ sel (mf/ref-val selection)] (dwt/set-letter-spacing! editor val sel)))}]]])) -(mf/defc box-sizing-options - [{:keys [editor] :as props}] - [:div.align-icons - [:span.tooltip.tooltip-bottom - {:alt "Auto height"} - i/auto-height] - [:span.tooltip.tooltip-bottom - {:alt "Auto width"} - i/auto-width] - [:span.tooltip.tooltip-bottom - {:alt "Fixed size"} - i/auto-fix]]) +;; (mf/defc box-sizing-options +;; [{:keys [editor] :as props}] +;; [:div.align-icons +;; [:span.tooltip.tooltip-bottom +;; {:alt "Auto height"} +;; i/auto-height] +;; [:span.tooltip.tooltip-bottom +;; {:alt "Auto width"} +;; i/auto-width] +;; [:span.tooltip.tooltip-bottom +;; {:alt "Fixed size"} +;; i/auto-fix]]) (mf/defc vertical-align-options - [{:keys [editor] :as props}] + [{:keys [editor locale] :as props}] (let [on-vertical-align-change (fn [event type] (dwt/set-vertical-align! editor type))] - [:div.align-icons - [:span.tooltip.tooltip-bottom - {:alt "Align top" - :class (dom/classnames - :current (dwt/vertical-align-enabled? editor "top")) - :on-click #(on-vertical-align-change % "top")} - i/align-top] - [:span.tooltip.tooltip-bottom - {:alt "Align middle" - :class (dom/classnames - :current (dwt/vertical-align-enabled? editor "center")) - :on-click #(on-vertical-align-change % "center")} - i/align-middle] - [:span.tooltip.tooltip-bottom - {:alt "Align bottom" - :class (dom/classnames - :current (dwt/vertical-align-enabled? editor "bottom")) - :on-click #(on-vertical-align-change % "bottom")} - i/align-bottom]])) + [:div.row-flex + [:span.element-set-subtitle (t locale "workspace.options.font-options.vertical-align")] + [:div.align-icons + [:span.tooltip.tooltip-bottom + {:alt (t locale "workspace.options.font-options.align-top") + :class (dom/classnames + :current (dwt/vertical-align-enabled? editor "top")) + :on-click #(on-vertical-align-change % "top")} + i/align-top] + [:span.tooltip.tooltip-bottom + {:alt (t locale "workspace.options.font-options.align-middle") + :class (dom/classnames + :current (dwt/vertical-align-enabled? editor "center")) + :on-click #(on-vertical-align-change % "center")} + i/align-middle] + [:span.tooltip.tooltip-bottom + {:alt (t locale "workspace.options.font-options.align-bottom") + :class (dom/classnames + :current (dwt/vertical-align-enabled? editor "bottom")) + :on-click #(on-vertical-align-change % "bottom")} + i/align-bottom]]])) (mf/defc text-decoration-options - [{:keys [editor] :as props}] + [{:keys [editor locale] :as props}] (let [on-decoration-change (fn [event type] (dom/prevent-default event) @@ -308,22 +310,22 @@ (dwt/set-text-decoration! editor "none") (dwt/set-text-decoration! editor type)))] [:div.row-flex - [:span.element-set-subtitle "Decoration"] + [:span.element-set-subtitle (t locale "workspace.options.font-options.decoration")] [:div.align-icons [:span.tooltip.tooltip-bottom - {:alt "None" + {:alt (t locale "workspace.options.font-options.none") :on-click #(on-decoration-change % "none")} i/minus] [:span.tooltip.tooltip-bottom - {:alt "Underline" + {:alt (t locale "workspace.options.font-options.underline") :class (dom/classnames :current (dwt/text-decoration-enabled? editor "underline")) :on-click #(on-decoration-change % "underline")} i/underline] [:span.tooltip.tooltip-bottom - {:alt "Strikethrough" + {:alt (t locale "workspace.options.font-options.strikethrough") :class (dom/classnames :current (dwt/text-decoration-enabled? editor "line-through")) :on-click #(on-decoration-change % "line-through")} @@ -331,7 +333,7 @@ (mf/defc text-transform-options - [{:keys [editor] :as props}] + [{:keys [editor locale] :as props}] (let [on-text-transform-change (fn [event type] (dom/prevent-default event) @@ -340,31 +342,31 @@ (dwt/set-text-transform! editor "none") (dwt/set-text-transform! editor type)))] [:div.row-flex - [:span.element-set-subtitle "Case"] + [:span.element-set-subtitle (t locale "workspace.options.font-options.text-case")] [:div.align-icons [:span.tooltip.tooltip-bottom - {:alt "None" + {:alt (t locale "workspace.options.font-options.none") :class (dom/classnames :current (dwt/text-transform-enabled? editor "none")) :on-click #(on-text-transform-change % "none")} i/minus] [:span.tooltip.tooltip-bottom - {:alt "Uppercase" + {:alt (t locale "workspace.options.font-options.uppercase") :class (dom/classnames :current (dwt/text-transform-enabled? editor "uppercase")) :on-click #(on-text-transform-change % "uppercase")} i/uppercase] [:span.tooltip.tooltip-bottom - {:alt "Lowercase" + {:alt (t locale "workspace.options.font-options.lowercase") :class (dom/classnames :current (dwt/text-transform-enabled? editor "lowercase")) :on-click #(on-text-transform-change % "lowercase")} i/lowercase] [:span.tooltip.tooltip-bottom - {:alt "Titlecase" + {:alt (t locale "workspace.options.font-options.titlecase") :class (dom/classnames :current (dwt/text-transform-enabled? editor "capitalize")) :on-click #(on-text-transform-change % "capitalize")} @@ -387,16 +389,12 @@ [:div.element-set [:div.element-set-title (t locale "workspace.options.font-options")] [:div.element-set-content - [:& font-options {:editor editor}] - [:& text-align-options {:editor editor}] - [:& spacing-options {:editor editor}] - - [:div.row-flex - [:& vertical-align-options {:editor editor}] - [:& box-sizing-options {:editor editor}]] - - [:& text-decoration-options {:editor editor}] - [:& text-transform-options {:editor editor}]]]])) + [:& font-options {:editor editor :locale locale}] + [:& text-align-options {:editor editor :locale locale}] + [:& spacing-options {:editor editor :locale locale}] + [:& vertical-align-options {:editor editor :locale locale}] + [:& text-decoration-options {:editor editor :locale locale}] + [:& text-transform-options {:editor editor :locale locale}]]]])) (mf/defc options [{:keys [shape] :as props}]