From 514b5faf6ea0cfe1ee5649985a5e0f1fb024893e Mon Sep 17 00:00:00 2001 From: Gabriel Horner Date: Thu, 18 May 2023 18:13:50 -0400 Subject: [PATCH] Refactor and simplify dicts - frontend.dicts encapsulates dicts behavior for all other namespaces - Each dict ns only has one var which prepares us - No longer need shortcut.dicts - Fix remaining lints that were broken - Also bring back frontend.dicts - Update guide - Add a false binding to :editor/toggle-undo-redo-mode which throws a needless warning --- docs/contributing-to-translations.md | 45 ++- scripts/src/logseq/tasks/lang.clj | 44 +-- src/main/frontend/components/settings.cljs | 2 +- src/main/frontend/context/i18n.cljs | 6 +- src/main/frontend/dicts.cljc | 84 +++++ src/main/frontend/dicts/af.cljc | 9 +- src/main/frontend/dicts/core.cljc | 62 ---- src/main/frontend/dicts/de.cljc | 11 +- src/main/frontend/dicts/en.cljc | 324 +++++++++--------- src/main/frontend/dicts/es.cljc | 11 +- src/main/frontend/dicts/fr.cljc | 9 +- src/main/frontend/dicts/it.cljc | 9 +- src/main/frontend/dicts/ja.cljc | 9 +- src/main/frontend/dicts/ko.cljc | 9 +- src/main/frontend/dicts/nb_no.cljc | 9 +- src/main/frontend/dicts/nl.cljc | 9 +- src/main/frontend/dicts/pl.cljc | 9 +- src/main/frontend/dicts/pt_br.cljc | 8 +- src/main/frontend/dicts/pt_pt.cljc | 11 +- src/main/frontend/dicts/ru.cljc | 11 +- src/main/frontend/dicts/sk.cljc | 9 +- src/main/frontend/dicts/tr.cljc | 9 +- src/main/frontend/dicts/uk.cljc | 9 +- src/main/frontend/dicts/zh_cn.cljc | 9 +- src/main/frontend/dicts/zh_hant.cljc | 9 +- .../frontend/modules/shortcut/config.cljs | 26 +- src/main/frontend/modules/shortcut/dicts.cljc | 63 ---- src/test/frontend/context/i18n_test.cljs | 4 +- 28 files changed, 383 insertions(+), 446 deletions(-) create mode 100644 src/main/frontend/dicts.cljc delete mode 100644 src/main/frontend/dicts/core.cljc delete mode 100644 src/main/frontend/modules/shortcut/dicts.cljc diff --git a/docs/contributing-to-translations.md b/docs/contributing-to-translations.md index f5766fc7b0d..70cba38af4f 100644 --- a/docs/contributing-to-translations.md +++ b/docs/contributing-to-translations.md @@ -13,8 +13,8 @@ In order to run the commands in this doc, you will need to install ## Where to Contribute -Language translations in this library, -[src/main/frontend/dicts/](https://github.com/logseq/logseq/blob/master/src/main/frontend/dicts/), `.cljc` file the isolated packages for each language. +Language translations are under, +[src/main/frontend/dicts/](https://github.com/logseq/logseq/blob/master/src/main/frontend/dicts/) with each language having it's own file. For example, the es locale is in `es.cljc `. ## Language Overview @@ -52,16 +52,15 @@ Let's try to get your language translated as close to 100% as you can! ## Edit a Language -To see what translations are missing for your language use: +To see what translations are missing for your language, let's run a command using `es` as the example language: ```shell -$ bb lang:missing LOCALE -| :translation-key | :string-to-translate | :file | -|---------------------------------------------+---------------------------------------------+---------------------| -| :content/copy-block-url | Copy block URL | frontend/dicts/core.cljs | -| :content/copy-export-as | Copy / Export as.. | frontend/dicts/core.cljs | -| :content/copy-ref | Copy this reference | frontend/dicts/core.cljs | -| :content/delete-ref | Delete this reference | frontend/dicts/core.cljs | +$ bb lang:missing es +| :translation-key | :string-to-translate | :file | +|---------------------------------------+-------------------------------------------------------+---------------| +| :command.editor/toggle-number-list | Toggle number list | dicts/es.cljc | +| :command.whiteboard/bring-forward | Move forward | dicts/es.cljc | +| :command.whiteboard/bring-to-front | Move to front | dicts/es.cljc | ... ``` @@ -70,17 +69,16 @@ Over time you're aiming to have this list drop to zero. Since this process can b ```sh # When pasting this content, be sure to update the indentation to match the file -$ bb lang:missing LOCALE --copy +$ bb lang:missing es --copy -;; For frontend/dicts.cljs -:content/copy-block-url "Copy block URL" -:content/copy-export-as "Copy / Export as.." -:content/copy-ref "Copy this reference" -:content/delete-ref "Delete this reference" +;; For dicts/es.cljc +:command.editor/toggle-number-list "Toggle number list" +:command.whiteboard/bring-forward "Move forward" +:command.whiteboard/bring-to-front "Move to front" ... ``` -Almost all translations are pretty quick. The only exceptions to this are the keys `:tutorial/text` and `:tutorial/dummy-notes`. These reference files that are part of the onboarding tutorial. Most languages don't have this translated. If you are willing to do this, we would be happy to have this translated. +Almost all translations are small. The only exceptions to this are the keys `:tutorial/text` and `:tutorial/dummy-notes`. These reference files that are part of the onboarding tutorial. Most languages don't have this translated. If you are willing to do this, we would be happy to have this translated. ## Fix Untranslated @@ -106,11 +104,8 @@ and tell you what's wrong. ## Add a Language -To add a new language you must create a new file in the `frontend.dicts` namespace containing two variables: - -- **application `(def application ...)`:** translation of the application into the idiom -- **shortcuts `(def shortcuts ...)`:** shortcut translation - -Use as base the main language file `frontend/dicts/en.cljs`. - -After creating the language pack you should add the `application` variable to `frontend.dicts.core` and the `shortcuts` variable to `frontend.modules.shortcut.dicts`. +To add a new language: +* Add an entry to `frontend.dicts/languages` +* Create a new file under `src/main/frontend/dicts/` and name the file the same as the locale e.g. zz.cljc for a hypothetical zz locale. +* Add a `(def dicts {})` in that file and then add a entry in the `dicts` map in `src/main/frontend/dicts.cljc`. +* Then start translating for your language and adding entries in your language's `dicts` using the `bb lang:missing` workflow. \ No newline at end of file diff --git a/scripts/src/logseq/tasks/lang.clj b/scripts/src/logseq/tasks/lang.clj index 8b45a778d81..54661770417 100644 --- a/scripts/src/logseq/tasks/lang.clj +++ b/scripts/src/logseq/tasks/lang.clj @@ -2,19 +2,14 @@ "Tasks related to language translations" (:require [clojure.set :as set] [clojure.string :as string] - [frontend.dicts.core :as dicts] - [frontend.modules.shortcut.dicts :as shortcut-dicts] + [frontend.dicts :as dicts] [logseq.tasks.util :as task-util] [babashka.cli :as cli] [babashka.process :refer [shell]])) (defn- get-dicts [] - (dissoc dicts/dicts :tongue/fallback)) - -(defn- get-all-dicts - [] - (merge-with merge (get-dicts) shortcut-dicts/dicts)) + dicts/dicts) (defn- get-languages [] @@ -25,7 +20,7 @@ (defn list-langs "List translated langagues with their number of translations" [] - (let [dicts (get-all-dicts) + (let [dicts (get-dicts) en-count (count (dicts :en)) langs (get-languages)] (->> dicts @@ -52,24 +47,20 @@ _ (when-not (contains? (get-languages) lang) (println "Language" lang "does not have an entry in dicts/core.cljs") (System/exit 1)) - all-dicts [[(get-dicts) "frontend/dicts/core.cljs"] - [shortcut-dicts/dicts "shortcut/dicts.cljs"]] - all-missing (map (fn [[dicts file]] - [(select-keys (dicts :en) - (set/difference (set (keys (dicts :en))) - (set (keys (dicts lang))))) - file]) - all-dicts)] - (if (every? (comp zero? count first) all-missing) + dicts (get-dicts) + all-missing (select-keys (dicts :en) + (set/difference (set (keys (dicts :en))) + (set (keys (dicts lang)))))] + (if (-> all-missing count zero?) (println "Language" lang "is fully translated!") (let [sorted-missing (->> all-missing - (mapcat (fn [[m file]] - (map (fn [[k v]] - {:translation-key k + (map (fn [[k v]] + {:translation-key k ;; Shorten values - :string-to-translate (shorten v 50) - :file file}) - m))) + :string-to-translate (shorten v 50) + :file (str "dicts/" + (-> lang name (string/replace "-" "_") string/lower-case) + ".cljc")})) (sort-by (juxt :file :translation-key)))] (if (:copy options) (doseq [[file missing-for-file] (group-by :file sorted-missing)] @@ -84,7 +75,7 @@ language. This catches mistakes where another language has accidentally typoed keys or added ones without updating :en" [] - (let [dicts (get-all-dicts) + (let [dicts (get-dicts) ;; For now defined as :en but clj-kondo analysis could be more thorough valid-keys (set (keys (dicts :en))) invalid-dicts @@ -137,7 +128,8 @@ (map #(keyword (subs % 4))) (concat (mapcat val manual-ui-dicts)) set) - expected-dicts (set (keys (:en (get-dicts)))) + expected-dicts (set (remove #(re-find #"^(command|shortcut)\." (str (namespace %))) + (keys (:en (get-dicts))))) actual-only (set/difference actual-dicts expected-dicts) expected-only (set/difference expected-dicts actual-dicts)] (if (and (empty? actual-only) (empty? expected-only)) @@ -160,7 +152,7 @@ (defn list-duplicates "Lists translations that are the same as the one in English" [& args] - (let [dicts (get-all-dicts) + (let [dicts (get-dicts) en-dicts (dicts :en) lang (or (keyword (first args)) (task-util/print-usage "LOCALE")) diff --git a/src/main/frontend/components/settings.cljs b/src/main/frontend/components/settings.cljs index 268c9fc4a90..fa22c986dfc 100644 --- a/src/main/frontend/components/settings.cljs +++ b/src/main/frontend/components/settings.cljs @@ -8,7 +8,7 @@ [frontend.storage :as storage] [frontend.spec.storage :as storage-spec] [frontend.date :as date] - [frontend.dicts.core :as dicts] + [frontend.dicts :as dicts] [frontend.handler :as handler] [frontend.handler.config :as config-handler] [frontend.handler.notification :as notification] diff --git a/src/main/frontend/context/i18n.cljs b/src/main/frontend/context/i18n.cljs index f8b85f017b1..bddd5330001 100644 --- a/src/main/frontend/context/i18n.cljs +++ b/src/main/frontend/context/i18n.cljs @@ -2,13 +2,11 @@ "This ns is a system component that handles translation for the entire application. The ns dependencies for this ns must be small since it is used throughout the application." - (:require [frontend.dicts.core :as dicts] - [frontend.modules.shortcut.dicts :as shortcut-dicts] + (:require [frontend.dicts :as dicts] [tongue.core :as tongue] [frontend.state :as state])) -(def dicts - (merge-with merge dicts/dicts shortcut-dicts/dicts)) +(def dicts (merge dicts/dicts {:tongue/fallback :en})) (def translate (tongue/build-translate dicts)) diff --git a/src/main/frontend/dicts.cljc b/src/main/frontend/dicts.cljc new file mode 100644 index 00000000000..668187dc7b0 --- /dev/null +++ b/src/main/frontend/dicts.cljc @@ -0,0 +1,84 @@ +(ns ^:bb-compatible frontend.dicts + "Provides dictionary entries for most of the application" + (:require [frontend.dicts.en :as en] + [frontend.dicts.de :as de] + [frontend.dicts.nl :as nl] + [frontend.dicts.fr :as fr] + [frontend.dicts.zh-cn :as zh-CN] + [frontend.dicts.zh-hant :as zh-Hant] + [frontend.dicts.af :as af] + [frontend.dicts.es :as es] + [frontend.dicts.nb-no :as nb-NO] + [frontend.dicts.pt-br :as pt-BR] + [frontend.dicts.pt-pt :as pt-PT] + [frontend.dicts.ru :as ru] + [frontend.dicts.ja :as ja] + [frontend.dicts.it :as it] + [frontend.dicts.tr :as tr] + [frontend.dicts.ko :as ko] + [frontend.dicts.pl :as pl] + [frontend.dicts.sk :as sk] + [frontend.dicts.uk :as uk])) + +(def categories + "Shortcut categories described in default language" + (set (filter #(= "shortcut.category" (namespace %)) (keys en/dicts)))) + +(def abbreviated-commands + "Commands defined in default language and in a format that + frontend.modules.shortcut.* namespaces understand e.g. :date-picker/complete + instead of :command.date-picker/complete" + (set (keys (:commands en/dicts)))) + +(defn- decorate-namespace [k] + (let [n (name k) + ns (namespace k)] + (keyword (str "command." ns) n))) + +(def ^:private en-dicts + (merge (dissoc en/dicts :commands) + ;; Dynamically add :command ns prefix since command descriptions have to + ;; stay in sync with frontend.modules.shortcut.config keywords which do not + ;; have the prefix + (update-keys (:commands en/dicts) decorate-namespace))) + +(def dicts + {:en en-dicts + :de de/dicts + :nl nl/dicts + :fr fr/dicts + :zh-CN zh-CN/dicts + :zh-Hant zh-Hant/dicts + :af af/dicts + :es es/dicts + :nb-NO nb-NO/dicts + :pt-BR pt-BR/dicts + :pt-PT pt-PT/dicts + :ru ru/dicts + :ja ja/dicts + :it it/dicts + :tr tr/dicts + :ko ko/dicts + :pl pl/dicts + :sk sk/dicts + :uk uk/dicts}) + +(def languages [{:label "English" :value :en} + {:label "Français" :value :fr} + {:label "Deutsch" :value :de} + {:label "Dutch (Nederlands)" :value :nl} + {:label "简体中文" :value :zh-CN} + {:label "繁體中文" :value :zh-Hant} + {:label "Afrikaans" :value :af} + {:label "Español" :value :es} + {:label "Norsk (bokmål)" :value :nb-NO} + {:label "Polski" :value :pl} + {:label "Português (Brasileiro)" :value :pt-BR} + {:label "Português (Europeu)" :value :pt-PT} + {:label "Русский" :value :ru} + {:label "日本語" :value :ja} + {:label "Italiano" :value :it} + {:label "Türkçe" :value :tr} + {:label "Українська" :value :uk} + {:label "한국어" :value :ko} + {:label "Slovenčina" :value :sk}]) diff --git a/src/main/frontend/dicts/af.cljc b/src/main/frontend/dicts/af.cljc index 630e937f269..2cefbe36fe7 100644 --- a/src/main/frontend/dicts/af.cljc +++ b/src/main/frontend/dicts/af.cljc @@ -1,7 +1,7 @@ (ns frontend.dicts.af "Provides translation to AF") -(def application +(def ^:large-vars/data-var dicts {:on-boarding/demo-graph "This is a demo graph, changes will not be saved until you open a local folder." :on-boarding/add-graph "Add a graph" :on-boarding/open-local-dir "Open a local directory" @@ -85,10 +85,9 @@ :language "Taal" :file-sync/other-user-graph "Huidige plaaslike grafiek is gebonde aan ander gebruiker se afgeleë grafiek. So kan nie begin om te sinkroniseer nie." - :file-sync/graph-deleted "Huidige afstandgrafiek is geskrap"}) + :file-sync/graph-deleted "Huidige afstandgrafiek is geskrap" -(def shortcuts - {:shortcut.category/formatting "Formatering" + :shortcut.category/formatting "Formatering" :command.editor/indent "Ingekeepte blok oortjie" :command.editor/outdent "Oningekeepte blok" :command.editor/move-block-up "Skuif Blok Boontoe" @@ -110,4 +109,4 @@ :command.ui/toggle-document-mode "Wissel dokument modus" :command.go/journals "Spring na joernale" :command.ui/toggle-theme "Wissel tussen donker/lig temas" - :command.ui/toggle-right-sidebar "Wissel regter sybalk"}) + :command.ui/toggle-right-sidebar "Wissel regter sybalk"}) \ No newline at end of file diff --git a/src/main/frontend/dicts/core.cljc b/src/main/frontend/dicts/core.cljc deleted file mode 100644 index aba0c950ab1..00000000000 --- a/src/main/frontend/dicts/core.cljc +++ /dev/null @@ -1,62 +0,0 @@ -(ns ^:bb-compatible frontend.dicts.core - "Provides dictionary entries for most of the application" - (:require [frontend.dicts.en :as en] - [frontend.dicts.de :as de] - [frontend.dicts.nl :as nl] - [frontend.dicts.fr :as fr] - [frontend.dicts.zh-cn :as zh-CN] - [frontend.dicts.zh-hant :as zh-Hant] - [frontend.dicts.af :as af] - [frontend.dicts.es :as es] - [frontend.dicts.nb-no :as nb-NO] - [frontend.dicts.pt-br :as pt-BR] - [frontend.dicts.pt-pt :as pt-PT] - [frontend.dicts.ru :as ru] - [frontend.dicts.ja :as ja] - [frontend.dicts.it :as it] - [frontend.dicts.tr :as tr] - [frontend.dicts.ko :as ko] - [frontend.dicts.pl :as pl] - [frontend.dicts.sk :as sk] - [frontend.dicts.uk :as uk])) - -(def ^:large-vars/data-var dicts - {:en en/application - :de de/application - :nl nl/application - :fr fr/application - :zh-CN zh-CN/application - :zh-Hant zh-Hant/application - :af af/application - :es es/application - :nb-NO nb-NO/application - :pt-BR pt-BR/application - :pt-PT pt-PT/application - :ru ru/application - :ja ja/application - :it it/application - :tr tr/application - :ko ko/application - :pl pl/application - :sk sk/application - :uk uk/application}) - -(def languages [{:label "English" :value :en} - {:label "Français" :value :fr} - {:label "Deutsch" :value :de} - {:label "Dutch (Nederlands)" :value :nl} - {:label "简体中文" :value :zh-CN} - {:label "繁體中文" :value :zh-Hant} - {:label "Afrikaans" :value :af} - {:label "Español" :value :es} - {:label "Norsk (bokmål)" :value :nb-NO} - {:label "Polski" :value :pl} - {:label "Português (Brasileiro)" :value :pt-BR} - {:label "Português (Europeu)" :value :pt-PT} - {:label "Русский" :value :ru} - {:label "日本語" :value :ja} - {:label "Italiano" :value :it} - {:label "Türkçe" :value :tr} - {:label "Українська" :value :uk} - {:label "한국어" :value :ko} - {:label "Slovenčina" :value :sk}]) diff --git a/src/main/frontend/dicts/de.cljc b/src/main/frontend/dicts/de.cljc index adf3d1005c9..4106c0a6833 100644 --- a/src/main/frontend/dicts/de.cljc +++ b/src/main/frontend/dicts/de.cljc @@ -2,7 +2,7 @@ "Provides translation to DE" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:all-files "Alle Dateien" :all-graphs "Alle Graphen" :all-journals "Alle Journale" @@ -393,10 +393,9 @@ :select/default-select-multiple "Ein oder mehrere auswählen" :settings-page/auto-expand-block-refs "Automatisch beim Heranzoomen Blockreferenzen erweitern..." - :whiteboard/link-whiteboard-or-block "Whiteboard/Seite/Block verknüpfen"}) - -(def shortcuts - {:command.auto-complete/complete "Automatische Vervollständigung: Ausgewähltes Element auswählen" + :whiteboard/link-whiteboard-or-block "Whiteboard/Seite/Block verknüpfen" + + :command.auto-complete/complete "Automatische Vervollständigung: Ausgewähltes Element auswählen" :command.auto-complete/next "Automatische Vervollständigung: Nächstes Element auswählen" :command.auto-complete/open-link "Automatische Vervollständigung: Ausgewähltes Element im Browser öffnen" :command.auto-complete/prev "Automatische Vervollständigung: Vorheriges Element auswählen" @@ -531,4 +530,4 @@ :shortcut.category/formatting "Formatierung" :shortcut.category/navigating "Navigation" :shortcut.category/others "Sonstiges" - :shortcut.category/toggle "Umschalten"}) + :shortcut.category/toggle "Umschalten"}) \ No newline at end of file diff --git a/src/main/frontend/dicts/en.cljc b/src/main/frontend/dicts/en.cljc index 7a3304bcaa4..24b428e3bff 100644 --- a/src/main/frontend/dicts/en.cljc +++ b/src/main/frontend/dicts/en.cljc @@ -2,7 +2,7 @@ "Provides translation to EN" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:accessibility/skip-to-main-content "Skip to main content" :tutorial/text #?(:cljs (rc/inline "tutorial-en.md") :default "tutorial-en.md") @@ -373,160 +373,172 @@ :file-sync/graph-deleted "The current remote graph has been deleted" :file-sync/rsapi-cannot-upload-err "Unable to start synchronization, please check if the local time is correct." - :notification/clear-all "Clear all"}) + :notification/clear-all "Clear all" -(def shortcuts - {:date-picker/complete "Date picker: Choose selected day" - :date-picker/prev-day "Date picker: Select previous day" - :date-picker/next-day "Date picker: Select next day" - :date-picker/prev-week "Date picker: Select previous week" - :date-picker/next-week "Date picker: Select next week" - :pdf/previous-page "Pdf: Previous page of current pdf doc" - :pdf/next-page "Pdf: Next page of current pdf doc" - :pdf/close "Pdf: Close current pdf doc" - :pdf/find "Pdf: Search text of current pdf doc" - :auto-complete/complete "Auto-complete: Choose selected item" - :auto-complete/prev "Auto-complete: Select previous item" - :auto-complete/next "Auto-complete: Select next item" - :auto-complete/shift-complete "Auto-complete: Open selected item in sidebar" - :auto-complete/open-link "Auto-complete: Open selected item in browser" - :cards/toggle-answers "Cards: show/hide answers/clozes" - :cards/next-card "Cards: next card" - :cards/forgotten "Cards: forgotten" - :cards/remembered "Cards: remembered" - :cards/recall "Cards: take a while to recall" - :editor/escape-editing "Escape editing" - :editor/backspace "Backspace / Delete backwards" - :editor/delete "Delete / Delete forwards" - :editor/new-block "Create new block" - :editor/new-line "New line in current block" - :editor/new-whiteboard "New whiteboard" - :editor/follow-link "Follow link under cursor" - :editor/open-link-in-sidebar "Open link in sidebar" - :editor/bold "Bold" - :editor/italics "Italics" - :editor/highlight "Highlight" - :editor/strike-through "Strikethrough" - :editor/clear-block "Delete entire block content" - :editor/kill-line-before "Delete line before cursor position" - :editor/copy-embed "Copy a block embed pointing to the current block" - :editor/kill-line-after "Delete line after cursor position" - :editor/beginning-of-block "Move cursor to the beginning of a block" - :editor/end-of-block "Move cursor to the end of a block" - :editor/forward-word "Move cursor forward a word" - :editor/backward-word "Move cursor backward a word" - :editor/forward-kill-word "Delete a word forwards" - :editor/backward-kill-word "Delete a word backwards" - :editor/replace-block-reference-at-point "Replace block reference with its content at point" - :editor/paste-text-in-one-block-at-point "Paste text into one block at point" - :editor/insert-youtube-timestamp "Insert youtube timestamp" - :editor/cycle-todo "Rotate the TODO state of the current item" - :editor/up "Move cursor up / Select up" - :editor/down "Move cursor down / Select down" - :editor/left "Move cursor left / Open selected block at beginning" - :editor/right "Move cursor right / Open selected block at end" - :editor/select-up "Select content above" - :editor/select-down "Select content below" - :editor/move-block-up "Move block up" - :editor/move-block-down "Move block down" - :editor/open-edit "Edit selected block" - :editor/select-block-up "Select block above" - :editor/select-block-down "Select block below" - :editor/delete-selection "Delete selected blocks" - :editor/expand-block-children "Expand" - :editor/collapse-block-children "Collapse" - :editor/indent "Indent block" - :editor/outdent "Outdent block" - :editor/copy "Copy (copies either selection, or block reference)" - :editor/copy-text "Copy selections as text" - :editor/cut "Cut" - :editor/undo "Undo" - :editor/redo "Redo" - :editor/insert-link "HTML Link" - :editor/select-all-blocks "Select all blocks" - :editor/select-parent "Select parent block" - :editor/zoom-in "Zoom in editing block / Forwards otherwise" - :editor/zoom-out "Zoom out editing block / Backwards otherwise" - :editor/toggle-undo-redo-mode "Toggle undo redo mode (global or page only)" - :editor/toggle-number-list "Toggle number list" - :whiteboard/select "Select tool" - :whiteboard/pan "Pan tool" - :whiteboard/portal "Portal tool" - :whiteboard/pencil "Pencil tool" - :whiteboard/highlighter "Highlighter tool" - :whiteboard/eraser "Eraser tool" - :whiteboard/connector "Connector tool" - :whiteboard/text "Text tool" - :whiteboard/rectangle "Rectangle tool" - :whiteboard/ellipse "Ellipse tool" - :whiteboard/reset-zoom "Reset zoom" - :whiteboard/zoom-to-fit "Zoom to drawing" - :whiteboard/zoom-to-selection "Zoom to fit selection" - :whiteboard/zoom-out "Zoom out" - :whiteboard/zoom-in "Zoom in" - :whiteboard/send-backward "Move backward" - :whiteboard/send-to-back "Move to back" - :whiteboard/bring-forward "Move forward" - :whiteboard/bring-to-front "Move to front" - :whiteboard/lock "Lock selection" - :whiteboard/unlock "Unlock selection" - :whiteboard/group "Group selection" - :whiteboard/ungroup "Ungroup selection" - :whiteboard/toggle-grid "Toggle the canvas grid" - :ui/toggle-brackets "Toggle whether to display brackets" - :go/search-in-page "Search blocks in the current page" - :go/electron-find-in-page "Find text in page" - :go/electron-jump-to-the-next "Jump to the next match to your Find bar search" - :go/electron-jump-to-the-previous "Jump to the previous match to your Find bar search" - :go/search "Search pages and blocks" - :go/journals "Go to journals" - :go/backward "Backwards" - :go/forward "Forwards" - :search/re-index "Rebuild search index" - :sidebar/open-today-page "Open today's page in the right sidebar" - :sidebar/close-top "Closes the top item in the right sidebar" - :sidebar/clear "Clear all in the right sidebar" - :misc/copy "mod+c" - :command-palette/toggle "Toggle command palette" - :graph/export-as-html "Export public graph pages as html" - :graph/open "Select graph to open" - :graph/remove "Remove a graph" - :graph/add "Add a graph" - :graph/save "Save current graph to disk" - :graph/re-index "Re-index current graph" - :command/run "Run git command" - :go/home "Go to home" - :go/all-graphs "Go to all graphs" - :go/whiteboards "Go to whiteboards" - :go/all-pages "Go to all pages" - :go/graph-view "Go to graph view" - :go/keyboard-shortcuts "Go to keyboard shortcuts" - :go/tomorrow "Go to tomorrow" - :go/next-journal "Go to next journal" - :go/prev-journal "Go to previous journal" - :go/flashcards "Toggle flashcards" - :ui/toggle-document-mode "Toggle document mode" - :ui/toggle-settings "Toggle settings" - :ui/toggle-right-sidebar "Toggle right sidebar" - :ui/toggle-left-sidebar "Toggle left sidebar" - :ui/toggle-help "Toggle help" - :ui/toggle-theme "Toggle between dark/light theme" - :ui/toggle-contents "Toggle Contents in sidebar" + :shortcut.category/basics "Basics" + :shortcut.category/formatting "Formatting" + :shortcut.category/navigating "Navigation" + :shortcut.category/block-editing "Block editing general" + :shortcut.category/block-command-editing "Block command editing" + :shortcut.category/block-selection "Block selection (press Esc to quit selection)" + :shortcut.category/toggle "Toggle" + :shortcut.category/whiteboard "Whiteboard" + :shortcut.category/others "Others" + + ;; Commands are nested for now to stay in sync with the shortcuts system. + ;; Other languages should not nest keys under :commands + :commands + {:date-picker/complete "Date picker: Choose selected day" + :date-picker/prev-day "Date picker: Select previous day" + :date-picker/next-day "Date picker: Select next day" + :date-picker/prev-week "Date picker: Select previous week" + :date-picker/next-week "Date picker: Select next week" + :pdf/previous-page "Pdf: Previous page of current pdf doc" + :pdf/next-page "Pdf: Next page of current pdf doc" + :pdf/close "Pdf: Close current pdf doc" + :pdf/find "Pdf: Search text of current pdf doc" + :auto-complete/complete "Auto-complete: Choose selected item" + :auto-complete/prev "Auto-complete: Select previous item" + :auto-complete/next "Auto-complete: Select next item" + :auto-complete/shift-complete "Auto-complete: Open selected item in sidebar" + :auto-complete/open-link "Auto-complete: Open selected item in browser" + :cards/toggle-answers "Cards: show/hide answers/clozes" + :cards/next-card "Cards: next card" + :cards/forgotten "Cards: forgotten" + :cards/remembered "Cards: remembered" + :cards/recall "Cards: take a while to recall" + :editor/escape-editing "Escape editing" + :editor/backspace "Backspace / Delete backwards" + :editor/delete "Delete / Delete forwards" + :editor/new-block "Create new block" + :editor/new-line "New line in current block" + :editor/new-whiteboard "New whiteboard" + :editor/follow-link "Follow link under cursor" + :editor/open-link-in-sidebar "Open link in sidebar" + :editor/bold "Bold" + :editor/italics "Italics" + :editor/highlight "Highlight" + :editor/strike-through "Strikethrough" + :editor/clear-block "Delete entire block content" + :editor/kill-line-before "Delete line before cursor position" + :editor/copy-embed "Copy a block embed pointing to the current block" + :editor/kill-line-after "Delete line after cursor position" + :editor/beginning-of-block "Move cursor to the beginning of a block" + :editor/end-of-block "Move cursor to the end of a block" + :editor/forward-word "Move cursor forward a word" + :editor/backward-word "Move cursor backward a word" + :editor/forward-kill-word "Delete a word forwards" + :editor/backward-kill-word "Delete a word backwards" + :editor/replace-block-reference-at-point "Replace block reference with its content at point" + :editor/paste-text-in-one-block-at-point "Paste text into one block at point" + :editor/insert-youtube-timestamp "Insert youtube timestamp" + :editor/cycle-todo "Rotate the TODO state of the current item" + :editor/up "Move cursor up / Select up" + :editor/down "Move cursor down / Select down" + :editor/left "Move cursor left / Open selected block at beginning" + :editor/right "Move cursor right / Open selected block at end" + :editor/select-up "Select content above" + :editor/select-down "Select content below" + :editor/move-block-up "Move block up" + :editor/move-block-down "Move block down" + :editor/open-edit "Edit selected block" + :editor/select-block-up "Select block above" + :editor/select-block-down "Select block below" + :editor/delete-selection "Delete selected blocks" + :editor/expand-block-children "Expand" + :editor/collapse-block-children "Collapse" + :editor/indent "Indent block" + :editor/outdent "Outdent block" + :editor/copy "Copy (copies either selection, or block reference)" + :editor/copy-text "Copy selections as text" + :editor/cut "Cut" + :editor/undo "Undo" + :editor/redo "Redo" + :editor/insert-link "HTML Link" + :editor/select-all-blocks "Select all blocks" + :editor/select-parent "Select parent block" + :editor/zoom-in "Zoom in editing block / Forwards otherwise" + :editor/zoom-out "Zoom out editing block / Backwards otherwise" + :editor/toggle-undo-redo-mode "Toggle undo redo mode (global or page only)" + :editor/toggle-number-list "Toggle number list" + :whiteboard/select "Select tool" + :whiteboard/pan "Pan tool" + :whiteboard/portal "Portal tool" + :whiteboard/pencil "Pencil tool" + :whiteboard/highlighter "Highlighter tool" + :whiteboard/eraser "Eraser tool" + :whiteboard/connector "Connector tool" + :whiteboard/text "Text tool" + :whiteboard/rectangle "Rectangle tool" + :whiteboard/ellipse "Ellipse tool" + :whiteboard/reset-zoom "Reset zoom" + :whiteboard/zoom-to-fit "Zoom to drawing" + :whiteboard/zoom-to-selection "Zoom to fit selection" + :whiteboard/zoom-out "Zoom out" + :whiteboard/zoom-in "Zoom in" + :whiteboard/send-backward "Move backward" + :whiteboard/send-to-back "Move to back" + :whiteboard/bring-forward "Move forward" + :whiteboard/bring-to-front "Move to front" + :whiteboard/lock "Lock selection" + :whiteboard/unlock "Unlock selection" + :whiteboard/group "Group selection" + :whiteboard/ungroup "Ungroup selection" + :whiteboard/toggle-grid "Toggle the canvas grid" + :ui/toggle-brackets "Toggle whether to display brackets" + :go/search-in-page "Search blocks in the current page" + :go/electron-find-in-page "Find text in page" + :go/electron-jump-to-the-next "Jump to the next match to your Find bar search" + :go/electron-jump-to-the-previous "Jump to the previous match to your Find bar search" + :go/search "Search pages and blocks" + :go/journals "Go to journals" + :go/backward "Backwards" + :go/forward "Forwards" + :search/re-index "Rebuild search index" + :sidebar/open-today-page "Open today's page in the right sidebar" + :sidebar/close-top "Closes the top item in the right sidebar" + :sidebar/clear "Clear all in the right sidebar" + :misc/copy "mod+c" + :command-palette/toggle "Toggle command palette" + :graph/export-as-html "Export public graph pages as html" + :graph/open "Select graph to open" + :graph/remove "Remove a graph" + :graph/add "Add a graph" + :graph/save "Save current graph to disk" + :graph/re-index "Re-index current graph" + :command/run "Run git command" + :go/home "Go to home" + :go/all-graphs "Go to all graphs" + :go/whiteboards "Go to whiteboards" + :go/all-pages "Go to all pages" + :go/graph-view "Go to graph view" + :go/keyboard-shortcuts "Go to keyboard shortcuts" + :go/tomorrow "Go to tomorrow" + :go/next-journal "Go to next journal" + :go/prev-journal "Go to previous journal" + :go/flashcards "Toggle flashcards" + :ui/toggle-document-mode "Toggle document mode" + :ui/toggle-settings "Toggle settings" + :ui/toggle-right-sidebar "Toggle right sidebar" + :ui/toggle-left-sidebar "Toggle left sidebar" + :ui/toggle-help "Toggle help" + :ui/toggle-theme "Toggle between dark/light theme" + :ui/toggle-contents "Toggle Contents in sidebar" ;; :ui/open-new-window "Open another window" - :command/toggle-favorite "Add to/remove from favorites" - :editor/open-file-in-default-app "Open file in default app" - :editor/open-file-in-directory "Open file in parent directory" - :editor/copy-current-file "Copy current file" - :editor/copy-page-url "Copy page url" - :ui/toggle-wide-mode "Toggle wide mode" - :ui/select-theme-color "Select available theme colors" - :ui/goto-plugins "Go to plugins dashboard" - :ui/install-plugins-from-file "Install plugins from plugins.edn" - :editor/toggle-open-blocks "Toggle open blocks (collapse or expand all blocks)" - :ui/toggle-cards "Toggle cards" - :ui/clear-all-notifications "Clear all notifications" - :git/commit "Create git commit with message" - :dev/show-block-data "(Dev) Show block data" - :dev/show-block-ast "(Dev) Show block AST" - :dev/show-page-data "(Dev) Show page data" - :dev/show-page-ast "(Dev) Show page AST"}) + :command/toggle-favorite "Add to/remove from favorites" + :editor/open-file-in-default-app "Open file in default app" + :editor/open-file-in-directory "Open file in parent directory" + :editor/copy-current-file "Copy current file" + :editor/copy-page-url "Copy page url" + :ui/toggle-wide-mode "Toggle wide mode" + :ui/select-theme-color "Select available theme colors" + :ui/goto-plugins "Go to plugins dashboard" + :ui/install-plugins-from-file "Install plugins from plugins.edn" + :editor/toggle-open-blocks "Toggle open blocks (collapse or expand all blocks)" + :ui/toggle-cards "Toggle cards" + :ui/clear-all-notifications "Clear all notifications" + :git/commit "Create git commit with message" + :dev/show-block-data "(Dev) Show block data" + :dev/show-block-ast "(Dev) Show block AST" + :dev/show-page-data "(Dev) Show page data" + :dev/show-page-ast "(Dev) Show page AST"}}) \ No newline at end of file diff --git a/src/main/frontend/dicts/es.cljc b/src/main/frontend/dicts/es.cljc index b1d46751cdf..4ae0d72bf94 100644 --- a/src/main/frontend/dicts/es.cljc +++ b/src/main/frontend/dicts/es.cljc @@ -2,7 +2,7 @@ "Provides translation to ES" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:tutorial/text #?(:cljs (rc/inline "tutorial-es.md") :default "tutorial-es.md") :tutorial/dummy-notes #?(:cljs (rc/inline "dummy-notes-es.md") @@ -360,10 +360,9 @@ :settings-page/sync "Sincronizar" :settings-page/tab-assets "Recursos" :settings-page/tab-features "Características" - :whiteboard/link-whiteboard-or-block "Enlazar pizarra/página/bloque"}) - -(def shortcuts - {:shortcut.category/formatting "Formato" + :whiteboard/link-whiteboard-or-block "Enlazar pizarra/página/bloque" + + :shortcut.category/formatting "Formato" :shortcut.category/basics "Básico" :shortcut.category/navigating "Navegación" :shortcut.category/block-editing "Edición de bloque general" @@ -498,4 +497,4 @@ :command.ui/install-plugins-from-file "Instalar extensiones de plugins.edn" :command.ui/select-theme-color "Seleccionar temas de colores disponibles" :command.ui/toggle-cards "Alternar tarjetas" - :command.ui/toggle-left-sidebar "Alternar barra lateral izquierda"}) + :command.ui/toggle-left-sidebar "Alternar barra lateral izquierda"}) \ No newline at end of file diff --git a/src/main/frontend/dicts/fr.cljc b/src/main/frontend/dicts/fr.cljc index b47c44bad1d..de1dddd64b9 100644 --- a/src/main/frontend/dicts/fr.cljc +++ b/src/main/frontend/dicts/fr.cljc @@ -2,7 +2,7 @@ "Provides translation to FR" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:tutorial/text #?(:cljs (rc/inline "tutorial-fr.md") :default "tutorial-fr.md") :tutorial/dummy-notes #?(:cljs (rc/inline "dummy-notes-fr.md") @@ -330,10 +330,9 @@ :on-boarding/welcome-whiteboard-modal-start "Démarrer le tableau blanc" :on-boarding/welcome-whiteboard-modal-title "Un nouveau cadre pour vos pensées." :settings-page/clear-cache-warning "Vider le cache supprimera les graphiques ouverts. Vous perdrez les modifications non enregistrées." - :settings-page/disable-sentry-desc "Logseq ne collectera jamais votre base de données de graphes locale ni ne vendra vos données."}) + :settings-page/disable-sentry-desc "Logseq ne collectera jamais votre base de données de graphes locale ni ne vendra vos données." -(def shortcuts - {:shortcut.category/formatting "Formats" + :shortcut.category/formatting "Formats" :command.editor/indent "Indenter un Bloc vers la droite" :command.editor/outdent "Indenter un Bloc vers la gauche" :command.editor/move-block-up "Déplacer un bloc au dessus" @@ -461,4 +460,4 @@ :shortcut.category/others "Autres" :shortcut.category/toggle "Basculer" :command.editor/select-parent "Sélectionnez le bloc parent" - :command.sidebar/close-top "Ferme l'élément supérieur dans la barre latérale droite"}) + :command.sidebar/close-top "Ferme l'élément supérieur dans la barre latérale droite"}) \ No newline at end of file diff --git a/src/main/frontend/dicts/it.cljc b/src/main/frontend/dicts/it.cljc index 8a029fbbda1..468e9cf19b9 100644 --- a/src/main/frontend/dicts/it.cljc +++ b/src/main/frontend/dicts/it.cljc @@ -2,7 +2,7 @@ "Provides translation to IT" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:tutorial/text #?(:cljs (rc/inline "tutorial-en.md") :default "tutorial-en.md") :tutorial/dummy-notes #?(:cljs (rc/inline "dummy-notes-en.md") @@ -246,10 +246,9 @@ :file-sync/graph-deleted "Il grafo attuale è stato eliminato" :settings-page/edit-export-css "Modificare export.css" :settings-page/enable-flashcards "Flashcard" - :settings-page/export-theme "Esporta tema"}) + :settings-page/export-theme "Esporta tema" -(def shortcuts - {:command.date-picker/complete "Selettore data: scegli il giorno selezionato" + :command.date-picker/complete "Selettore data: scegli il giorno selezionato" :command.date-picker/prev-day "Selettore data: Seleziona il giorno precedente" :command.date-picker/next-day "Selettore data: Seleziona il giorno successivo" :command.date-picker/prev-week "Selettore data: Seleziona la settimana precedente" @@ -366,4 +365,4 @@ :shortcut.category/others "Altri" :command.editor/copy-embed "Copia un incorporamento di blocco che punta al blocco corrente" :command.editor/copy-text "Copia le selezioni come testo" - :command.pdf/close "Chiudi anteprima PDF"}) + :command.pdf/close "Chiudi anteprima PDF"}) \ No newline at end of file diff --git a/src/main/frontend/dicts/ja.cljc b/src/main/frontend/dicts/ja.cljc index fff379ddb67..da8330e4661 100644 --- a/src/main/frontend/dicts/ja.cljc +++ b/src/main/frontend/dicts/ja.cljc @@ -2,7 +2,7 @@ "Provides translation to JA" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:tutorial/text #?(:cljs (rc/inline "tutorial-ja.md") :default "tutorial-ja.md") :tutorial/dummy-notes #?(:cljs (rc/inline "dummy-notes-ja.md") @@ -253,10 +253,9 @@ :select.graph/add-graph "はい、新規グラフを追加します。" :file-sync/other-user-graph "現在のローカルグラフは他のユーザーのリモートグラフにバインドされています。同期を開始できません。" - :file-sync/graph-deleted "現在のリモートグラフが削除されました"}) + :file-sync/graph-deleted "現在のリモートグラフが削除されました" -(def shortcuts - {:shortcut.category/formatting "フォーマット" + :shortcut.category/formatting "フォーマット" :shortcut.category/basics "基本操作" :shortcut.category/navigating "ナビゲーション" :shortcut.category/block-editing "ブロック単位の編集" @@ -383,4 +382,4 @@ :command.editor/strike-through "打ち消し線" :command.misc/copy "コピー" :command.ui/goto-plugins "プラグインへ" - :command.ui/select-theme-color "利用可能なテーマ色を選択"}) + :command.ui/select-theme-color "利用可能なテーマ色を選択"}) \ No newline at end of file diff --git a/src/main/frontend/dicts/ko.cljc b/src/main/frontend/dicts/ko.cljc index a2dc326a524..45641b52948 100644 --- a/src/main/frontend/dicts/ko.cljc +++ b/src/main/frontend/dicts/ko.cljc @@ -2,7 +2,7 @@ "Provides translation to KO" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:tutorial/text #?(:cljs (rc/inline "tutorial-ko.md") :default "tutorial-ko.md") :tutorial/dummy-notes #?(:cljs (rc/inline "dummy-notes-ko.md") @@ -339,10 +339,9 @@ :settings-page/sync "동기화" :settings-page/tab-assets "에셋" :settings-page/tab-features "기능" - :whiteboard/link-whiteboard-or-block "화이트보드/페이지/블록 연결"}) + :whiteboard/link-whiteboard-or-block "화이트보드/페이지/블록 연결" -(def shortcuts - {:shortcut.category/formatting "포맷" + :shortcut.category/formatting "포맷" :shortcut.category/basics "기본 동작" :shortcut.category/navigating "내비게이션" :shortcut.category/block-editing "블록 편집" @@ -476,4 +475,4 @@ :command.pdf/find "PDF: 현재 PDF 문서에서 검색" :command.sidebar/close-top "우축 사이드바의 최상단 항목 닫기" :command.ui/clear-all-notifications "모든 알람 제거" - :command.ui/install-plugins-from-file "plugins.edn에서 플러그인 설치"}) + :command.ui/install-plugins-from-file "plugins.edn에서 플러그인 설치"}) \ No newline at end of file diff --git a/src/main/frontend/dicts/nb_no.cljc b/src/main/frontend/dicts/nb_no.cljc index 09d785f58d1..0548f75922f 100644 --- a/src/main/frontend/dicts/nb_no.cljc +++ b/src/main/frontend/dicts/nb_no.cljc @@ -2,7 +2,7 @@ "Provides translation to nb-NO" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:tutorial/text #?(:cljs (rc/inline "tutorial-no.md") :default "tutorial-no.md") :tutorial/dummy-notes #?(:cljs (rc/inline "dummy-notes-no.md") @@ -369,10 +369,9 @@ :settings-page/preferred-pasting-file "Foretrekk innliming av fil" :settings-page/show-full-blocks "Vis alle linjer av en blokkreferanse" :settings-page/tab-assets "Ressurser" - :whiteboard/link-whiteboard-or-block "Lenk whiteboard/side/blokk"}) + :whiteboard/link-whiteboard-or-block "Lenk whiteboard/side/blokk" -(def shortcuts - {:shortcut.category/formatting "Formatering" + :shortcut.category/formatting "Formatering" :shortcut.category/basics "Basis" :shortcut.category/navigating "Navigasjon" :shortcut.category/block-editing "Blokkredigering generelt" @@ -534,4 +533,4 @@ :command.whiteboard/zoom-out "Zoom ut" :command.whiteboard/zoom-to-fit "Zoom til tegning" :command.whiteboard/zoom-to-selection "Zoom for å passe seleksjonen" - :shortcut.category/whiteboard "Whiteboard"}) + :shortcut.category/whiteboard "Whiteboard"}) \ No newline at end of file diff --git a/src/main/frontend/dicts/nl.cljc b/src/main/frontend/dicts/nl.cljc index d8bf9c1de12..d4bbdeeee38 100644 --- a/src/main/frontend/dicts/nl.cljc +++ b/src/main/frontend/dicts/nl.cljc @@ -2,7 +2,7 @@ "Provides translation to NL" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:all-files "Alle bestanden" :all-graphs "Alle grafieken" :all-journals "Alle Journalen" @@ -262,10 +262,9 @@ :default "tutorial-en.md") :updater/new-version-install "Een nieuwe versie is gedownload." - :updater/quit-and-install "Herstart om te installeren"}) + :updater/quit-and-install "Herstart om te installeren" -(def shortcuts - {:command.auto-complete/complete "Automatisch aanvullen: Kies geselecteerd item" + :command.auto-complete/complete "Automatisch aanvullen: Kies geselecteerd item" :command.auto-complete/next "Automatisch aanvullen: Selecteer volgend item" :command.auto-complete/open-link "Automatisch aanvullen: Open geselecteerd item in browser" :command.auto-complete/prev "Automatisch aanvullen: Selecteer vorig item" @@ -382,4 +381,4 @@ :shortcut.category/formatting "Formatteren" :shortcut.category/navigating "Navigatie" :shortcut.category/others "Anderen" - :shortcut.category/toggle "Toggle"}) + :shortcut.category/toggle "Toggle"}) \ No newline at end of file diff --git a/src/main/frontend/dicts/pl.cljc b/src/main/frontend/dicts/pl.cljc index 3271bbebb46..a2e1c3d23be 100644 --- a/src/main/frontend/dicts/pl.cljc +++ b/src/main/frontend/dicts/pl.cljc @@ -2,7 +2,7 @@ "Provides translation to PL" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:tutorial/text #?(:cljs (rc/inline "tutorial-pl.md") :default "tutorial-pl.md") :tutorial/dummy-notes #?(:cljs (rc/inline "dummy-notes-pl.md") @@ -246,10 +246,9 @@ :select.graph/add-graph "Tak, dodaj nowy graf" :file-sync/other-user-graph "Obecny lokalny graf jest przypisany do zdalnego grafu innego użytkownika. Nie można rozpocząć synchronizacji." - :file-sync/graph-deleted "Obecny zdalny graf został usunięty"}) + :file-sync/graph-deleted "Obecny zdalny graf został usunięty" -(def shortcuts - {:shortcut.category/basics "Podstawy" + :shortcut.category/basics "Podstawy" :shortcut.category/formatting "Formatowanie" :shortcut.category/navigating "Nawigacja" :shortcut.category/block-editing "Edycja bloków (ogólne)" @@ -367,4 +366,4 @@ :command.ui/select-theme-color "Select available theme colors" :command.ui/goto-plugins "Przejdź do dashboardu pluginów" :command.ui/toggle-cards "Pokaż / Ukryj karty" - :command.git/commit "Wykonaj GIT COMMIT z wiadomością"}) + :command.git/commit "Wykonaj GIT COMMIT z wiadomością"}) \ No newline at end of file diff --git a/src/main/frontend/dicts/pt_br.cljc b/src/main/frontend/dicts/pt_br.cljc index 9f8984ce85e..cd8dcd3bf44 100644 --- a/src/main/frontend/dicts/pt_br.cljc +++ b/src/main/frontend/dicts/pt_br.cljc @@ -2,7 +2,7 @@ "Provides translation to pt-BR" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:on-boarding/demo-graph "Esse é um grafo de demonstração, mudanças não serão salvas enquanto uma pasta local não for aberta." :on-boarding/add-graph "Adicionar grafo" :on-boarding/open-local-dir "Abrir pasta local" @@ -29,7 +29,6 @@ :help/block-content-autocomplete "Auto-completar conteúdo de bloco (Src, Quote, Query, etc)" :help/reference-autocomplete "Auto-completar referência de páginas" :help/block-reference "Referência de bloco" - :command.editor/open-link-in-sidebar "Abrir ligação na barra lateral" :more "Mais" :search/result-for "Resultado da pesquisa para " :help/context-menu "Menu contextual" @@ -335,10 +334,9 @@ :settings-page/login-prompt "Para acessar novos recursos antes de qualquer outra pessoa, você deve ser um Patrocinador Coletivo Aberto ou Apoiador do Logseq e, portanto, fazer o login primeiro." :settings-page/preferred-pasting-file "Arquivo preferência para colar" :settings-page/tab-assets "Recursos" - :whiteboard/link-whiteboard-or-block "Vincular quadro branco/página/bloco"}) + :whiteboard/link-whiteboard-or-block "Vincular quadro branco/página/bloco" -(def shortcuts - {:shortcut.category/formatting "Formatação" + :shortcut.category/formatting "Formatação" :shortcut.category/basics "Básico" :shortcut.category/navigating "Navegação" :shortcut.category/block-editing "Edição geral de blocos" diff --git a/src/main/frontend/dicts/pt_pt.cljc b/src/main/frontend/dicts/pt_pt.cljc index 90782bd37a0..0190b1830c1 100644 --- a/src/main/frontend/dicts/pt_pt.cljc +++ b/src/main/frontend/dicts/pt_pt.cljc @@ -2,7 +2,7 @@ "Provides translation to pt-PT" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:accessibility/skip-to-main-content "Ir para o conteúdo principal" :tutorial/text #?(:cljs (rc/inline "tutorial-en.md") :default "tutorial-en.md") @@ -348,10 +348,9 @@ :file-sync/graph-deleted "O grafo remoto atual foi apagado" :file-sync/rsapi-cannot-upload-err "Não foi possível iniciar a sincronização, verifique se a hora local está correta." - :notification/clear-all "Limpar tudo"}) - -(def shortcuts - {:shortcut.category/formatting "Formatação" + :notification/clear-all "Limpar tudo" + + :shortcut.category/formatting "Formatação" :shortcut.category/basics "Básico" :shortcut.category/navigating "Navegação" :shortcut.category/block-editing "Edição geral de blocos" @@ -480,4 +479,4 @@ :command.graph/export-as-html "Exportar páginas de gráficos públicos como html" :command.pdf/find "PDF: Pesquisar no documento PDF atual" :command.sidebar/close-top "Fechar item superior na barra lateral direita" - :command.ui/install-plugins-from-file "Instalar plugins de plugins.edn"}) + :command.ui/install-plugins-from-file "Instalar plugins de plugins.edn"}) \ No newline at end of file diff --git a/src/main/frontend/dicts/ru.cljc b/src/main/frontend/dicts/ru.cljc index b82032c766c..b61c51833d5 100644 --- a/src/main/frontend/dicts/ru.cljc +++ b/src/main/frontend/dicts/ru.cljc @@ -2,7 +2,7 @@ "Provides translation to RU" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:accessibility/skip-to-main-content "Перейти к основному содержимому" :tutorial/text #?(:cljs (rc/inline "tutorial-ru.md") :default "tutorial-ru.md") @@ -346,10 +346,9 @@ :file-sync/other-user-graph "Текущий локальный граф привязан к удаленному графу другого пользователя. Поэтому синхронизацию начать нельзя." :file-sync/graph-deleted "Текущий удаленный граф был удален" - :notification/clear-all "Очистить всё"}) - -(def shortcuts - {:shortcut.category/basics "Базовые" + :notification/clear-all "Очистить всё" + + :shortcut.category/basics "Базовые" :shortcut.category/formatting "Форматирование" :shortcut.category/navigating "Навигация" :shortcut.category/block-editing "Общее редактирование блока" @@ -484,4 +483,4 @@ :command.dev/show-block-data "(Dev) Показать данные блока" :command.dev/show-block-ast "(Dev) Показать AST блока" :command.dev/show-page-data "(Dev) Показать данные страницы" - :command.dev/show-page-ast "(Dev) Показать AST страницы"}) + :command.dev/show-page-ast "(Dev) Показать AST страницы"}) \ No newline at end of file diff --git a/src/main/frontend/dicts/sk.cljc b/src/main/frontend/dicts/sk.cljc index ab3e998612c..1561b04a42d 100644 --- a/src/main/frontend/dicts/sk.cljc +++ b/src/main/frontend/dicts/sk.cljc @@ -2,7 +2,7 @@ "Provides translation to SK" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:accessibility/skip-to-main-content "Preskočiť na hlavný obsah" :tutorial/text #?(:cljs (rc/inline "tutorial-sk.md") :default "tutorial-sk.md") @@ -330,10 +330,9 @@ :file-sync/other-user-graph "Aktuálny lokálny graf je prepojený so vzdialeným grafom iného používateľa. Nie je možné spustiť synchronizáciu.." :file-sync/graph-deleted "Aktuálny vzdialený graf bol odstránený." - :notification/clear-all "Zmazať všetko"}) + :notification/clear-all "Zmazať všetko" -(def shortcuts - {:shortcut.category/formatting "Formátovanie" + :shortcut.category/formatting "Formátovanie" :shortcut.category/basics "Základy" :shortcut.category/navigating "Navigácia" :shortcut.category/block-editing "Úprava bloku (všeobecné)" @@ -462,4 +461,4 @@ :command.ui/install-plugins-from-file "Inštalovať doplnky z plugins.edn" :command.editor/toggle-open-blocks "Prepnúť otvorené bloky (zbaliť alebo rozbaliť všetky bloky)" :command.ui/toggle-cards "Zobraziť/Skryť karty" - :command.git/commit "Spusiť príkaz git commit so správou"}) + :command.git/commit "Spusiť príkaz git commit so správou"}) \ No newline at end of file diff --git a/src/main/frontend/dicts/tr.cljc b/src/main/frontend/dicts/tr.cljc index 67656258a00..50a355effe7 100644 --- a/src/main/frontend/dicts/tr.cljc +++ b/src/main/frontend/dicts/tr.cljc @@ -2,7 +2,7 @@ "Provides translation to TR" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:accessibility/skip-to-main-content "Ana içeriğe geç" :tutorial/text #?(:cljs (rc/inline "tutorial-tr.md") :default "tutorial-tr.md") @@ -371,10 +371,9 @@ :file-sync/other-user-graph "Geçerli yerel graf, diğer kullanıcının uzak grafına bağlıdır. Bu yüzden senkronizasyon başlatılamıyor." :file-sync/graph-deleted "Geçerli uzak graf silindi" - :notification/clear-all "Tümünü temizle"}) + :notification/clear-all "Tümünü temizle" -(def shortcuts - {:shortcut.category/basics "Temel bilgiler" + :shortcut.category/basics "Temel bilgiler" :shortcut.category/formatting "Biçimlendirme" :shortcut.category/navigating "Gezinme" :shortcut.category/block-editing "Genel blok düzenleme" @@ -536,4 +535,4 @@ :command.dev/show-block-data "(Dev) Blok verilerini göster" :command.dev/show-block-ast "(Dev) Blok AST'sini göster" :command.dev/show-page-data "(Dev) Sayfa verilerini göster" - :command.dev/show-page-ast "(Dev) Sayfa AST'sini göster"}) + :command.dev/show-page-ast "(Dev) Sayfa AST'sini göster"}) \ No newline at end of file diff --git a/src/main/frontend/dicts/uk.cljc b/src/main/frontend/dicts/uk.cljc index d80eb1f753c..7b2fe411999 100644 --- a/src/main/frontend/dicts/uk.cljc +++ b/src/main/frontend/dicts/uk.cljc @@ -2,7 +2,7 @@ "Provides translation to UK" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:accessibility/skip-to-main-content "Перейти до головної" :tutorial/text #?(:cljs (rc/inline "tutorial-uk.md") :default "tutorial-uk.md") @@ -346,10 +346,9 @@ :file-sync/other-user-graph "Поточний локальний графік зв'язаний з графіком іншого користувача. Тому неможливо почати синхронізацію." :file-sync/graph-deleted "Поточний дистанційний графік був видалений" - :notification/clear-all "Очистити все"}) + :notification/clear-all "Очистити все" -(def shortcuts - {:shortcut.category/formatting "Форматування" + :shortcut.category/formatting "Форматування" :shortcut.category/basics "Основи" :shortcut.category/navigating "Навігація" :shortcut.category/block-editing "Загальне редагування блоку" @@ -484,4 +483,4 @@ :command.dev/show-block-ast "(Dev) Показати блок AST" :command.dev/show-block-data "(Dev) Показати дані блоку" :command.dev/show-page-ast "(Dev) Показати сторінку AST" - :command.dev/show-page-data "(Dev) Показати дані сторінки"}) + :command.dev/show-page-data "(Dev) Показати дані сторінки"}) \ No newline at end of file diff --git a/src/main/frontend/dicts/zh_cn.cljc b/src/main/frontend/dicts/zh_cn.cljc index b7eadd0dd33..2c409148e67 100644 --- a/src/main/frontend/dicts/zh_cn.cljc +++ b/src/main/frontend/dicts/zh_cn.cljc @@ -2,7 +2,7 @@ "Provides translation to zh-CN" #?(:cljs (:require [shadow.resource :as rc]))) -(def application +(def ^:large-vars/data-var dicts {:accessibility/skip-to-main-content "跳转到主内容" :on-boarding/demo-graph "这是一份图谱的示例,在上面做的修改不会被保存,除非打开本地文件夹" :on-boarding/add-graph "添加图谱" @@ -331,10 +331,9 @@ :file-sync/graph-deleted "当前远程图谱已经删除" :file-sync/rsapi-cannot-upload-err "无法同步,请检查本机时间是否准确" - :notification/clear-all "清除全部通知"}) + :notification/clear-all "清除全部通知" -(def shortcuts - {:shortcut.category/formatting "格式化" + :shortcut.category/formatting "格式化" :shortcut.category/basics "基础操作" :shortcut.category/navigating "移动" :shortcut.category/block-editing "块编辑基本" @@ -459,4 +458,4 @@ :command.editor/backward-kill-word "向前删除一个单词" :command.editor/open-edit "编辑选中块" :command.editor/delete-selection "删除选中块" - :command.editor/toggle-open-blocks "切换折叠/展开所有块(非编辑状态)"}) + :command.editor/toggle-open-blocks "切换折叠/展开所有块(非编辑状态)"}) \ No newline at end of file diff --git a/src/main/frontend/dicts/zh_hant.cljc b/src/main/frontend/dicts/zh_hant.cljc index 3aa1deed04b..5b73303c4a7 100644 --- a/src/main/frontend/dicts/zh_hant.cljc +++ b/src/main/frontend/dicts/zh_hant.cljc @@ -1,7 +1,7 @@ (ns frontend.dicts.zh-hant "Provides translation to zh-Hant") -(def application +(def ^:large-vars/data-var dicts {:accessibility/skip-to-main-content "跳轉到主頁面" :on-boarding/demo-graph "目前在 demo 用圖表,您需要打開本機目錄以保存。" :on-boarding/add-graph "增加圖表" @@ -339,10 +339,9 @@ :file-sync/other-user-graph "目前的圖表正在和其他遠端使用者共用,因此無法同步。" :file-sync/graph-deleted "目前的遠端圖表已經被刪除" - :notification/clear-all "清除所有通知"}) + :notification/clear-all "清除所有通知" -(def shortcuts - {:command.editor/indent "縮進塊標簽" + :command.editor/indent "縮進塊標簽" :command.editor/outdent "取消縮進塊" :command.editor/move-block-up "向上移動塊" :command.editor/move-block-down "向下移動塊" @@ -363,4 +362,4 @@ :command.ui/toggle-document-mode "切換文檔模式" :command.ui/toggle-theme "“在暗色/亮色主題之間切換”" :command.ui/toggle-right-sidebar "啟用/關閉右側欄" - :command.go/journals "跳轉到日記"}) + :command.go/journals "跳轉到日記"}) \ No newline at end of file diff --git a/src/main/frontend/modules/shortcut/config.cljs b/src/main/frontend/modules/shortcut/config.cljs index 5698541e4c6..b94820d23d8 100644 --- a/src/main/frontend/modules/shortcut/config.cljs +++ b/src/main/frontend/modules/shortcut/config.cljs @@ -16,8 +16,7 @@ [frontend.handler.whiteboard :as whiteboard-handler] [frontend.handler.plugin-config :as plugin-config-handler] [frontend.modules.editor.undo-redo :as undo-redo] - [frontend.modules.shortcut.dicts :as dicts] - [frontend.dicts.en :as en] + [frontend.dicts :as dicts] [frontend.modules.shortcut.before :as m] [frontend.state :as state] [frontend.util :refer [mac?] :as util] @@ -34,7 +33,7 @@ ;; with other config keys ;; To add a new entry to this map, first add it here and then a description for -;; it in frontend.modules.shortcut.dicts/all-default-keyboard-shortcuts. +;; it under :commands keys of frontend.dicts.en/dicts ;; A shortcut is a map with the following keys: ;; * :binding - A string representing a keybinding. Avoid using single letter ;; shortcuts to allow chords that start with those characters @@ -331,7 +330,8 @@ :editor/zoom-out {:binding (if mac? "mod+," "alt+left") :fn editor-handler/zoom-out!} - :editor/toggle-undo-redo-mode {:fn undo-redo/toggle-undo-redo-mode!} + :editor/toggle-undo-redo-mode {:binding false + :fn undo-redo/toggle-undo-redo-mode!} :editor/toggle-number-list {:binding "t n" :fn #(state/pub-event! [:editor/toggle-own-number-list (state/get-selection-block-ids)])} @@ -539,12 +539,12 @@ :inactive (not (state/developer-mode?)) :fn :frontend.handler.common.developer/show-page-ast}}) -(let [keyboard-shortcuts - {::keyboard-shortcuts (set (keys all-default-keyboard-shortcuts)) - ::en/shortcuts (set (keys en/shortcuts))}] - (assert (= (::keyboard-shortcuts keyboard-shortcuts) (::en/shortcuts keyboard-shortcuts)) - (str "Keys for keyboard shortcuts must be the same " - (data/diff (::keyboard-shortcuts keyboard-shortcuts) (::en/shortcuts keyboard-shortcuts))))) +(let [keyboard-commands + {::commands (set (keys all-default-keyboard-shortcuts)) + ::dicts/commands dicts/abbreviated-commands}] + (assert (= (::commands keyboard-commands) (::dicts/commands keyboard-commands)) + (str "Keyboard commands must have an english label" + (data/diff (::commands keyboard-commands) (::commands keyboard-commands))))) (defn- resolve-fn "Converts a keyword fn to the actual fn. The fn to be resolved needs to be @@ -755,7 +755,7 @@ (with-meta {:before m/enable-when-not-editing-mode!}))})) ;; To add a new entry to this map, first add it here and then -;; a description for it in frontend.modules.shortcut.dicts/category +;; a description for it in frontend.dicts.en/dicts (def ^:large-vars/data-var category* "Full list of categories for docs purpose" {:shortcut.category/basics @@ -930,9 +930,9 @@ :ui/clear-all-notifications]}) (let [category-maps {::category (set (keys category*)) - ::dicts/category (set (keys dicts/category))}] + ::dicts/category dicts/categories}] (assert (= (::category category-maps) (::dicts/category category-maps)) - (str "Keys for category maps must be the same " + (str "Keys for category maps must have an english label " (data/diff (::category category-maps) (::dicts/category category-maps))))) (def category diff --git a/src/main/frontend/modules/shortcut/dicts.cljc b/src/main/frontend/modules/shortcut/dicts.cljc deleted file mode 100644 index 9abfaf060ff..00000000000 --- a/src/main/frontend/modules/shortcut/dicts.cljc +++ /dev/null @@ -1,63 +0,0 @@ -(ns ^:bb-compatible frontend.modules.shortcut.dicts - "Provides dictionary entries for shortcuts" - (:require [frontend.dicts.zh-cn :as zh-CN] - [frontend.dicts.zh-hant :as zh-Hant] - [frontend.dicts.de :as de] - [frontend.dicts.nl :as nl] - [frontend.dicts.fr :as fr] - [frontend.dicts.af :as af] - [frontend.dicts.es :as es] - [frontend.dicts.ru :as ru] - [frontend.dicts.nb-no :as nb-NO] - [frontend.dicts.pt-pt :as pt-PT] - [frontend.dicts.pt-br :as pt-BR] - [frontend.dicts.ja :as ja] - [frontend.dicts.it :as it] - [frontend.dicts.tr :as tr] - [frontend.dicts.ko :as ko] - [frontend.dicts.pl :as pl] - [frontend.dicts.sk :as sk] - [frontend.dicts.uk :as uk] - [frontend.dicts.en :as en])) - -(defn- decorate-namespace [k] - (let [n (name k) - ns (namespace k)] - (keyword (str "command." ns) n))) - -(def category - {:shortcut.category/basics "Basics" - :shortcut.category/formatting "Formatting" - :shortcut.category/navigating "Navigation" - :shortcut.category/block-editing "Block editing general" - :shortcut.category/block-command-editing "Block command editing" - :shortcut.category/block-selection "Block selection (press Esc to quit selection)" - :shortcut.category/toggle "Toggle" - :shortcut.category/whiteboard "Whiteboard" - :shortcut.category/others "Others"}) - -(def ^:large-vars/data-var dicts - {:en (merge - ;; Dynamically add this ns since command descriptions have to - ;; stay in sync with shortcut.config command ids which do not - ;; have a namespace - (update-keys en/shortcuts decorate-namespace) - category) - :zh-CN zh-CN/shortcuts - :zh-Hant zh-Hant/shortcuts - :de de/shortcuts - :nl nl/shortcuts - :fr fr/shortcuts - :af af/shortcuts - :es es/shortcuts - :ru ru/shortcuts - :nb-NO nb-NO/shortcuts - :pt-PT pt-PT/shortcuts - :pt-BR pt-BR/shortcuts - :ja ja/shortcuts - :it it/shortcuts - :tr tr/shortcuts - :ko ko/shortcuts - :pl pl/shortcuts - :sk sk/shortcuts - :uk uk/shortcuts}) diff --git a/src/test/frontend/context/i18n_test.cljs b/src/test/frontend/context/i18n_test.cljs index 3179bce93c3..cfd68594fb5 100644 --- a/src/test/frontend/context/i18n_test.cljs +++ b/src/test/frontend/context/i18n_test.cljs @@ -8,7 +8,7 @@ (state/set-state! :preferred-language nil))) (deftest translations - (testing "dict/dicts/core.cljs translations" + (testing "ui translations" (state/set-preferred-language! :en) (is (= "About Logseq" (i18n/t :help/about))) @@ -17,7 +17,7 @@ (is (= "Acerca de Logseq" (i18n/t :help/about)))) - (testing "shortcut/dicts.cljs translations" + (testing "command and category translations" (state/set-preferred-language! :en) (is (= "Go to journals" (i18n/t :command.go/journals))