mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 17:56:10 +02:00
♻️ Change translation string from workspace.token to workspace.tokens (#6508)
* ♻️ Change string translation for tokens * ♻️ Apply find-and-replace on translation files --------- Co-authored-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
parent
af1c90c252
commit
3abc8774f6
31 changed files with 1050 additions and 1050 deletions
|
@ -291,9 +291,9 @@
|
|||
|
||||
(defn- tokens-of-unknown-type-warning [unknown-tokens]
|
||||
(let [type->tokens (group-by-value unknown-tokens)]
|
||||
(ntf/show {:content (tr "workspace.token.unknown-token-type")
|
||||
(ntf/show {:content (tr "workspace.tokens.unknown-token-type")
|
||||
:detail (->> (for [[token-type tokens] type->tokens]
|
||||
(tr "workspace.token.unknown-token-type-section" token-type (count tokens)))
|
||||
(tr "workspace.tokens.unknown-token-type-section" token-type (count tokens)))
|
||||
(str/join "\n"))
|
||||
:type :toast
|
||||
:level :info})))
|
||||
|
|
|
@ -12,57 +12,57 @@
|
|||
(def error-codes
|
||||
{:error.import/json-parse-error
|
||||
{:error/code :error.import/json-parse-error
|
||||
:error/fn #(tr "workspace.token.error-parse")}
|
||||
:error/fn #(tr "workspace.tokens.error-parse")}
|
||||
|
||||
:error.import/invalid-json-data
|
||||
{:error/code :error.import/invalid-json-data
|
||||
:error/fn #(tr "workspace.token.invalid-json")}
|
||||
:error/fn #(tr "workspace.tokens.invalid-json")}
|
||||
|
||||
:error.import/invalid-token-name
|
||||
{:error/code :error.import/invalid-json-data
|
||||
:error/fn #(tr "workspace.token.invalid-json-token-name")
|
||||
:error/detail #(tr "workspace.token.invalid-json-token-name-detail" %)}
|
||||
:error/fn #(tr "workspace.tokens.invalid-json-token-name")
|
||||
:error/detail #(tr "workspace.tokens.invalid-json-token-name-detail" %)}
|
||||
|
||||
:error.import/style-dictionary-reference-errors
|
||||
{:error/code :error.import/style-dictionary-reference-errors
|
||||
:error/fn #(str (tr "workspace.token.import-error") "\n\n" (first %))
|
||||
:error/fn #(str (tr "workspace.tokens.import-error") "\n\n" (first %))
|
||||
:error/detail #(str/join "\n\n" (rest %))}
|
||||
|
||||
:error.import/style-dictionary-unknown-error
|
||||
{:error/code :error.import/style-dictionary-reference-errors
|
||||
:error/fn #(tr "workspace.token.import-error")}
|
||||
:error/fn #(tr "workspace.tokens.import-error")}
|
||||
|
||||
:error.token/empty-input
|
||||
{:error/code :error.token/empty-input
|
||||
:error/fn #(tr "workspace.token.empty-input")}
|
||||
:error/fn #(tr "workspace.tokens.empty-input")}
|
||||
|
||||
:error.token/direct-self-reference
|
||||
{:error/code :error.token/direct-self-reference
|
||||
:error/fn #(tr "workspace.token.self-reference")}
|
||||
:error/fn #(tr "workspace.tokens.self-reference")}
|
||||
|
||||
:error.token/invalid-color
|
||||
{:error/code :error.token/invalid-color
|
||||
:error/fn #(str (tr "workspace.token.invalid-color" %))}
|
||||
:error/fn #(str (tr "workspace.tokens.invalid-color" %))}
|
||||
|
||||
:error.token/number-too-large
|
||||
{:error/code :error.token/number-too-large
|
||||
:error/fn #(str (tr "workspace.token.number-too-large" %))}
|
||||
:error/fn #(str (tr "workspace.tokens.number-too-large" %))}
|
||||
|
||||
:error.style-dictionary/missing-reference
|
||||
{:error/code :error.style-dictionary/missing-reference
|
||||
:error/fn #(str (tr "workspace.token.missing-references") (str/join " " %))}
|
||||
:error/fn #(str (tr "workspace.tokens.missing-references") (str/join " " %))}
|
||||
|
||||
:error.style-dictionary/invalid-token-value
|
||||
{:error/code :error.style-dictionary/invalid-token-value
|
||||
:error/fn #(str (tr "workspace.token.invalid-value" %))}
|
||||
:error/fn #(str (tr "workspace.tokens.invalid-value" %))}
|
||||
|
||||
:error.style-dictionary/invalid-token-value-opacity
|
||||
{:error/code :error.style-dictionary/invalid-token-value-opacity
|
||||
:error/fn #(str/join "\n" [(str (tr "workspace.token.invalid-value" %) ".") (tr "workspace.token.opacity-range")])}
|
||||
:error/fn #(str/join "\n" [(str (tr "workspace.tokens.invalid-value" %) ".") (tr "workspace.tokens.opacity-range")])}
|
||||
|
||||
:error.style-dictionary/invalid-token-value-stroke-width
|
||||
{:error/code :error.style-dictionary/invalid-token-value-stroke-width
|
||||
:error/fn #(str/join "\n" [(str (tr "workspace.token.invalid-value" %) ".") (tr "workspace.token.stroke-width-range")])}
|
||||
:error/fn #(str/join "\n" [(str (tr "workspace.tokens.invalid-value" %) ".") (tr "workspace.tokens.stroke-width-range")])}
|
||||
|
||||
:error/unknown
|
||||
{:error/code :error/unknown
|
||||
|
|
|
@ -197,7 +197,7 @@
|
|||
(let [data (dsh/lookup-file-data state)
|
||||
name (ctob/normalize-set-name id)
|
||||
tokens-lib (get data :tokens-lib)
|
||||
suffix (tr "workspace.token.duplicate-suffix")]
|
||||
suffix (tr "workspace.tokens.duplicate-suffix")]
|
||||
|
||||
(when-let [set (ctob/duplicate-set name tokens-lib {:suffix suffix})]
|
||||
(let [changes (-> (pcb/empty-changes it)
|
||||
|
@ -399,7 +399,7 @@
|
|||
(when-let [token (ctob/get-token token-set token-name)]
|
||||
(let [tokens (ctob/get-tokens token-set)
|
||||
unames (map :name tokens)
|
||||
suffix (tr "workspace.token.duplicate-suffix")
|
||||
suffix (tr "workspace.tokens.duplicate-suffix")
|
||||
copy-name (cfh/generate-unique-name token-name unames :suffix suffix)]
|
||||
|
||||
(rx/of (create-token (assoc token :name copy-name)))))))))
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
(def warning-codes
|
||||
{:warning.style-dictionary/invalid-referenced-token-value-opacity
|
||||
{:warning/code :warning.style-dictionary/invalid-referenced-token-value-opacity
|
||||
:warning/fn (fn [value] (str/join "\n" [(str (tr "workspace.token.resolved-value" value) ".") (tr "workspace.token.opacity-range")]))}
|
||||
:warning/fn (fn [value] (str/join "\n" [(str (tr "workspace.tokens.resolved-value" value) ".") (tr "workspace.tokens.opacity-range")]))}
|
||||
|
||||
:warning.style-dictionary/invalid-referenced-token-value-stroke-width
|
||||
{:warning/code :warning.style-dictionary/invalid-referenced-token-value-stroke-width
|
||||
:warning/fn (fn [value] (str/join "\n" [(str (tr "workspace.token.resolved-value" value) ".") (tr "workspace.token.stroke-width-range")]))}
|
||||
:warning/fn (fn [value] (str/join "\n" [(str (tr "workspace.tokens.resolved-value" value) ".") (tr "workspace.tokens.stroke-width-range")]))}
|
||||
|
||||
:warning/unknown
|
||||
{:warning/code :warning/unknown
|
||||
|
|
|
@ -174,7 +174,7 @@
|
|||
:p2 "Padding right"
|
||||
:p3 "Padding bottom"
|
||||
:p4 "Padding left"}
|
||||
:hint (tr "workspace.token.paddings")
|
||||
:hint (tr "workspace.tokens.paddings")
|
||||
:horizontal-attr-labels {:p2 "Padding right"
|
||||
:p4 "Padding left"}
|
||||
:vertical-attr-labels {:p1 "Padding top"
|
||||
|
@ -186,7 +186,7 @@
|
|||
:m2 "Margin right"
|
||||
:m3 "Margin bottom"
|
||||
:m4 "Margin left"}
|
||||
:hint (tr "workspace.token.margins")
|
||||
:hint (tr "workspace.tokens.margins")
|
||||
:horizontal-attr-labels {:m2 "Margin right"
|
||||
:m4 "Margin left"}
|
||||
:vertical-attr-labels {:m1 "Margin top"
|
||||
|
@ -194,7 +194,7 @@
|
|||
:on-update-shape update-shape-layout-margin})
|
||||
gap-items (all-or-separate-actions {:attribute-labels {:column-gap "Column Gap"
|
||||
:row-gap "Row Gap"}
|
||||
:hint (tr "workspace.token.gaps")
|
||||
:hint (tr "workspace.tokens.gaps")
|
||||
:on-update-shape dwta/update-layout-spacing}
|
||||
context-data)]
|
||||
(concat gap-items
|
||||
|
@ -207,19 +207,19 @@
|
|||
(concat
|
||||
(all-or-separate-actions {:attribute-labels {:width "Width"
|
||||
:height "Height"}
|
||||
:hint (tr "workspace.token.size")
|
||||
:hint (tr "workspace.tokens.size")
|
||||
:on-update-shape dwta/update-shape-dimensions}
|
||||
context-data)
|
||||
[:separator]
|
||||
(all-or-separate-actions {:attribute-labels {:layout-item-min-w "Min Width"
|
||||
:layout-item-min-h "Min Height"}
|
||||
:hint (tr "workspace.token.min-size")
|
||||
:hint (tr "workspace.tokens.min-size")
|
||||
:on-update-shape dwta/update-layout-sizing-limits}
|
||||
context-data)
|
||||
[:separator]
|
||||
(all-or-separate-actions {:attribute-labels {:layout-item-max-w "Max Width"
|
||||
:layout-item-max-h "Max Height"}
|
||||
:hint (tr "workspace.token.max-size")
|
||||
:hint (tr "workspace.tokens.max-size")
|
||||
:on-update-shape dwta/update-layout-sizing-limits}
|
||||
context-data)))
|
||||
|
||||
|
@ -234,11 +234,11 @@
|
|||
:r2 "Top Right"
|
||||
:r4 "Bottom Left"
|
||||
:r3 "Bottom Right"}
|
||||
:hint (tr "workspace.token.radius")
|
||||
:hint (tr "workspace.tokens.radius")
|
||||
:on-update-shape-all dwta/update-shape-radius-all
|
||||
:on-update-shape update-shape-radius-for-corners})
|
||||
:color (fn [context-data]
|
||||
[(generic-attribute-actions #{:fill} "Fill" (assoc context-data :on-update-shape dwta/update-fill :hint (tr "workspace.token.color")))
|
||||
[(generic-attribute-actions #{:fill} "Fill" (assoc context-data :on-update-shape dwta/update-fill :hint (tr "workspace.tokens.color")))
|
||||
(generic-attribute-actions #{:stroke-color} "Stroke" (assoc context-data :on-update-shape dwta/update-stroke-color))])
|
||||
:spacing spacing-attribute-actions
|
||||
:sizing sizing-attribute-actions
|
||||
|
@ -254,12 +254,12 @@
|
|||
[:separator]
|
||||
(stroke-width (assoc context-data :on-update-shape dwta/update-stroke-width))
|
||||
[:separator]
|
||||
(generic-attribute-actions #{:x} "X" (assoc context-data :on-update-shape dwta/update-shape-position :hint (tr "workspace.token.axis")))
|
||||
(generic-attribute-actions #{:x} "X" (assoc context-data :on-update-shape dwta/update-shape-position :hint (tr "workspace.tokens.axis")))
|
||||
(generic-attribute-actions #{:y} "Y" (assoc context-data :on-update-shape dwta/update-shape-position))))}))
|
||||
|
||||
(defn default-actions [{:keys [token selected-token-set-name]}]
|
||||
(let [{:keys [modal]} (dwta/get-token-properties token)]
|
||||
[{:title (tr "workspace.token.edit")
|
||||
[{:title (tr "workspace.tokens.edit")
|
||||
:no-selectable true
|
||||
:action (fn [event]
|
||||
(let [{:keys [key fields]} modal]
|
||||
|
@ -272,10 +272,10 @@
|
|||
:action "edit"
|
||||
:selected-token-set-name selected-token-set-name
|
||||
:token token}))))}
|
||||
{:title (tr "workspace.token.duplicate")
|
||||
{:title (tr "workspace.tokens.duplicate")
|
||||
:no-selectable true
|
||||
:action #(st/emit! (dwtl/duplicate-token (:name token)))}
|
||||
{:title (tr "workspace.token.delete")
|
||||
{:title (tr "workspace.tokens.delete")
|
||||
:no-selectable true
|
||||
:action #(st/emit! (dwtl/delete-token
|
||||
(ctob/prefixed-set-path-string->set-name-string selected-token-set-name)
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
(m/-simple-schema
|
||||
{:type :token/invalid-token-name
|
||||
:pred #(re-matches valid-token-name-regexp %)
|
||||
:type-properties {:error/fn #(str (:value %) (tr "workspace.token.token-name-validation-error"))}}))
|
||||
:type-properties {:error/fn #(str (:value %) (tr "workspace.tokens.token-name-validation-error"))}}))
|
||||
|
||||
(defn token-name-schema
|
||||
"Generate a dynamic schema validation to check if a token path derived from the name already exists at `tokens-tree`."
|
||||
|
@ -216,11 +216,11 @@
|
|||
empty-message? (nil? result)
|
||||
|
||||
message (cond
|
||||
empty-message? (tr "workspace.token.resolved-value" "-")
|
||||
empty-message? (tr "workspace.tokens.resolved-value" "-")
|
||||
warnings (wtw/humanize-warnings warnings)
|
||||
errors (->> (wte/humanize-errors errors)
|
||||
(str/join "\n"))
|
||||
:else (tr "workspace.token.resolved-value" (or resolved-value result)))
|
||||
:else (tr "workspace.tokens.resolved-value" (or resolved-value result)))
|
||||
type (cond
|
||||
empty-message? "hint"
|
||||
errors "error"
|
||||
|
@ -522,14 +522,14 @@
|
|||
[:div {:class (stl/css :token-rows)}
|
||||
[:> heading* {:level 2 :typography "headline-medium" :class (stl/css :form-modal-title)}
|
||||
(if (= action "edit")
|
||||
(tr "workspace.token.edit-token")
|
||||
(tr "workspace.token.create-token" token-type))]
|
||||
(tr "workspace.tokens.edit-token")
|
||||
(tr "workspace.tokens.create-token" token-type))]
|
||||
|
||||
[:div {:class (stl/css :input-row)}
|
||||
(let [token-title (str/lower (:title token-properties))]
|
||||
[:> input* {:id "token-name"
|
||||
:label (tr "workspace.token.token-name")
|
||||
:placeholder (tr "workspace.token.enter-token-name", token-title)
|
||||
:label (tr "workspace.tokens.token-name")
|
||||
:placeholder (tr "workspace.tokens.enter-token-name", token-title)
|
||||
:max-length max-input-length
|
||||
:variant "comfortable"
|
||||
:auto-focus true
|
||||
|
@ -552,12 +552,12 @@
|
|||
(when (and warning-name-change? (= action "edit"))
|
||||
[:div {:class (stl/css :warning-name-change-notification-wrapper)}
|
||||
[:> context-notification*
|
||||
{:level :warning :appearance :ghost} (tr "workspace.token.warning-name-change")]])]
|
||||
{:level :warning :appearance :ghost} (tr "workspace.tokens.warning-name-change")]])]
|
||||
|
||||
[:div {:class (stl/css :input-row)}
|
||||
[:> input-tokens-value*
|
||||
{:placeholder (tr "workspace.token.token-value-enter")
|
||||
:label (tr "workspace.token.token-value")
|
||||
{:placeholder (tr "workspace.tokens.token-value-enter")
|
||||
:label (tr "workspace.tokens.token-value")
|
||||
:default-value (mf/ref-val value-ref)
|
||||
:ref value-input-ref
|
||||
:color color
|
||||
|
@ -570,8 +570,8 @@
|
|||
:on-change on-update-color}])
|
||||
[:& token-value-hint {:result token-resolve-result}]]
|
||||
[:div {:class (stl/css :input-row)}
|
||||
[:> input* {:label (tr "workspace.token.token-description")
|
||||
:placeholder (tr "workspace.token.token-description")
|
||||
[:> input* {:label (tr "workspace.tokens.token-description")
|
||||
:placeholder (tr "workspace.tokens.token-description")
|
||||
:is-optional true
|
||||
:max-length max-input-length
|
||||
:variant "comfortable"
|
||||
|
|
|
@ -125,17 +125,17 @@
|
|||
|
||||
[:div {:class (stl/css :import-modal-wrapper)}
|
||||
[:> heading* {:level 2 :typography "headline-medium" :class (stl/css :import-modal-title)}
|
||||
(tr "workspace.token.import-tokens")]
|
||||
(tr "workspace.tokens.import-tokens")]
|
||||
|
||||
[:> text* {:as "ul" :typography "body-medium" :class (stl/css :import-description)}
|
||||
[:li (tr "workspace.token.import-single-file")]
|
||||
[:li (tr "workspace.token.import-multiple-files")]]
|
||||
[:li (tr "workspace.tokens.import-single-file")]
|
||||
[:li (tr "workspace.tokens.import-multiple-files")]]
|
||||
|
||||
[:> context-notification* {:type :context
|
||||
:appearance "neutral"
|
||||
:level "default"
|
||||
:is-html true}
|
||||
(tr "workspace.token.import-warning")]
|
||||
(tr "workspace.tokens.import-warning")]
|
||||
|
||||
[:div {:class (stl/css :import-actions)}
|
||||
[:input {:type "file"
|
||||
|
@ -157,12 +157,12 @@
|
|||
:type "button"
|
||||
:icon i/document
|
||||
:on-click on-display-file-explorer}
|
||||
(tr "workspace.token.choose-file")]
|
||||
(tr "workspace.tokens.choose-file")]
|
||||
[:> button* {:variant "primary"
|
||||
:type "button"
|
||||
:icon i/folder
|
||||
:on-click on-display-dir-explorer}
|
||||
(tr "workspace.token.choose-folder")]]]))
|
||||
(tr "workspace.tokens.choose-folder")]]]))
|
||||
|
||||
(mf/defc import-modal*
|
||||
{::mf/register modal/components
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
hint-message (if is-valid
|
||||
(str "1rem = " base-font-size)
|
||||
(tr "workspace.token.base-font-size.error"))
|
||||
(tr "workspace.tokens.base-font-size.error"))
|
||||
|
||||
on-change-base-font-size
|
||||
(mf/use-fn
|
||||
|
@ -82,15 +82,15 @@
|
|||
[:> heading* {:level 2
|
||||
:typography t/headline-medium
|
||||
:class (stl/css :settings-modal-title)}
|
||||
(tr "workspace.token.settings")]
|
||||
(tr "workspace.tokens.settings")]
|
||||
|
||||
[:div {:class (stl/css :settings-modal-content)}
|
||||
[:div {:class (stl/css :settings-modal-subtitle-wrapper)}
|
||||
[:> text* {:as "span" :typography t/body-large :class (stl/css :settings-subtitle)}
|
||||
(tr "workspace.token.base-font-size")]
|
||||
(tr "workspace.tokens.base-font-size")]
|
||||
[:> icon* {:icon-id "info"}]]
|
||||
[:> text* {:as "span" :typography t/body-medium :class (stl/css :settings-modal-description)}
|
||||
(tr "workspace.token.setting-description")]
|
||||
(tr "workspace.tokens.setting-description")]
|
||||
|
||||
[:> input* {:type "text"
|
||||
:placeholder "16"
|
||||
|
@ -114,4 +114,4 @@
|
|||
{::mf/register modal/components
|
||||
::mf/register-as :tokens/base-font-size}
|
||||
[]
|
||||
[:> token-settings-modal*])
|
||||
[:> token-settings-modal*])
|
||||
|
|
|
@ -42,15 +42,15 @@
|
|||
#(change-view :create-theme))]
|
||||
[:div {:class (stl/css :themes-modal-wrapper)}
|
||||
[:> heading* {:level 2 :typography "headline-medium" :class (stl/css :themes-modal-title)}
|
||||
(tr "workspace.token.themes-list")]
|
||||
(tr "workspace.tokens.themes-list")]
|
||||
[:div {:class (stl/css :empty-themes-wrapper)}
|
||||
[:div {:class (stl/css :empty-themes-message)}
|
||||
[:> text* {:as "span" :typography "title-medium" :class (stl/css :empty-theme-title)}
|
||||
(tr "workspace.token.no-themes-currently")]
|
||||
(tr "workspace.tokens.no-themes-currently")]
|
||||
[:> text* {:as "span"
|
||||
:class (stl/css :empty-theme-subtitle)
|
||||
:typography "body-medium"}
|
||||
(tr "workspace.token.create-new-theme")]]
|
||||
(tr "workspace.tokens.create-new-theme")]]
|
||||
[:div {:class (stl/css :button-footer)}
|
||||
[:> button* {:variant "secondary"
|
||||
:type "button"
|
||||
|
@ -59,7 +59,7 @@
|
|||
[:> button* {:variant "primary"
|
||||
:type "button"
|
||||
:on-click create-theme}
|
||||
(tr "workspace.token.add-new-theme")]]]]))
|
||||
(tr "workspace.tokens.add-new-theme")]]]]))
|
||||
|
||||
(mf/defc switch
|
||||
[{:keys [selected? name on-change]}]
|
||||
|
@ -91,9 +91,9 @@
|
|||
|
||||
[:div {:class (stl/css :themes-modal-wrapper)}
|
||||
[:> heading* {:level 2 :typography "headline-medium" :class (stl/css :themes-modal-title)}
|
||||
(tr "workspace.token.themes-list")]
|
||||
(tr "workspace.tokens.themes-list")]
|
||||
[:> text* {:as "div" :typography "body-medium" :class (stl/css :themes-modal-description)}
|
||||
(tr "workspace.token.themes-description")]
|
||||
(tr "workspace.tokens.themes-description")]
|
||||
[:ul {:class (stl/css :theme-group-wrapper)}
|
||||
(for [[group themes] themes-groups]
|
||||
[:li {:key (dm/str "token-theme-group" group)}
|
||||
|
@ -101,7 +101,7 @@
|
|||
[:> heading* {:level 3
|
||||
:class (stl/css :theme-group-label)
|
||||
:typography "body-large"}
|
||||
[:div {:class (stl/css :group-title) :title (str (tr "workspace.token.group-name") ": " group)}
|
||||
[:div {:class (stl/css :group-title) :title (str (tr "workspace.tokens.group-name") ": " group)}
|
||||
[:> icon* {:icon-id "group" :class (stl/css :group-title-icon)}]
|
||||
[:> text* {:as "span" :typography "body-medium" :class (stl/css :group-title-name)} group]]])
|
||||
[:ul {:class (stl/css :theme-group-rows-wrapper)}
|
||||
|
@ -127,7 +127,7 @@
|
|||
(dom/prevent-default e)
|
||||
(dom/stop-propagation e)
|
||||
(st/emit! (dwtl/toggle-token-theme-active? group name)))}
|
||||
[:& switch {:name (tr "workspace.token.theme-name" name)
|
||||
[:& switch {:name (tr "workspace.tokens.theme-name" name)
|
||||
:on-change (constantly nil)
|
||||
:selected? selected?}]]]
|
||||
[:div {:class (stl/css :theme-name-row)}
|
||||
|
@ -140,18 +140,18 @@
|
|||
:sets-count-empty-button (not sets-count))
|
||||
:variant "secondary"
|
||||
:type "button"
|
||||
:title (tr "workspace.token.sets-hint")
|
||||
:title (tr "workspace.tokens.sets-hint")
|
||||
:on-click on-edit-theme}
|
||||
[:div {:class (stl/css :label-wrapper)}
|
||||
[:> text* {:as "span" :typography "body-medium"}
|
||||
(if sets-count
|
||||
(tr "workspace.token.num-active-sets" sets-count)
|
||||
(tr "workspace.token.no-active-sets"))]
|
||||
(tr "workspace.tokens.num-active-sets" sets-count)
|
||||
(tr "workspace.tokens.no-active-sets"))]
|
||||
[:> icon* {:icon-id "arrow-right"}]]])
|
||||
|
||||
[:> icon-button* {:on-click delete-theme
|
||||
:variant "ghost"
|
||||
:aria-label (tr "workspace.token.delete-theme-title")
|
||||
:aria-label (tr "workspace.tokens.delete-theme-title")
|
||||
:icon "delete"}]]])]])]
|
||||
|
||||
[:div {:class (stl/css :button-footer)}
|
||||
|
@ -162,7 +162,7 @@
|
|||
[:> button* {:variant "primary"
|
||||
:type "button"
|
||||
:on-click create-theme}
|
||||
(tr "workspace.token.add-new-theme")]]]))
|
||||
(tr "workspace.tokens.add-new-theme")]]]))
|
||||
|
||||
(mf/defc theme-inputs*
|
||||
[{:keys [theme on-change-field]}]
|
||||
|
@ -187,16 +187,16 @@
|
|||
|
||||
[:div {:class (stl/css :edit-theme-inputs-wrapper)}
|
||||
[:div {:class (stl/css :group-input-wrapper)}
|
||||
[:> label* {:for "groups-dropdown" :is-optional true} (tr "workspace.token.label.group")]
|
||||
[:> label* {:for "groups-dropdown" :is-optional true} (tr "workspace.tokens.label.group")]
|
||||
[:> combobox* {:id (dm/str "groups-dropdown")
|
||||
:placeholder (tr "workspace.token.label.group-placeholder")
|
||||
:placeholder (tr "workspace.tokens.label.group-placeholder")
|
||||
:default-selected (:group theme)
|
||||
:options (clj->js options)
|
||||
:on-change on-update-group}]]
|
||||
|
||||
[:div {:class (stl/css :group-input-wrapper)}
|
||||
[:> input* {:label (tr "workspace.token.label.theme")
|
||||
:placeholder (tr "workspace.token.label.theme-placeholder")
|
||||
[:> input* {:label (tr "workspace.tokens.label.theme")
|
||||
:placeholder (tr "workspace.tokens.label.theme-placeholder")
|
||||
:max-length max-input-length
|
||||
:variant "comfortable"
|
||||
:default-value (mf/ref-val theme-name-ref)
|
||||
|
@ -230,7 +230,7 @@
|
|||
:on-click on-save-form
|
||||
:on-key-down handle-key-down-save
|
||||
:disabled disabled?}
|
||||
(tr "workspace.token.save-theme")]]))
|
||||
(tr "workspace.tokens.save-theme")]]))
|
||||
|
||||
(defn- make-lib-with-theme
|
||||
[theme sets]
|
||||
|
@ -324,8 +324,8 @@
|
|||
[:div {:class (stl/css :themes-modal-wrapper)}
|
||||
[:> heading* {:level 2 :typography "headline-medium" :class (stl/css :themes-modal-title)}
|
||||
(if is-editing
|
||||
(tr "workspace.token.edit-theme-title")
|
||||
(tr "workspace.token.add-new-theme"))]
|
||||
(tr "workspace.tokens.edit-theme-title")
|
||||
(tr "workspace.tokens.add-new-theme"))]
|
||||
|
||||
[:form {:on-submit on-save-form :class (stl/css :edit-theme-form)}
|
||||
[:div {:class (stl/css :edit-theme-wrapper)}
|
||||
|
@ -334,12 +334,12 @@
|
|||
:class (stl/css :back-btn)
|
||||
:type "button"}
|
||||
[:> icon* {:icon-id ic/arrow-left :aria-hidden true}]
|
||||
(tr "workspace.token.back-to-themes")])
|
||||
(tr "workspace.tokens.back-to-themes")])
|
||||
|
||||
[:> theme-inputs* {:theme current-theme
|
||||
:on-change-field on-change-field}]
|
||||
[:> text* {:as "span" :typography "body-small" :class (stl/css :select-sets-message)}
|
||||
(tr "workspace.token.set-selection-theme")]
|
||||
(tr "workspace.tokens.set-selection-theme")]
|
||||
[:div {:class (stl/css :sets-list-wrapper)}
|
||||
|
||||
[:> wts/controlled-sets-list*
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
:on-key-down on-key-down
|
||||
:maxlength "256"
|
||||
:auto-focus true
|
||||
:placeholder (tr "workspace.token.set-edit-placeholder")
|
||||
:placeholder (tr "workspace.tokens.set-edit-placeholder")
|
||||
:default-value default-value}]))
|
||||
|
||||
(mf/defc checkbox*
|
||||
|
@ -113,7 +113,7 @@
|
|||
[:div {:role "checkbox"
|
||||
:aria-checked (dm/str checked)
|
||||
:disabled disabled
|
||||
:title (when disabled (tr "workspace.token.no-permisions-set"))
|
||||
:title (when disabled (tr "workspace.tokens.no-permisions-set"))
|
||||
:tab-index 0
|
||||
:class (stl/css-case :checkbox-style true
|
||||
:checkbox-checked-style checked?
|
||||
|
@ -134,20 +134,20 @@
|
|||
(if can-edit?
|
||||
[:div {:class (stl/css :empty-sets-wrapper)}
|
||||
[:> text* {:as "span" :typography "body-small" :class (stl/css :empty-state-message)}
|
||||
(tr "workspace.token.no-sets-yet")]
|
||||
(tr "workspace.tokens.no-sets-yet")]
|
||||
[:button {:on-click on-start-creation
|
||||
:class (stl/css :create-set-button)}
|
||||
(tr "workspace.token.create-one")]]
|
||||
(tr "workspace.tokens.create-one")]]
|
||||
[:div {:class (stl/css :empty-sets-wrapper)}
|
||||
[:> text* {:as "span" :typography "body-small" :class (stl/css :empty-state-message)}
|
||||
(tr "workspace.token.no-sets-yet")]])))
|
||||
(tr "workspace.tokens.no-sets-yet")]])))
|
||||
|
||||
(mf/defc add-button*
|
||||
[]
|
||||
[:> icon-button* {:variant "ghost"
|
||||
:icon "add"
|
||||
:on-click on-start-creation
|
||||
:aria-label (tr "workspace.token.add set")}])
|
||||
:aria-label (tr "workspace.tokens.add set")}])
|
||||
|
||||
(mf/defc sets-tree-set-group*
|
||||
{::mf/private true}
|
||||
|
@ -246,7 +246,7 @@
|
|||
:all true
|
||||
:partial "mixed"
|
||||
:none false)
|
||||
:arial-label (tr "workspace.token.select-set")}]])]))
|
||||
:arial-label (tr "workspace.tokens.select-set")}]])]))
|
||||
|
||||
(mf/defc sets-tree-set*
|
||||
[{:keys [id set label tree-depth tree-path tree-index is-selected is-active is-draggable is-editing
|
||||
|
@ -348,7 +348,7 @@
|
|||
[:> checkbox*
|
||||
{:on-click on-checkbox-click
|
||||
:disabled (not can-edit?)
|
||||
:arial-label (tr "workspace.token.select-set")
|
||||
:arial-label (tr "workspace.tokens.select-set")
|
||||
:checked is-active}]])]))
|
||||
|
||||
(mf/defc token-sets-tree*
|
||||
|
@ -512,7 +512,7 @@
|
|||
[:div {:class (stl/css :sets-list)}
|
||||
(if ^boolean empty-state?
|
||||
[:> text* {:as "span" :typography "body-small" :class (stl/css :empty-state-message-sets)}
|
||||
(tr "workspace.token.no-sets-create")]
|
||||
(tr "workspace.tokens.no-sets-create")]
|
||||
|
||||
[:> token-sets-tree*
|
||||
{:is-draggable draggable?
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
[:ul {:class (stl/css :context-list)}
|
||||
(when is-group
|
||||
[:> menu-entry* {:title (tr "workspace.token.add-set-to-group") :on-click create-set-at-path}])
|
||||
[:> menu-entry* {:title (tr "workspace.tokens.add-set-to-group") :on-click create-set-at-path}])
|
||||
[:> menu-entry* {:title (tr "labels.rename") :on-click on-edit}]
|
||||
(when-not is-group
|
||||
[:> menu-entry* {:title (tr "labels.duplicate") :on-click on-duplicate}])
|
||||
|
|
|
@ -181,11 +181,11 @@
|
|||
(if (empty? ordered-themes)
|
||||
[:div {:class (stl/css :empty-theme-wrapper)}
|
||||
[:> text* {:as "span" :typography "body-small" :class (stl/css :empty-state-message)}
|
||||
(tr "workspace.token.no-themes")]
|
||||
(tr "workspace.tokens.no-themes")]
|
||||
(when can-edit?
|
||||
[:button {:on-click open-modal
|
||||
:class (stl/css :create-theme-button)}
|
||||
(tr "workspace.token.create-one")])]
|
||||
(tr "workspace.tokens.create-one")])]
|
||||
(if can-edit?
|
||||
[:div {:class (stl/css :theme-select-wrapper)}
|
||||
[:& theme-select]
|
||||
|
@ -194,7 +194,7 @@
|
|||
:on-click open-modal}
|
||||
(tr "labels.edit")]]
|
||||
[:div {:title (when-not can-edit?
|
||||
(tr "workspace.token.no-permission-themes"))}
|
||||
(tr "workspace.tokens.no-permission-themes"))}
|
||||
[:& theme-select]]))]))
|
||||
|
||||
(mf/defc token-sets-list*
|
||||
|
@ -328,8 +328,8 @@
|
|||
[:*
|
||||
[:& token-context-menu]
|
||||
[:div {:class (stl/css :sets-header-container)}
|
||||
[:> text* {:as "span" :typography "headline-small" :class (stl/css :sets-header)} (tr "workspace.token.tokens-section-title" selected-token-set-name)]
|
||||
[:div {:class (stl/css :sets-header-status) :title (tr "workspace.token.inactive-set-description")}
|
||||
[:> text* {:as "span" :typography "headline-small" :class (stl/css :sets-header)} (tr "workspace.tokens.tokens-section-title" selected-token-set-name)]
|
||||
[:div {:class (stl/css :sets-header-status) :title (tr "workspace.tokens.inactive-set-description")}
|
||||
;; NOTE: when no set in tokens-lib, the selected-token-set-name
|
||||
;; will be `nil`, so for properly hide the inactive message we
|
||||
;; check that at least `selected-token-set-name` has a value
|
||||
|
@ -338,7 +338,7 @@
|
|||
[:*
|
||||
[:> i/icon* {:class (stl/css :sets-header-status-icon) :icon-id i/eye-off}]
|
||||
[:> text* {:as "span" :typography "body-small" :class (stl/css :sets-header-status-text)}
|
||||
(tr "workspace.token.inactive-set")]])]]
|
||||
(tr "workspace.tokens.inactive-set")]])]]
|
||||
|
||||
(for [type filled-group]
|
||||
(let [tokens (get tokens-by-type type)]
|
||||
|
@ -401,7 +401,7 @@
|
|||
[:> button* {:on-click open-menu
|
||||
:icon "import-export"
|
||||
:variant "secondary"}
|
||||
(tr "workspace.token.tools")]
|
||||
(tr "workspace.tokens.tools")]
|
||||
[:& dropdown-menu {:show show-menu?
|
||||
:on-close close-menu
|
||||
:list-class (stl/css :import-export-menu)}
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
:checked-element-button true)
|
||||
:role "option"
|
||||
:on-click on-edit-click}
|
||||
[:> text* {:as "span" :typography "body-small"} (tr "workspace.token.edit-themes")]
|
||||
[:> text* {:as "span" :typography "body-small"} (tr "workspace.tokens.edit-themes")]
|
||||
[:> icon* {:icon-id i/arrow-right :aria-hidden true}]]])))
|
||||
|
||||
(mf/defc theme-select
|
||||
|
@ -81,12 +81,12 @@
|
|||
can-edit? (:can-edit (deref refs/permissions))
|
||||
;; Data
|
||||
current-label (cond
|
||||
(> active-themes-count 1) (tr "workspace.token.active-themes" active-themes-count)
|
||||
(> active-themes-count 1) (tr "workspace.tokens.active-themes" active-themes-count)
|
||||
(= active-themes-count 1) (some->> (first active-theme-paths)
|
||||
(ctob/split-token-theme-path)
|
||||
(remove empty?)
|
||||
(str/join " / "))
|
||||
:else (tr "workspace.token.no-active-theme"))
|
||||
:else (tr "workspace.tokens.no-active-theme"))
|
||||
|
||||
;; State
|
||||
state* (mf/use-state
|
||||
|
|
|
@ -121,21 +121,21 @@
|
|||
grouped-values (group-by dimensions-dictionary app-token-keys)
|
||||
|
||||
base-title (dm/str "Token: " name "\n"
|
||||
(tr "workspace.token.original-value" value) "\n"
|
||||
(tr "workspace.token.resolved-value" resolved-value))]
|
||||
(tr "workspace.tokens.original-value" value) "\n"
|
||||
(tr "workspace.tokens.resolved-value" resolved-value))]
|
||||
|
||||
(cond
|
||||
;; If there are errors, show the appropriate message
|
||||
ref-not-in-active-set
|
||||
(tr "workspace.token.ref-not-valid")
|
||||
(tr "workspace.tokens.ref-not-valid")
|
||||
|
||||
no-valid-value
|
||||
(tr "workspace.token.value-not-valid")
|
||||
(tr "workspace.tokens.value-not-valid")
|
||||
|
||||
;; If the token is applied and the user is a is-viewer, show the details
|
||||
(and is-applied? is-viewer)
|
||||
(->> [base-title
|
||||
(tr "workspace.token.applied-to")
|
||||
(tr "workspace.tokens.applied-to")
|
||||
(if (= :dimensions type)
|
||||
(translate-and-format grouped-values)
|
||||
(str "- " title ": " applied-to))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue