mirror of
https://github.com/penpot/penpot.git
synced 2026-11-13 21:40:33 +00:00
The text options started with Japanese only. Chinese and Korean reused its controls and helpers, which kept Japanese names, and some rules got a copy per language. - Rename text-japanese-layout to text-cjk-controls: the controls every language panel shares. The Japanese panel and its own controls move to text-language-layout, next to the Chinese and Korean ones. - Share one option row, one writing mode row (languages add their radio groups to it), and one emphasis and clearance select per language. - Rename the selection, plugin and HTML style helpers from japanese to cjk, `schema:jl-enum` to `schema:cjk-enum`, and the stored writing mode helpers to `stored-writing-mode` and `stored-vertical?`, apart from the rendered ones in writing-mode. - Build the language label and dropdown from one table of languages, and rename the profile-* translation keys to language-*. - Decide the attrs each language renders from one table per level (root, paragraph, span). - Serialize korean-wrap through the CJK enum table and RawKoreanWrap. - Compare the CJK option attrs in a loop in the text menu. AI-assisted-by: claude-opus-5-5
26 lines
1.0 KiB
Clojure
26 lines
1.0 KiB
Clojure
;; This Source Code Form is subject to the terms of the Mozilla Public
|
|
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
;;
|
|
;; Copyright (c) KALEIDOS SUBSIDIARY SL
|
|
|
|
(ns frontend-tests.ui.settings-text-language-test
|
|
(:require
|
|
["react-dom/server" :as rds]
|
|
[app.main.ui.hooks :as hooks]
|
|
[app.main.ui.settings.options :as options]
|
|
[cljs.test :as t :include-macros true]
|
|
[cuerdas.core :as str]
|
|
[rumext.v2 :as mf]))
|
|
|
|
(defn- render
|
|
[language]
|
|
(with-redefs [hooks/use-portal-container (fn ([] nil) ([_] nil))]
|
|
(rds/renderToStaticMarkup
|
|
(mf/element @#'options/text-language-settings* (mf/props {:language language})))))
|
|
|
|
(t/deftest profile-text-language-shows-the-chosen-language
|
|
(t/is (str/includes? (render nil) "dashboard.text-language.none"))
|
|
(t/is (str/includes? (render "zh-Hant-TW") "workspace.options.text-options.language-chinese-variant"))
|
|
(t/is (str/includes? (render "ja") "workspace.options.text-options.language-japanese")))
|