Browse Source

Merge pull request #4753 from logseq/enhance/allow-more-translations

Enhance: Allow translations throughout the application
Tienson Qin 3 years ago
parent
commit
28d3cb4658

+ 1 - 0
.clj-kondo/config.edn

@@ -14,6 +14,7 @@
              datascript.transit dt
              datascript.db ddb
              lambdaisland.glogi log
+             medley.core medley
              frontend.db.query-dsl query-dsl
              frontend.db.react react
              frontend.db.query-react query-react}}}

+ 3 - 1
bb.edn

@@ -1,4 +1,6 @@
-{:paths ["scripts/src"]
+{:paths ["scripts/src" "src/main"]
+ :deps
+ {medley/medley {:mvn/version "1.3.0"}}
  :tasks
  {dev:watch
   logseq.tasks.dev/watch

+ 6 - 5
docs/contributing-to-translations.md

@@ -16,10 +16,7 @@ In order to run the commands in this doc, you will need to install
 Language translations are in two files,
 [frontend/dicts.cljs](https://github.com/logseq/logseq/blob/master/src/main/frontend/dicts.cljs)
 and
-[shortcut/dict.cljs](https://github.com/logseq/logseq/blob/master/src/main/frontend/modules/shortcut/dict.cljs).
-When translating `shortcut/dict.cljs` you will want to refer to
-https://github.com/logseq/logseq/blob/master/src/main/frontend/modules/shortcut/config.cljs
-for the English equivalent.
+[shortcut/dict.cljs](https://github.com/logseq/logseq/blob/master/src/main/frontend/modules/shortcut/dicts.cljs).
 
 ## Language Overview
 
@@ -68,6 +65,10 @@ $ bb lang:missing
 Now, add keys for your language, save and rerun the above command. Over time
 you're hoping to have this list drop to zero.
 
+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.
+
+## Fix Mistakes
+
 There is a lot to translate and sometimes we make mistakes. For example, we may leave a string untranslated. To see what translation keys are still left in English:
 
 ```
@@ -88,4 +89,4 @@ detect this error and helpfully show you what was typoed.
 
 To add a new language, add an entry to `frontend.dicts/languages`. Then add a
 new locale keyword to `frontend.dicts/dicts` and to
-`frontend.modules.shortcut.dict/dict` and start translating as described above.
+`frontend.modules.shortcut.dicts/dicts` and start translating as described above.

+ 11 - 41
scripts/src/logseq/tasks/lang.clj

@@ -1,58 +1,28 @@
 (ns logseq.tasks.lang
   "Tasks related to language translations"
-  (:require [logseq.tasks.rewrite-clj :as rewrite-clj]
-            [clojure.set :as set]
+  (:require [clojure.set :as set]
+            [frontend.dicts :as dicts]
+            [frontend.modules.shortcut.dicts :as shortcut-dicts]
             [logseq.tasks.util :as task-util]))
 
 (defn- get-dicts
   []
-  (dissoc (rewrite-clj/metadata-var-sexp "src/main/frontend/dicts.cljs" "dicts")
-          :tongue/fallback))
+  (dissoc dicts/dicts :tongue/fallback))
 
-(defn- get-non-en-shortcuts
+(defn- get-all-dicts
   []
-  (nth (rewrite-clj/metadata-var-sexp "src/main/frontend/modules/shortcut/dict.cljs"
-                                      "dict")
-       3))
-
-;; unnecessary complexity :(
-(defn- decorate-namespace [k]
-  (let [n (name k)
-        ns (namespace k)]
-    (keyword (str "command." ns) n)))
-
-(defn- get-en-shortcut-dicts
-  []
-  (->> (rewrite-clj/metadata-var-sexp
-        "src/main/frontend/modules/shortcut/config.cljs"
-        "all-default-keyboard-shortcuts")
-       (map (fn [[k v]] (vector (decorate-namespace k) (:desc v))))
-       (into {})))
-
-(defn- get-en-categories
-  []
-  (->> (rewrite-clj/metadata-var-sexp
-        "src/main/frontend/modules/shortcut/config.cljs"
-        "category")
-       (map (fn [[k v]] (vector k (:doc (meta v)))))
-       (into {})))
-
-(defn- get-shortcuts
-  []
-  (merge {:en (merge (get-en-categories)
-                     (get-en-shortcut-dicts))}
-         (get-non-en-shortcuts)))
+  (merge-with merge (get-dicts) shortcut-dicts/dicts))
 
 (defn- get-languages
   []
-  (->> (rewrite-clj/var-sexp "src/main/frontend/dicts.cljs" "languages")
+  (->> dicts/languages
        (map (juxt :value :label))
        (into {})))
 
 (defn list-langs
   "List translated langagues with their number of translations"
   []
-  (let [dicts (merge-with merge (get-dicts) (get-shortcuts))
+  (let [dicts (get-all-dicts)
         en-count (count (dicts :en))
         langs (get-languages)]
     (->> dicts
@@ -79,7 +49,7 @@
             (println "Language" lang "does not have an entry in dicts.cljs")
             (System/exit 1))
         all-dicts [[(get-dicts) "frontend/dicts.cljs"]
-                   [(get-shortcuts) "shortcut/dict.cljs"]]
+                   [shortcut-dicts/dicts "shortcut/dicts.cljs"]]
         all-missing (map (fn [[dicts file]]
                            [(select-keys (dicts :en)
                                          (set/difference (set (keys (dicts :en)))
@@ -102,7 +72,7 @@
 (defn invalid-translations
   "Lists translation that don't exist in English"
   []
-  (let [dicts (merge-with merge (get-dicts) (get-shortcuts))
+  (let [dicts (get-all-dicts)
         ;; For now defined as :en but clj-kondo analysis could be more thorough
         valid-keys (set (keys (dicts :en)))
         invalid-dicts
@@ -122,7 +92,7 @@
 (defn list-duplicates
   "Lists translations that are the same as the one in English"
   [& args]
-  (let [dicts (merge-with merge (get-dicts) (get-shortcuts))
+  (let [dicts (get-all-dicts)
         en-dicts (dicts :en)
         lang (or (keyword (first args))
                  (task-util/print-usage "LOCALE"))

+ 0 - 27
scripts/src/logseq/tasks/rewrite_clj.clj

@@ -1,27 +0,0 @@
-(ns logseq.tasks.rewrite-clj
-  "Rewrite-clj fns"
-  (:require [rewrite-clj.zip :as z]))
-
-(defn- find-symbol-value-sexpr
-  ([zloc sym] (find-symbol-value-sexpr zloc sym z/right))
-  ([zloc sym nav-fn]
-   ;; Returns first symbol found
-   (-> (z/find-value zloc z/next sym)
-       nav-fn
-       z/sexpr)))
-
-(defn var-sexp
-  "Returns value sexp to the right of var"
-  [file string-var]
-  (let [zloc (z/of-string (slurp file))
-        sexp (find-symbol-value-sexpr zloc (symbol string-var))]
-    (or sexp
-        (throw (ex-info "var-sexp must not return nil" {:file file :string-var string-var})))))
-
-(defn metadata-var-sexp
-  "Returns value sexp to the right of var with metadata"
-  [file string-var]
-  (let [zloc (z/of-string (slurp file))
-        sexp (find-symbol-value-sexpr zloc (symbol string-var) (comp z/right z/up))]
-    (or sexp
-        (throw (ex-info "sexp must not return nil" {:file file :string-var string-var})))))

+ 4 - 1
src/main/frontend/components/search.cljs

@@ -339,6 +339,9 @@
                                 (search-result-item "Page" original-name))
                         nil))}))])
 
+(def default-placeholder
+  (if config/publishing? (t :search/publishing) (t :search)))
+
 (rum/defcs search-modal < rum/reactive
   (shortcut/disable-all-shortcuts)
   (mixins/event-mixin
@@ -366,7 +369,7 @@
                          (t :graph-search)
                          :page
                          (t :page-search)
-                         (t :search))
+                         default-placeholder)
         :auto-complete (if (util/chrome?) "chrome-off" "off") ; off not working here
         :value         search-q
         :on-change     (fn [e]

+ 19 - 21
src/main/frontend/context/i18n.cljs

@@ -1,29 +1,27 @@
 (ns frontend.context.i18n
+  "Handles translation for the entire application. The dependencies for this ns
+  must be small since it is used throughout the application."
   (:require [frontend.dicts :as dicts]
-            [frontend.modules.shortcut.dict :as shortcut-dict]
-            [medley.core :refer [deep-merge]]
+            [frontend.modules.shortcut.dicts :as shortcut-dicts]
+            [tongue.core :as tongue]
             [frontend.state :as state]))
 
-;; TODO
-;; - [x] Get the preferred language from state
-;; - [x] Update the preferred language
-;; - [x] Create t functiona which takes a keyword and returns text with the current preferred language
-;; - [x] Add fetch for local browser preferred language if user has set it already
-;; - [ ] Fetch preferred language from backend if user is logged in
+(def dicts
+  (merge-with merge dicts/dicts shortcut-dicts/dicts))
 
-(defn fetch-local-language []
-  (.. js/window -navigator -language))
-
-(defonce translate-dicts (atom {}))
+(def translate
+  (tongue/build-translate dicts))
 
 (defn t
   [& args]
-  (let [preferred-language (keyword (state/sub :preferred-language))
-        _ (when (nil? preferred-language)
-            (state/set-preferred-language! (fetch-local-language)))
-        dicts (or (get @translate-dicts preferred-language)
-                  (let [result (some-> (deep-merge dicts/dicts shortcut-dict/dict)
-                                       dicts/translate)]
-                    (swap! translate-dicts assoc preferred-language result)
-                    result))]
-    (apply (partial dicts preferred-language) args)))
+  (let [preferred-language (keyword (state/sub :preferred-language))]
+    (apply translate preferred-language args)))
+
+(defn- fetch-local-language []
+  (.. js/window -navigator -language))
+
+;; TODO: Fetch preferred language from backend if user is logged in
+(defn start []
+  (let [preferred-language (state/sub :preferred-language)]
+    (when (nil? preferred-language)
+      (state/set-preferred-language! (fetch-local-language)))))

+ 34 - 48
src/main/frontend/dicts.cljs → src/main/frontend/dicts.cljc

@@ -1,11 +1,12 @@
-(ns frontend.dicts
-  (:require [frontend.config :as config]
-            [shadow.resource :as rc]
-            [tongue.core :as tongue]))
+(ns ^:bb-compatible frontend.dicts
+  "Provides dictionary entries for most of the application"
+  #?(:cljs (:require [shadow.resource :as rc])))
 
 (def ^:large-vars/data-var dicts
-  {:en {:tutorial/text (rc/inline "tutorial-en.md")
-        :tutorial/dummy-notes (rc/inline "dummy-notes-en.md")
+  {:en {:tutorial/text #?(:cljs (rc/inline "tutorial-en.md")
+                          :default "tutorial-en.md")
+        :tutorial/dummy-notes #?(:cljs (rc/inline "dummy-notes-en.md")
+                                 :default "dummy-notes-en.md")
         :on-boarding/title "Hi, welcome to Logseq!"
         :on-boarding/sharing "sharing"
         :on-boarding/is-a " is a "
@@ -295,9 +296,8 @@
         :sync-from-local-changes-detected "Refresh detects and processes files modified on your disk and diverged from the actual Logseq page content. Continue?"
 
         :unlink "unlink"
-        :search (if config/publishing?
-                  "Search"
-                  "Search or create page")
+        :search/publishing "Search"
+        :search "Search or create page"
         :page-search "Search in the current page"
         :graph-search "Search graph"
         :new-page "New page"
@@ -595,9 +595,8 @@
         :re-index "Neu indizieren"
         :export-json "Als JSON exportieren"
         :unlink "Verknüpfung aufheben"
-        :search (if config/publishing?
-                  "Suchen"
-                  "Suchen oder Seite erstellen")
+        :search/publishing "Suchen"
+        :search "Suchen oder Seite erstellen"
         :new-page "Neue Seite"
         :new-file "Neue Datei"
         :graph "Graph"
@@ -880,9 +879,8 @@
         :re-index "Ré-indexer"
         :export-json "Exporter au format JSON"
         :unlink "délier"
-        :search (if config/publishing?
-                  "Rechercher"
-                  "Rechercher ou Créer la Page")
+        :search/publishing "Rechercher"
+        :search "Rechercher ou Créer la Page"
         :new-page "Nouvelle page"
         :new-file "Nouveau fichier"
         :graph "Graphe"
@@ -1196,9 +1194,8 @@
            :export-opml "以 OPML 格式导出"
            :convert-markdown "转换 Markdown 格式(Unordered list 或 Heading)"
            :unlink "解除绑定"
-           :search (if config/publishing?
-                     "搜索"
-                     "搜索或者创建新页面")
+           :search/publishing "搜索"
+           :search "搜索或者创建新页面"
            :page-search "在当前页面搜索"
            :graph-search "搜索图谱"
            :new-page "新页面"
@@ -1525,9 +1522,8 @@
              :export-opml "以 OPML 格式導出"
              :convert-markdown "轉換 Markdown 格式(Unordered list 或 Heading)"
              :unlink "解除綁定"
-             :search (if config/publishing?
-                       "搜索"
-                       "搜索或者創建新頁面")
+             :search/publishing "搜索"
+             :search "搜索或者創建新頁面"
              :new-page "新頁面"
              :graph "圖譜"
              :publishing "發布/下載 HTML 文件"
@@ -2018,9 +2014,8 @@
         :close "Cerrar"
         :re-index "Reindexar"
         :unlink "desenlazar"
-        :search (if config/publishing?
-                  "Buscar"
-                  "Buscar o Crear Página")
+        :search/publishing "Buscar"
+        :search "Buscar o Crear Página"
         :page-search "Buscar en la página actual"
         :new-page "Nueva página"
         :new-file "Nuevo archivo"
@@ -2357,9 +2352,8 @@
            :sync-from-local-files "Oppfrisk"
            :sync-from-local-files-detail "Importer endringer fra lokale filer"
            :unlink "koble fra"
-           :search (if config/publishing?
-                     "Søk"
-                     "Søk eller Opprett Side")
+           :search/publishing "Søk"
+           :search "Søk eller Opprett Side"
            :page-search "Søk i denne siden"
            :graph-search "Søk graf"
            :new-page "Ny side"
@@ -2470,9 +2464,7 @@
            :select.graph/empty-placeholder-description "Ingen grafer matcher. Vil du legge til en ny?"
            :select.graph/add-graph "Ja, legg til en ny graf"}
 
-   :pt-BR {:tutorial/text (rc/inline "tutorial-en.md")
-           :tutorial/dummy-notes (rc/inline "dummy-notes-en.md")
-           :on-boarding/title "Olá, bem-vindo ao Logseq!"
+   :pt-BR {:on-boarding/title "Olá, bem-vindo ao Logseq!"
            :on-boarding/sharing "compartilhar"
            :on-boarding/is-a " é um bloco de notas "
            :on-boarding/vision "Uma plataforma de código-aberto focada na privacidade para gestão de conhecimento e colaboração."
@@ -2732,9 +2724,8 @@
            :delete "Excluir"
            :re-index "Re-indexar"
            :unlink "remover ligação"
-           :search (if config/publishing?
-                     "Pesquisar"
-                     "Pesquisar ou Criar Página")
+           :search/publishing "Pesquisar"
+           :search "Pesquisar ou Criar Página"
            :page-search "Pesquisar na página atual"
            :graph-search "Pesquisar gráfico"
            :new-page "Nova página"
@@ -3149,9 +3140,8 @@
            :sync-from-local-files "Atualizar"
            :sync-from-local-files-detail "Importar alterações de ficheiros locais"
            :unlink "remover ligação"
-           :search (if config/publishing?
-                     "Pesquisar"
-                     "Pesquisar ou Criar Página")
+           :search/publishing "Pesquisar"
+           :search "Pesquisar ou Criar Página"
            :page-search "Pesquisar na página atual"
            :graph-search "Pesquisar grafo"
            :new-page "Nova página"
@@ -3532,9 +3522,8 @@
         :re-index "Переиндексировать (перестроить граф)"
         :sync-from-local-files "Обновить (импортировать изменния из локальных файлов)"
         :unlink "отвязать"
-        :search (if config/publishing?
-                  "Искать"
-                  "Искать или создать страницу")
+        :search/publishing "Искать"
+        :search "Искать или создать страницу"
         :page-search "Искать на текущей странице"
         :graph-search "Искать граф"
         :new-page "Новая страница"
@@ -3629,8 +3618,10 @@
 
         :command-palette/prompt "Набери команду"}
 
-   :ja {:tutorial/text (rc/inline "tutorial-ja.md")
-        :tutorial/dummy-notes (rc/inline "dummy-notes-ja.md")
+   :ja {:tutorial/text #?(:cljs (rc/inline "tutorial-ja.md")
+                                :default "tutorial-ja.md")
+        :tutorial/dummy-notes #?(:cljs (rc/inline "dummy-notes-ja.md")
+                                       :default "dummy-notes-ja.md")
         :on-boarding/title "こんにちは、Logseq へようこそ!"
         :on-boarding/sharing "共有"
         :on-boarding/is-a "は"
@@ -3909,9 +3900,8 @@
         :sync-from-local-files "再表示"
         :sync-from-local-files-detail "ローカルファイルの変更点をインポート"
         :unlink "リンク解除"
-        :search (if config/publishing?
-                  "検索"
-                  "検索/新規ページ名")
+        :search/publishing "検索"
+        :search "検索/新規ページ名"
         :page-search "現在のページを検索"
         :graph-search "グラフを検索"
         :new-page "新規ページ"
@@ -4025,7 +4015,6 @@
 
    :tongue/fallback :en})
 
-
 (def languages [{:label "English" :value :en}
                 {:label "Français" :value :fr}
                 {:label "Deutsch" :value :de}
@@ -4038,6 +4027,3 @@
                 {:label "Português (Europeu)" :value :pt-PT}
                 {:label "Русский" :value :ru}
                 {:label "日本語" :value :ja}])
-
-(defn translate [dicts]
-  (tongue/build-translate dicts))

+ 6 - 4
src/main/frontend/handler.cljs

@@ -4,6 +4,7 @@
             [electron.listener :as el]
             [frontend.components.page :as page]
             [frontend.config :as config]
+            [frontend.context.i18n :as i18n]
             [frontend.db :as db]
             [frontend.db-schema :as db-schema]
             [frontend.db.conn :as conn]
@@ -210,6 +211,7 @@
     (register-components-fns!)
     (state/set-db-restoring! true)
     (render)
+    (i18n/start)
     (instrument/init)
     (set-network-watcher!)
 
@@ -225,10 +227,10 @@
     (events/run!)
 
     (p/let [repos (get-repos)]
-      (state/set-repos! repos)
-      (restore-and-setup! me repos logged? db-schema)
-      (when (mobile-util/is-native-platform?)
-        (p/do! (mobile-util/hide-splash))))
+           (state/set-repos! repos)
+           (restore-and-setup! me repos logged? db-schema)
+           (when (mobile-util/is-native-platform?)
+             (p/do! (mobile-util/hide-splash))))
 
     (reset! db/*sync-search-indice-f search/sync-search-indice!)
     (db/run-batch-txs!)

+ 4 - 2
src/main/frontend/handler/command_palette.cljs

@@ -13,8 +13,10 @@
 (s/def :command/tag vector?)
 
 (s/def :command/command
-  (s/keys :req-un [:command/id :command/desc :command/action]
-          :opt-un [:command/shortcut :command/tag]))
+  (s/keys :req-un [:command/id :command/action]
+          ;; :command/desc is optional for internal commands since view
+          ;; checks translation ns first
+          :opt-un [:command/desc :command/shortcut :command/tag]))
 
 (defn global-shortcut-commands []
   (->> [:shortcut.handler/editor-global

+ 4 - 4
src/main/frontend/handler/plugin.cljs

@@ -6,7 +6,7 @@
             [frontend.handler.notification :as notifications]
             [camel-snake-kebab.core :as csk]
             [frontend.state :as state]
-            [medley.core :as md]
+            [medley.core :as medley]
             [frontend.fs :as fs]
             [electron.ipc :as ipc]
             [cljs-bean.core :as bean]
@@ -234,7 +234,7 @@
 
 (defn unregister-plugin-slash-command
   [pid]
-  (swap! state/state md/dissoc-in [:plugin/installed-commands (keyword pid)]))
+  (swap! state/state medley/dissoc-in [:plugin/installed-commands (keyword pid)]))
 
 (def keybinding-mode-handler-map
   {:global      :shortcut.handler/editor-global
@@ -278,7 +278,7 @@
 
 (defn unregister-plugin-simple-command
   [pid]
-  (swap! state/state md/dissoc-in [:plugin/simple-commands (keyword pid)]))
+  (swap! state/state medley/dissoc-in [:plugin/simple-commands (keyword pid)]))
 
 (defn register-plugin-ui-item
   [pid {:keys [type] :as opts}]
@@ -498,7 +498,7 @@
                                         ;; effects
                                         (unregister-plugin-themes pid)
                                         ;; plugins
-                                        (swap! state/state md/dissoc-in [:plugin/installed-plugins pid])
+                                        (swap! state/state medley/dissoc-in [:plugin/installed-plugins pid])
                                         ;; commands
                                         (clear-commands! pid))))
 

+ 5 - 25
src/main/frontend/handler/repo.cljs

@@ -3,9 +3,9 @@
   (:require [cljs-bean.core :as bean]
             [clojure.string :as string]
             [frontend.config :as config]
+            [frontend.context.i18n :refer [t]]
             [frontend.date :as date]
             [frontend.db :as db]
-            [frontend.dicts :as dicts]
             [frontend.encrypt :as encrypt]
             [frontend.format :as format]
             [frontend.fs :as fs]
@@ -534,26 +534,6 @@
   (state/set-current-repo! repo)
   (db/start-db-conn! nil repo option))
 
-; Add translate function t in src/main/frontend/context/i18n.cljs without shortcut-dict/dict 
-; to avoid circular dependency
-; TODO: Remove copied functions once circular dependency is resolved
-(defn fetch-local-language []
-  (.. js/window -navigator -language))
-
-(defonce translate-dicts (atom {}))
-
-(defn t
-  [& args]
-  (let [preferred-language (keyword (state/sub :preferred-language))
-        _ (when (nil? preferred-language)
-            (state/set-preferred-language! (fetch-local-language)))
-        dicts (or (get @translate-dicts preferred-language)
-                  (let [result (some-> dicts/dicts
-                                       dicts/translate)]
-                    (swap! translate-dicts assoc preferred-language result)
-                    result))]
-    (apply (partial dicts preferred-language) args)))
-
 (defn setup-local-repo-if-not-exists!
   []
   (if js/window.pfs
@@ -703,9 +683,9 @@
   "Only works for electron
    Call backend to handle persisting a specific db on other window
    Skip persisting if no other windows is open (controlled by electron)
-     step 1. [In HERE]  a window         --persistGraph----->   electron  
-     step 2.            electron         --persistGraph----->   window holds the graph  
-     step 3.            window w/ graph  --persistGraphDone->   electron  
+     step 1. [In HERE]  a window         --persistGraph----->   electron
+     step 2.            electron         --persistGraph----->   window holds the graph
+     step 3.            window w/ graph  --persistGraphDone->   electron
      step 4. [In HERE]  electron         --persistGraphDone->   all windows"
   [graph]
   (p/create (fn [resolve _]
@@ -716,4 +696,4 @@
                                        ;; js/window.apis.once doesn't work
                                       (js/window.apis.removeAllListeners "persistGraphDone")
                                       (resolve repo))))
-              (ipc/ipc "persistGraph" graph))))
+              (ipc/ipc "persistGraph" graph))))

+ 155 - 237
src/main/frontend/modules/shortcut/config.cljs

@@ -11,307 +11,243 @@
             [frontend.handler.search :as search-handler]
             [frontend.handler.ui :as ui-handler]
             [frontend.handler.plugin :as plugin-handler]
+            [frontend.modules.shortcut.dicts :as dicts]
             [frontend.modules.shortcut.before :as m]
             [frontend.state :as state]
             [frontend.util :refer [mac?] :as util]
             [frontend.commands :as commands]
+            [clojure.data :as data]
             [medley.core :as medley]))
 
-;; Note – when you change this file, you will need to do a hard reset.
-;; The commands are registered when the Clojurescript code runs for the first time
-(defonce ^:large-vars/data-var all-default-keyboard-shortcuts
-  {:date-picker/complete         {:desc    "Date picker: Choose selected day"
-                                  :binding "enter"
+;; TODO: Namespace all-default-keyboard-shortcuts keys with `:command` e.g.
+;; `:command.date-picker/complete`. They are namespaced in translation but
+;; almost everywhere else they are not which could cause needless conflicts
+;; 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.
+;; :inactive key is for commands that are not active for a given platform or feature condition
+(def ^:large-vars/data-var all-default-keyboard-shortcuts
+  {:date-picker/complete         {:binding "enter"
                                   :fn      ui-handler/shortcut-complete}
 
-   :date-picker/prev-day         {:desc    "Date picker: Select previous day"
-                                  :binding "left"
+   :date-picker/prev-day         {:binding "left"
                                   :fn      ui-handler/shortcut-prev-day}
 
-   :date-picker/next-day         {:desc    "Date picker: Select next day"
-                                  :binding "right"
+   :date-picker/next-day         {:binding "right"
                                   :fn      ui-handler/shortcut-next-day}
 
-   :date-picker/prev-week        {:desc    "Date picker: Select previous week"
-                                  :binding "up"
+   :date-picker/prev-week        {:binding "up"
                                   :fn      ui-handler/shortcut-prev-week}
 
-   :date-picker/next-week        {:desc    "Date picker: Select next week"
-                                  :binding "down"
+   :date-picker/next-week        {:binding "down"
                                   :fn      ui-handler/shortcut-next-week}
 
-   :pdf/previous-page            {:desc    "Previous page of current pdf doc"
-                                  :binding "alt+p"
+   :pdf/previous-page            {:binding "alt+p"
                                   :fn      pdf-utils/prev-page}
 
-   :pdf/next-page                {:desc    "Next page of current pdf doc"
-                                  :binding "alt+n"
+   :pdf/next-page                {:binding "alt+n"
                                   :fn      pdf-utils/next-page}
 
-   :auto-complete/complete       {:desc    "Auto-complete: Choose selected item"
-                                  :binding "enter"
+   :auto-complete/complete       {:binding "enter"
                                   :fn      ui-handler/auto-complete-complete}
 
-   :auto-complete/prev           {:desc    "Auto-complete: Select previous item"
-                                  :binding "up"
+   :auto-complete/prev           {:binding "up"
                                   :fn      ui-handler/auto-complete-prev}
 
-   :auto-complete/next           {:desc    "Auto-complete: Select next item"
-                                  :binding "down"
+   :auto-complete/next           {:binding "down"
                                   :fn      ui-handler/auto-complete-next}
 
-   :auto-complete/shift-complete {:desc    "Auto-complete: Open selected item in sidebar"
-                                  :binding "shift+enter"
+   :auto-complete/shift-complete {:binding "shift+enter"
                                   :fn      ui-handler/auto-complete-shift-complete}
 
-   :auto-complete/open-link      {:desc    "Auto-complete: Open selected item in browser"
-                                  :binding "mod+o"
+   :auto-complete/open-link      {:binding "mod+o"
                                   :fn      ui-handler/auto-complete-open-link}
 
-   :cards/toggle-answers         {:desc    "Cards: show/hide answers/clozes"
-                                  :binding "s"
+   :cards/toggle-answers         {:binding "s"
                                   :fn      srs/toggle-answers}
 
-   :cards/next-card              {:desc    "Cards: next card"
-                                  :binding "n"
+   :cards/next-card              {:binding "n"
                                   :fn      srs/next-card}
 
-   :cards/forgotten              {:desc    "Cards: forgotten"
-                                  :binding "f"
+   :cards/forgotten              {:binding "f"
                                   :fn      srs/forgotten}
 
-   :cards/remembered             {:desc    "Cards: remembered"
-                                  :binding "r"
+   :cards/remembered             {:binding "r"
                                   :fn      srs/remembered}
 
-   :cards/recall                 {:desc    "Cards: take a while to recall"
-                                  :binding "t"
+   :cards/recall                 {:binding "t"
                                   :fn      srs/recall}
 
-   :editor/escape-editing        {:desc    "Escape editing"
-                                  :binding false
+   :editor/escape-editing        {:binding false
                                   :fn      (fn [_ _]
                                              (editor-handler/escape-editing))}
 
-   :editor/backspace             {:desc    "Backspace / Delete backwards"
-                                  :binding "backspace"
+   :editor/backspace             {:binding "backspace"
                                   :fn      editor-handler/editor-backspace}
 
-   :editor/delete                {:desc    "Delete / Delete forwards"
-                                  :binding "delete"
+   :editor/delete                {:binding "delete"
                                   :fn      editor-handler/editor-delete}
 
-   :editor/new-block             {:desc    "Create new block"
-                                  :binding "enter"
+   :editor/new-block             {:binding "enter"
                                   :fn      editor-handler/keydown-new-block-handler}
 
-   :editor/new-line              {:desc    "New line in current block"
-                                  :binding "shift+enter"
+   :editor/new-line              {:binding "shift+enter"
                                   :fn      editor-handler/keydown-new-line-handler}
 
-   :editor/follow-link           {:desc    "Follow link under cursor"
-                                  :binding "mod+o"
+   :editor/follow-link           {:binding "mod+o"
                                   :fn      editor-handler/follow-link-under-cursor!}
 
-   :editor/open-link-in-sidebar  {:desc    "Open link in sidebar"
-                                  :binding "mod+shift+o"
+   :editor/open-link-in-sidebar  {:binding "mod+shift+o"
                                   :fn      editor-handler/open-link-in-sidebar!}
 
-   :editor/bold                  {:desc    "Bold"
-                                  :binding "mod+b"
+   :editor/bold                  {:binding "mod+b"
                                   :fn      editor-handler/bold-format!}
 
-   :editor/italics               {:desc    "Italics"
-                                  :binding "mod+i"
+   :editor/italics               {:binding "mod+i"
                                   :fn      editor-handler/italics-format!}
 
-   :editor/highlight             {:desc    "Highlight"
-                                  :binding "mod+shift+h"
+   :editor/highlight             {:binding "mod+shift+h"
                                   :fn      editor-handler/highlight-format!}
 
-   :editor/strike-through        {:desc    "Strikethrough"
-                                  :binding "mod+shift+s"
+   :editor/strike-through        {:binding "mod+shift+s"
                                   :fn      editor-handler/strike-through-format!}
 
-   :editor/clear-block           {:desc    "Delete entire block content"
-                                  :binding (if mac? "ctrl+l" "alt+l")
+   :editor/clear-block           {:binding (if mac? "ctrl+l" "alt+l")
                                   :fn      editor-handler/clear-block-content!}
 
-   :editor/kill-line-before      {:desc    "Delete line before cursor position"
-                                  :binding (if mac? "ctrl+u" "alt+u")
+   :editor/kill-line-before      {:binding (if mac? "ctrl+u" "alt+u")
                                   :fn      editor-handler/kill-line-before!}
 
-   :editor/kill-line-after       {:desc    "Delete line after cursor position"
-                                  :binding (if mac? false "alt+k")
+   :editor/kill-line-after       {:binding (if mac? false "alt+k")
                                   :fn      editor-handler/kill-line-after!}
 
-   :editor/beginning-of-block    {:desc    "Move cursor to the beginning of a block"
-                                  :binding (if mac? false "alt+a")
+   :editor/beginning-of-block    {:binding (if mac? false "alt+a")
                                   :fn      editor-handler/beginning-of-block}
 
-   :editor/end-of-block          {:desc    "Move cursor to the end of a block"
-                                  :binding (if mac? false "alt+e")
+   :editor/end-of-block          {:binding (if mac? false "alt+e")
                                   :fn      editor-handler/end-of-block}
 
-   :editor/forward-word          {:desc    "Move cursor forward a word"
-                                  :binding (if mac? "ctrl+shift+f" "alt+f")
+   :editor/forward-word          {:binding (if mac? "ctrl+shift+f" "alt+f")
                                   :fn      editor-handler/cursor-forward-word}
 
-   :editor/backward-word         {:desc    "Move cursor backward a word"
-                                  :binding (if mac? "ctrl+shift+b" "alt+b")
+   :editor/backward-word         {:binding (if mac? "ctrl+shift+b" "alt+b")
                                   :fn      editor-handler/cursor-backward-word}
 
-   :editor/forward-kill-word     {:desc    "Delete a word forwards"
-                                  :binding (if mac? "ctrl+w" "alt+d")
+   :editor/forward-kill-word     {:binding (if mac? "ctrl+w" "alt+d")
                                   :fn      editor-handler/forward-kill-word}
 
-   :editor/backward-kill-word    {:desc    "Delete a word backwards"
-                                  :binding (if mac? false "alt+w")
+   :editor/backward-kill-word    {:binding (if mac? false "alt+w")
                                   :fn      editor-handler/backward-kill-word}
 
-   :editor/replace-block-reference-at-point {:desc    "Replace block reference with its content at point"
-                                             :binding "mod+shift+r"
+   :editor/replace-block-reference-at-point {:binding "mod+shift+r"
                                              :fn      editor-handler/replace-block-reference-with-content-at-point}
 
-   :editor/paste-text-in-one-block-at-point {:desc    "Paste text into one block at point"
-                                             :binding "mod+shift+v"
+   :editor/paste-text-in-one-block-at-point {:binding "mod+shift+v"
                                              :fn      editor-handler/paste-text-in-one-block-at-point}
 
-   :editor/insert-youtube-timestamp         {:desc    "Insert youtube timestamp"
-                                             :binding "mod+shift+y"
+   :editor/insert-youtube-timestamp         {:binding "mod+shift+y"
                                              :fn      commands/insert-youtube-timestamp}
 
-   :editor/cycle-todo              {:desc    "Rotate the TODO state of the current item"
-                                    :binding "mod+enter"
+   :editor/cycle-todo              {:binding "mod+enter"
                                     :fn      editor-handler/cycle-todo!}
 
-   :editor/up                      {:desc    "Move cursor up / Select up"
-                                    :binding "up"
+   :editor/up                      {:binding "up"
                                     :fn      (editor-handler/shortcut-up-down :up)}
 
-   :editor/down                    {:desc    "Move cursor down / Select down"
-                                    :binding "down"
+   :editor/down                    {:binding "down"
                                     :fn      (editor-handler/shortcut-up-down :down)}
 
-   :editor/left                    {:desc    "Move cursor left / Open selected block at beginning"
-                                    :binding "left"
+   :editor/left                    {:binding "left"
                                     :fn      (editor-handler/shortcut-left-right :left)}
 
-   :editor/right                   {:desc    "Move cursor right / Open selected block at end"
-                                    :binding "right"
+   :editor/right                   {:binding "right"
                                     :fn      (editor-handler/shortcut-left-right :right)}
 
-   :editor/move-block-up           {:desc    "Move block up"
-                                    :binding (if mac? "mod+shift+up" "alt+shift+up")
+   :editor/move-block-up           {:binding (if mac? "mod+shift+up" "alt+shift+up")
                                     :fn      (editor-handler/move-up-down true)}
 
-   :editor/move-block-down         {:desc    "Move block down"
-                                    :binding (if mac? "mod+shift+down" "alt+shift+down")
+   :editor/move-block-down         {:binding (if mac? "mod+shift+down" "alt+shift+down")
                                     :fn      (editor-handler/move-up-down false)}
 
    ;; FIXME: add open edit in non-selection mode
-   :editor/open-edit               {:desc    "Edit selected block"
-                                    :binding "enter"
+   :editor/open-edit               {:binding "enter"
                                     :fn      (partial editor-handler/open-selected-block! :right)}
 
-   :editor/select-block-up         {:desc    "Select block above"
-                                    :binding "shift+up"
+   :editor/select-block-up         {:binding "shift+up"
                                     :fn      (editor-handler/on-select-block :up)}
 
-   :editor/select-block-down       {:desc    "Select block below"
-                                    :binding "shift+down"
+   :editor/select-block-down       {:binding "shift+down"
                                     :fn      (editor-handler/on-select-block :down)}
 
-   :editor/delete-selection        {:desc    "Delete selected blocks"
-                                    :binding ["backspace" "delete"]
+   :editor/delete-selection        {:binding ["backspace" "delete"]
                                     :fn      editor-handler/delete-selection}
 
-   :editor/expand-block-children   {:desc    "Expand"
-                                    :binding "mod+down"
+   :editor/expand-block-children   {:binding "mod+down"
                                     :fn      editor-handler/expand!}
 
-   :editor/collapse-block-children {:desc    "Collapse"
-                                    :binding "mod+up"
+   :editor/collapse-block-children {:binding "mod+up"
                                     :fn      editor-handler/collapse!}
 
-   :editor/indent                  {:desc    "Indent block"
-                                    :binding "tab"
+   :editor/indent                  {:binding "tab"
                                     :fn      (editor-handler/keydown-tab-handler :right)}
 
-   :editor/outdent                 {:desc    "Outdent block"
-                                    :binding "shift+tab"
+   :editor/outdent                 {:binding "shift+tab"
                                     :fn      (editor-handler/keydown-tab-handler :left)}
 
-   :editor/copy                    {:desc    "Copy (copies either selection, or block reference)"
-                                    :binding "mod+c"
+   :editor/copy                    {:binding "mod+c"
                                     :fn      editor-handler/shortcut-copy}
 
-   :editor/cut                     {:desc    "Cut"
-                                    :binding "mod+x"
+   :editor/cut                     {:binding "mod+x"
                                     :fn      editor-handler/shortcut-cut}
 
-   :editor/undo                    {:desc    "Undo"
-                                    :binding "mod+z"
+   :editor/undo                    {:binding "mod+z"
                                     :fn      history/undo!}
 
-   :editor/redo                    {:desc    "Redo"
-                                    :binding ["shift+mod+z" "mod+y"]
+   :editor/redo                    {:binding ["shift+mod+z" "mod+y"]
                                     :fn      history/redo!}
 
-   :editor/insert-link             {:desc    "HTML Link"
-                                    :binding "mod+l"
+   :editor/insert-link             {:binding "mod+l"
                                     :fn      #(editor-handler/html-link-format!)}
 
-   :editor/select-all-blocks       {:desc    "Select all blocks"
-                                    :binding "mod+shift+a"
+   :editor/select-all-blocks       {:binding "mod+shift+a"
                                     :fn      editor-handler/select-all-blocks!}
 
-   :editor/zoom-in                 {:desc    "Zoom in editing block / Forwards otherwise"
-                                    :binding (if mac? "mod+." "alt+right")
+   :editor/zoom-in                 {:binding (if mac? "mod+." "alt+right")
                                     :fn      editor-handler/zoom-in!}
 
-   :editor/zoom-out                {:desc    "Zoom out editing block / Backwards otherwise"
-                                    :binding (if mac? "mod+," "alt+left")
+   :editor/zoom-out                {:binding (if mac? "mod+," "alt+left")
                                     :fn      editor-handler/zoom-out!}
 
-   :ui/toggle-brackets             {:desc    "Toggle whether to display brackets"
-                                    :binding "mod+c mod+b"
+   :ui/toggle-brackets             {:binding "mod+c mod+b"
                                     :fn      config-handler/toggle-ui-show-brackets!}
 
-   :go/search-in-page              {:desc    "Search in the current page"
-                                    :binding "mod+shift+k"
+   :go/search-in-page              {:binding "mod+shift+k"
                                     :fn      #(do
                                                 (editor-handler/escape-editing)
                                                 (route-handler/go-to-search! :page))}
 
-   :go/search                      {:desc    "Full text search"
-                                    :binding "mod+k"
+   :go/search                      {:binding "mod+k"
                                     :fn      #(do
                                                 (editor-handler/escape-editing)
                                                 (route-handler/go-to-search! :global))}
 
-   :go/journals                    {:desc    "Go to journals"
-                                    :binding "g j"
+   :go/journals                    {:binding "g j"
                                     :fn      route-handler/go-to-journals!}
 
-   :go/backward                    {:desc    "Backwards"
-                                    :binding "mod+open-square-bracket"
+   :go/backward                    {:binding "mod+open-square-bracket"
                                     :fn      (fn [_] (js/window.history.back))}
 
-   :go/forward                     {:desc    "Forwards"
-                                    :binding "mod+close-square-bracket"
+   :go/forward                     {:binding "mod+close-square-bracket"
                                     :fn      (fn [_] (js/window.history.forward))}
 
-   :search/re-index                {:desc    "Rebuild search index"
-                                    :binding "mod+c mod+s"
+   :search/re-index                {:binding "mod+c mod+s"
                                     :fn      (fn [_] (search-handler/rebuild-indices! true))}
 
-   :sidebar/open-today-page        {:desc    "Open today's page in the right sidebar"
-                                    :binding (if mac? "mod+shift+j" "alt+shift+j")
+   :sidebar/open-today-page        {:binding (if mac? "mod+shift+j" "alt+shift+j")
                                     :fn      page-handler/open-today-in-sidebar}
 
-   :sidebar/clear                  {:desc    "Clear all in the right sidebar"
-                                    :binding "mod+c mod+c"
+   :sidebar/clear                  {:binding "mod+c mod+c"
                                     :fn      #(do
                                                 (state/clear-sidebar-blocks!)
                                                 (state/hide-right-sidebar!))}
@@ -319,154 +255,130 @@
    :misc/copy                      {:binding "mod+c"
                                     :fn      (fn [] (js/document.execCommand "copy"))}
 
-   :command-palette/toggle         {:desc    "Toggle command palette"
-                                    :binding "mod+shift+p"
+   :command-palette/toggle         {:binding "mod+shift+p"
                                     :fn      #(do
                                                 (editor-handler/escape-editing)
                                                 (state/toggle! :ui/command-palette-open?))}
 
-   :graph/open                     {:desc    "Select graph to open"
-                                    :fn      #(do
+   :graph/open                     {:fn      #(do
                                                 (editor-handler/escape-editing)
                                                 (state/set-state! :ui/open-select :graph-open))
                                     :binding "mod+shift+g"}
 
-   :graph/remove                   {:desc    "Remove a graph"
-                                    :fn      #(do
+   :graph/remove                   {:fn      #(do
                                                 (editor-handler/escape-editing)
                                                 (state/set-state! :ui/open-select :graph-remove))
                                     :binding false}
 
-   :graph/add                      {:desc "Add a graph"
-                                    :fn (fn [] (route-handler/redirect! {:to :repo-add}))
+   :graph/add                      {:fn (fn [] (route-handler/redirect! {:to :repo-add}))
                                     :binding false}
 
-   :graph/save                     {:desc "Save current graph to disk"
-                                    :fn #(state/pub-event! [:graph/save])
+   :graph/save                     {:fn #(state/pub-event! [:graph/save])
                                     :binding false}
 
-   :command/run                    (when (util/electron?)
-                                     {:desc    "Run git command"
-                                      :binding "mod+shift+1"
-                                      :fn      #(state/pub-event! [:command/run])})
+   :command/run                    {:binding "mod+shift+1"
+                                    :inactive (not (util/electron?))
+                                    :fn      #(state/pub-event! [:command/run])}
 
-   :go/home                        {:desc    "Go to home"
-                                    :binding "g h"
+   :go/home                        {:binding "g h"
                                     :fn      route-handler/redirect-to-home!}
 
-   :go/all-pages                   {:desc    "Go to all pages"
-                                    :binding "g a"
+   :go/all-pages                   {:binding "g a"
                                     :fn      route-handler/redirect-to-all-pages!}
 
-   :go/graph-view                  {:desc    "Go to graph view"
-                                    :binding "g g"
+   :go/graph-view                  {:binding "g g"
                                     :fn      route-handler/redirect-to-graph-view!}
 
 
-   :go/keyboard-shortcuts          {:desc    "Go to keyboard shortcuts"
-                                    :binding "g s"
+   :go/keyboard-shortcuts          {:binding "g s"
                                     :fn      #(route-handler/redirect! {:to :shortcut-setting})}
 
-   :go/tomorrow                    {:desc    "Go to tomorrow"
-                                    :binding "g t"
+   :go/tomorrow                    {:binding "g t"
                                     :fn      journal-handler/go-to-tomorrow!}
 
-   :go/next-journal                {:desc    "Go to next journal"
-                                    :binding "g n"
+   :go/next-journal                {:binding "g n"
                                     :fn      journal-handler/go-to-next-journal!}
 
-   :go/prev-journal                {:desc    "Go to previous journal"
-                                    :binding "g p"
+   :go/prev-journal                {:binding "g p"
                                     :fn      journal-handler/go-to-prev-journal!}
 
-   :go/flashcards                  {:desc    "Toggle flashcards"
-                                    :binding "g f"
+   :go/flashcards                  {:binding "g f"
                                     :fn      (fn []
                                                (if (state/modal-opened?)
                                                  (state/close-modal!)
                                                  (state/pub-event! [:modal/show-cards])))}
 
-   :ui/toggle-document-mode        {:desc    "Toggle document mode"
-                                    :binding "t d"
+   :ui/toggle-document-mode        {:binding "t d"
                                     :fn      state/toggle-document-mode!}
 
-   :ui/toggle-settings              {:desc    "Toggle settings"
-                                     :binding (if mac? "t s" ["t s" "mod+,"])
+   :ui/toggle-settings              {:binding (if mac? "t s" ["t s" "mod+,"])
                                      :fn      ui-handler/toggle-settings-modal!}
 
-   :ui/toggle-right-sidebar         {:desc    "Toggle right sidebar"
-                                     :binding "t r"
+   :ui/toggle-right-sidebar         {:binding "t r"
                                      :fn      ui-handler/toggle-right-sidebar!}
 
-   :ui/toggle-left-sidebar          {:desc    "Toggle left sidebar"
-                                     :binding "t l"
+   :ui/toggle-left-sidebar          {:binding "t l"
                                      :fn      state/toggle-left-sidebar!}
 
-   :ui/toggle-help                  {:desc    "Toggle help"
-                                     :binding "shift+/"
+   :ui/toggle-help                  {:binding "shift+/"
                                      :fn      ui-handler/toggle-help!}
 
-   :ui/toggle-theme                 {:desc    "Toggle between dark/light theme"
-                                     :binding "t t"
+   :ui/toggle-theme                 {:binding "t t"
                                      :fn      state/toggle-theme!}
 
-   :ui/toggle-contents              {:desc    "Toggle Contents in sidebar"
-                                     :binding "mod+shift+c"
+   :ui/toggle-contents              {:binding "mod+shift+c"
                                      :fn      ui-handler/toggle-contents!}
-   :ui/open-new-window              (when (util/electron?)
-                                      {:desc    "Open another window"
-                                       :binding "mod+n"
-                                       :fn      #(state/pub-event! [:graph/open-new-window nil])})
 
-   :command/toggle-favorite         {:desc    "Add to/remove from favorites"
-                                     :binding "mod+shift+f"
+   :ui/open-new-window              {:binding "mod+n"
+                                     :inactive (not (util/electron?))
+                                     :fn      #(state/pub-event! [:graph/open-new-window nil])}
+
+   :command/toggle-favorite         {:binding "mod+shift+f"
                                      :fn      page-handler/toggle-favorite!}
 
-   :editor/open-file-in-default-app (when (util/electron?)
-                                      {:desc    "Open file in default app"
-                                       :binding false
-                                       :fn      page-handler/open-file-in-default-app})
+   :editor/open-file-in-default-app {:binding false
+                                     :inactive (not (util/electron?))
+                                     :fn      page-handler/open-file-in-default-app}
 
-   :editor/open-file-in-directory   (when (util/electron?)
-                                      {:desc    "Open file in parent directory"
-                                       :binding false
-                                       :fn      page-handler/open-file-in-directory})
+   :editor/open-file-in-directory   {:binding false
+                                     :inactive (not (util/electron?))
+                                     :fn      page-handler/open-file-in-directory}
 
-   :editor/copy-current-file        (when (util/electron?)
-                                      {:desc    "Copy current file"
-                                       :binding false
-                                       :fn      page-handler/copy-current-file})
+   :editor/copy-current-file        {:binding false
+                                     :inactive (not (util/electron?))
+                                     :fn      page-handler/copy-current-file}
 
-   :ui/toggle-wide-mode             {:desc    "Toggle wide mode"
-                                     :binding "t w"
+   :ui/toggle-wide-mode             {:binding "t w"
                                      :fn      ui-handler/toggle-wide-mode!}
 
-   :ui/select-theme-color           {:desc    "Select available theme colors"
-                                     :binding "t i"
+   :ui/select-theme-color           {:binding "t i"
                                      :fn      plugin-handler/show-themes-modal!}
 
-   :ui/goto-plugins                  (when plugin-handler/lsp-enabled?
-                                       {:desc    "Go to plugins dashboard"
-                                        :binding "t p"
-                                        :fn      plugin-handler/goto-plugins-dashboard!})
+   :ui/goto-plugins                 {:binding "t p"
+                                     :inactive (not plugin-handler/lsp-enabled?)
+                                     :fn      plugin-handler/goto-plugins-dashboard!}
 
 
-   :editor/toggle-open-blocks       {:desc    "Toggle open blocks (collapse or expand all blocks)"
-                                     :binding "t o"
+   :editor/toggle-open-blocks       {:binding "t o"
                                      :fn      editor-handler/toggle-open!}
 
-   :ui/toggle-cards                 {:desc    "Toggle cards"
-                                     :binding "t c"
+   :ui/toggle-cards                 {:binding "t c"
                                      :fn      ui-handler/toggle-cards!}
-   ;; :ui/toggle-between-page-and-file route-handler/toggle-between-page-and-file!
 
-   :git/commit                      {:desc    "Git commit message"
-                                     :binding "c"
+   :git/commit                      {:binding "c"
                                      :fn      commit/show-commit-modal!}})
 
-(defn build-category-map [symbols]
-  (reduce into {}
-          (map (fn [sym] {sym (get all-default-keyboard-shortcuts sym)}) symbols)))
+(let [keyboard-shortcuts
+      {::keyboard-shortcuts (set (keys all-default-keyboard-shortcuts))
+       ::dicts/keyboard-shortcuts (set (keys dicts/all-default-keyboard-shortcuts))}]
+  (assert (= (::keyboard-shortcuts keyboard-shortcuts) (::dicts/keyboard-shortcuts keyboard-shortcuts))
+          (str "Keys for keyboard shortcuts must be the same "
+               (data/diff (::keyboard-shortcuts keyboard-shortcuts) (::dicts/keyboard-shortcuts keyboard-shortcuts)))))
+
+(defn build-category-map [ks]
+  (->> (select-keys all-default-keyboard-shortcuts ks)
+       (remove (comp :inactive val))
+       (into {})))
 
 (defonce ^:large-vars/data-var config
   (atom
@@ -604,10 +516,11 @@
                           :git/commit])
      (with-meta {:before m/enable-when-not-editing-mode!}))}))
 
-;; Categories for docs purpose
-(def ^:large-vars/data-var category
+;; To add a new entry to this map, first add it here and then
+;; a description for it in frontend.modules.shortcut.dicts/category
+(def ^:large-vars/data-var category*
+  "Full list of categories for docs purpose"
   {:shortcut.category/basics
-   ^{:doc "Basics"}
    [:editor/new-block
     :editor/new-line
     :editor/indent
@@ -621,14 +534,12 @@
     :editor/cut]
 
    :shortcut.category/formatting
-   ^{:doc "Formatting"}
    [:editor/bold
     :editor/insert-link
     :editor/italics
     :editor/highlight]
 
    :shortcut.category/navigating
-   ^{:doc "Navigation"}
    [:editor/up
     :editor/down
     :editor/left
@@ -652,7 +563,6 @@
     :ui/open-new-window]
 
    :shortcut.category/block-editing
-   ^{:doc "Block editing general"}
    [:editor/backspace
     :editor/delete
     :editor/indent
@@ -669,7 +579,6 @@
     :editor/escape-editing]
 
    :shortcut.category/block-command-editing
-   ^{:doc "Block command editing"}
    [:editor/backspace
     :editor/clear-block
     :editor/kill-line-before
@@ -684,7 +593,6 @@
     :editor/paste-text-in-one-block-at-point]
 
    :shortcut.category/block-selection
-   ^{:doc "Block selection (press Esc to quit selection)"}
    [:editor/open-edit
     :editor/select-all-blocks
     :editor/select-block-up
@@ -692,7 +600,6 @@
     :editor/delete-selection]
 
    :shortcut.category/toggle
-   ^{:doc "Toggle"}
    [:ui/toggle-help
     :editor/toggle-open-blocks
     :ui/toggle-wide-mode
@@ -706,7 +613,6 @@
     :ui/toggle-contents]
 
    :shortcut.category/others
-   ^{:doc "Others"}
    [:pdf/previous-page
     :pdf/next-page
     :command/toggle-favorite
@@ -731,6 +637,18 @@
     :date-picker/next-week
     :date-picker/complete]})
 
+(let [category-maps {::category (set (keys category*))
+                     ::dicts/category (set (keys dicts/category))}]
+  (assert (= (::category category-maps) (::dicts/category category-maps))
+          (str "Keys for category maps must be the same "
+               (data/diff (::category category-maps) (::dicts/category category-maps)))))
+
+(def category
+  "Active list of categories for docs purpose"
+  (medley/map-vals (fn [v]
+                     (vec (remove #(:inactive (get all-default-keyboard-shortcuts %)) v)))
+                   category*))
+
 (defn add-shortcut!
   [handler-id id shortcut-map]
   (swap! config assoc-in [handler-id id] shortcut-map))

+ 0 - 15
src/main/frontend/modules/shortcut/data_helper.cljs

@@ -77,19 +77,6 @@
         ns (namespace k)]
     (keyword (str "command." ns) n)))
 
-(defn desc-helper []
-  (->> (vals @config/config)
-       (apply merge)
-       (map (fn [[k {:keys [desc]}]]
-              {(decorate-namespace k) desc}))
-       (into {})))
-
-(defn category-helper []
-  (->> config/category
-       (map (fn [[k v]]
-              {k (:doc (meta v))}))
-       (into {})))
-
 (defn decorate-binding [binding]
   (-> (if (string? binding) binding (str/join "+"  binding))
       (str/replace "mod" (if util/mac? "cmd" "ctrl"))
@@ -190,9 +177,7 @@
 
 (defn shortcuts->commands [handler-id]
   (let [m (get @config/config handler-id)]
-    ;; NOTE: remove nil vals, since some commands are conditional
     (->> m
-         (filter (comp some? val))
          (map (fn [[id _]] (-> (shortcut-data-by-id id)
                                (assoc :id id :handler-id handler-id)
                                (rename-keys {:binding :shortcut

+ 0 - 654
src/main/frontend/modules/shortcut/dict.cljs

@@ -1,654 +0,0 @@
-(ns frontend.modules.shortcut.dict
-  (:require [frontend.modules.shortcut.data-helper :as dh]
-            [frontend.modules.shortcut.macro :refer [shortcut-dict]]))
-
-(def ^:large-vars/data-var dict
-  (shortcut-dict
-    (dh/desc-helper)
-    (dh/category-helper)
-    {:zh-CN   {:shortcut.category/formatting            "格式化"
-               :shortcut.category/basics                "基础操作"
-               :shortcut.category/navigating            "移动"
-               :shortcut.category/block-editing         "块编辑基本"
-               :shortcut.category/block-command-editing "块编辑文本操作"
-               :shortcut.category/block-selection       "块选择操作"
-               :shortcut.category/toggle                "切换"
-               :shortcut.category/others                "其他"
-               :command.editor/indent                   "缩进块标签"
-               :command.editor/outdent                  "取消缩进块"
-               :command.editor/move-block-up            "向上移动块"
-               :command.editor/move-block-down          "向下移动块"
-               :command.editor/new-block                "创建块"
-               :command.editor/new-line                 "块中新建行"
-               :command.editor/zoom-in                  "聚焦"
-               :command.editor/zoom-out                 "退出聚焦"
-               :command.editor/follow-link              "跟随光标下的链接"
-               :command.editor/open-link-in-sidebar     "在侧边栏打开"
-               :command.editor/expand-block-children    "展开"
-               :command.editor/collapse-block-children  "折叠"
-               :command.editor/select-block-up          "选择上方的块"
-               :command.editor/select-block-down        "选择下方的块"
-               :command.editor/select-all-blocks        "选择所有块"
-               :command.ui/toggle-help                  "显示/关闭帮助"
-               :command.git/commit                      "提交消息"
-               :command.go/search                       "全文搜索"
-               :command.go/backward                     "回退"
-               :command.go/forward                      "前进"
-               :command.go/search-in-page               "在当前页面搜索"
-               :command.ui/toggle-document-mode         "切换文档模式"
-               :command.ui/toggle-contents              "打开/关闭目录"
-               :command.ui/toggle-theme                 "在暗色/亮色主题之间切换"
-               :command.ui/toggle-right-sidebar         "启用/关闭右侧栏"
-               :command.ui/toggle-settings              "显示/关闭设置"
-               :command.go/journals                     "跳转到日记"
-               :command.ui/toggle-wide-mode             "切换宽屏模式"
-               :command.ui/toggle-brackets              "切换是否显示括号"
-               :command.search/re-index                 "重新建立搜索索引"
-               :command.editor/bold                     "粗体"
-               :command.editor/italics                  "斜体"
-               :command.editor/insert-link              "Html 链接"
-               :command.editor/highlight                "高亮"
-               :command.editor/undo                     "撤销"
-               :command.editor/redo                     "重做"
-               :command.editor/copy                     "复制"
-               :command.editor/cut                      "剪切"
-               :command.editor/up                       "向上移动光标 / 向上选择"
-               :command.editor/down                     "向下移动光标 / 向下选择"
-               :command.editor/left                     "向左移动光标 / 向左选择"
-               :command.editor/right                    "向右移动光标 / 向右选择"
-               :command.editor/backspace                "向左删除"
-               :command.editor/delete                   "向右删除"
-               :command.editor/cycle-todo               "切换TODO状态"
-               :command.editor/clear-block              "清除块内容"
-               :command.editor/kill-line-before         "删除光标右侧行"
-               :command.editor/kill-line-after          "删除光标左侧行"
-               :command.editor/beginning-of-block       "移动光标到块开始位置"
-               :command.editor/end-of-block             "移动光标到块末尾"
-               :command.editor/forward-word             "光标向后移动一个单词"
-               :command.editor/backward-word            "光标向前移动一个单词"
-               :command.editor/forward-kill-word        "向后删除一个单词"
-               :command.editor/backward-kill-word       "向前删除一个单词"
-               :command.editor/open-edit                "编辑选中块"
-               :command.editor/delete-selection         "删除选中块"
-               :command.editor/toggle-open-blocks       "切换折叠/展开所有块(非编辑状态)"}
-
-     :zh-Hant {:command.editor/indent                  "縮進塊標簽"
-               :command.editor/outdent                 "取消縮進塊"
-               :command.editor/move-block-up           "向上移動塊"
-               :command.editor/move-block-down         "向下移動塊"
-               :command.editor/new-block               "創建塊"
-               :command.editor/new-line                "塊中新建行"
-               :command.editor/zoom-in                 "聚焦"
-               :command.editor/zoom-out                "推出聚焦"
-               :command.editor/follow-link             "跟隨光標下的鏈接"
-               :command.editor/open-link-in-sidebar    "在側邊欄打開"
-               :command.editor/expand-block-children   "展開"
-               :command.editor/collapse-block-children "折疊"
-               :command.editor/select-block-up         "選擇上方的塊"
-               :command.editor/select-block-down       "選擇下方的塊"
-               :command.editor/select-all-blocks       "選擇所有塊"
-               :command.ui/toggle-help                 "顯示/關閉幫助"
-               :command.git/commit                     "提交消息"
-               :command.go/search                      "全文搜索"
-               :command.ui/toggle-document-mode        "切換文檔模式"
-               :command.ui/toggle-theme                "“在暗色/亮色主題之間切換”"
-               :command.ui/toggle-right-sidebar        "啟用/關閉右側欄"
-               :command.go/journals                    "跳轉到日記"}
-
-     :de      {:shortcut.category/formatting           "Formatierung"
-               :command.editor/indent                  "Block einrücken"
-               :command.editor/outdent                 "Block ausrücken"
-               :command.editor/move-block-up           "Block nach oben verschieben"
-               :command.editor/move-block-down         "Block nach unten verschieben"
-               :command.editor/new-block               "Neuen Block erstellen"
-               :command.editor/new-line                "Neue Zeile innerhalb des Blocks erstellen"
-               :command.editor/zoom-in                 "Heranzoomen"
-               :command.editor/zoom-out                "Herauszoomen"
-               :command.editor/follow-link             "Link unter dem Cursor folgen"
-               :command.editor/open-link-in-sidebar    "Link in Seitenleiste öffnen"
-               :command.editor/expand-block-children   "Erweitern"
-               :command.editor/collapse-block-children "Zusammenklappen"
-               :command.editor/select-block-up         "Block oberhalb auswählen"
-               :command.ui/toggle-help                 "Hilfe aktivieren"
-               :command.go/search                      "Volltextsuche"
-               :command.ui/toggle-document-mode        "Dokumentenmodus umschalten"
-               :command.ui/toggle-theme                "Umschalten zwischen dunklem/hellem Thema"
-               :command.ui/toggle-right-sidebar        "Rechte Seitenleiste umschalten"
-               :command.go/journals                    "Zu Journalen springen"
-               :command.git/commit                     "Git Commit-Nachricht"
-               :command.editor/select-block-down       "Block unterhalb auswählen"
-               :command.editor/select-all-blocks       "Alle Blöcke auswählen"}
-
-     :fr      {: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"
-               :command.editor/move-block-down         "Déplacer un bloc en dessous"
-               :command.editor/new-block               "Créer un nouveau bloc"
-               :command.editor/new-line                "Aller à la ligne dans un bloc"
-               :command.editor/zoom-in                 "Zoomer"
-               :command.editor/zoom-out                "Dézoomer"
-               :command.editor/follow-link             "Suivre le lien sous le curseur"
-               :command.editor/open-link-in-sidebar    "Ouvrir le lien dans la barre latérale"
-               :command.editor/expand-block-children   "Etendre"
-               :command.editor/collapse-block-children "Réduire"
-               :command.editor/select-block-up         "Sélectionner le bloc au dessus"
-               :command.editor/select-block-down       "Sélectionner le bloc en dessous"
-               :command.editor/select-all-blocks       "Sélectionner tous les blocs"
-               :command.ui/toggle-help                 "Afficher l'aide"
-               :command.git/commit                     "Message de commit Git"
-               :command.go/search                      "Recherche globale dans le texte"
-               :command.ui/toggle-document-mode        "Intervertir le mode document"
-               :command.ui/toggle-theme                "Intervertir le thème foncé/clair"
-               :command.ui/toggle-right-sidebar        "Afficher/cacher la barre latérale"
-               :command.go/journals                    "Aller au Journal"}
-
-     :af      {:shortcut.category/formatting           "Formatering"
-               :command.editor/indent                  "Ingekeepte blok oortjie"
-               :command.editor/outdent                 "Oningekeepte blok"
-               :command.editor/move-block-up           "Skuif Blok Boontoe"
-               :command.editor/move-block-down         "Skuif Blok Ondertoe"
-               :command.editor/new-block               "Skep 'n nuwe blok"
-               :command.editor/new-line                "Nuwe lyn in blok"
-               :command.editor/zoom-in                 "Zoem in"
-               :command.editor/zoom-out                "Zoem uit"
-               :command.editor/follow-link             "Volg die skakel onder die wyser"
-               :command.editor/open-link-in-sidebar    "Maak skakel in kantlys oop"
-               :command.editor/expand-block-children   "Brei uit"
-               :command.editor/collapse-block-children "Vou in"
-               :command.editor/select-block-up         "Kies blok bo"
-               :command.editor/select-block-down       "Kies blok onder"
-               :command.editor/select-all-blocks       "Kies alle blokke"
-               :command.ui/toggle-help                 "Wissel help"
-               :command.git/commit                     "Jou git stoor boodskap"
-               :command.go/search                      "Volteks soek"
-               :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"}
-
-     :es      {:shortcut.category/formatting            "Formato"
-               :shortcut.category/basics                "Básico"
-               :shortcut.category/navigating            "Navegación"
-               :shortcut.category/block-editing         "Edición de bloque general"
-               :shortcut.category/block-command-editing "Comandos edición de bloque"
-               :shortcut.category/block-selection       "Selección de bloques (pulsar Esc para salir)"
-               :shortcut.category/toggle                "Alternar"
-               :shortcut.category/others                "Otros"
-               :command.editor/indent                   "Aumentar sangría"
-               :command.editor/outdent                  "Disminuir sangría"
-               :command.editor/move-block-up            "Mover bloque arriba"
-               :command.editor/move-block-down          "Mover bloque abajo"
-               :command.editor/new-block                "Crear bloque nuevo"
-               :command.editor/new-line                 "Nueva linea en bloque"
-               :command.editor/zoom-in                  "Acercar / Adelante"
-               :command.editor/zoom-out                 "Alejar / Atrás"
-               :command.editor/follow-link              "Seguir enlace bajo el cursor"
-               :command.editor/open-link-in-sidebar     "Abrir enlace en barra lateral"
-               :command.editor/expand-block-children    "Expandir"
-               :command.editor/collapse-block-children  "Colapsar"
-               :command.editor/select-block-up          "Seleccionar bloque de arriba"
-               :command.editor/select-block-down        "Seleccionar bloque de abajo"
-               :command.editor/select-all-blocks        "Seleccionar todos los bloques"
-               :command.ui/toggle-help                  "Alternar ayuda"
-               :command.git/commit                      "Confirmar"
-               :command.go/search                       "Buscar en el grafo"
-               :command.go/search-in-page               "Buscar en la página actual"
-               :command.ui/toggle-document-mode         "Alternar modo documento"
-               :command.ui/toggle-contents              "Alternar Contenido en barra lateral"
-               :command.ui/toggle-theme                 "Alternar entre tema claro/oscuro"
-               :command.ui/toggle-right-sidebar         "Alternar barra lateral"
-               :command.ui/toggle-settings              "Alternar Opciones"
-               :command.go/journals                     "Ir a los diarios"
-               :command.ui/toggle-wide-mode             "Alternar modo ancho"
-               :command.ui/toggle-brackets              "Alternar corchetes"
-               :command.search/re-index                 "Reconstruir índice de búsqueda"
-               :command.editor/bold                     "Negrita"
-               :command.editor/italics                  "Cursiva"
-               :command.editor/insert-link              "Enlace html"
-               :command.editor/highlight                "Resaltado"
-               :command.editor/undo                     "Deshacer"
-               :command.editor/redo                     "Rehacer"
-               :command.editor/copy                     "Copiar"
-               :command.editor/cut                      "Pegar"
-               :command.editor/up                       "Mover cursor arriba / Seleccionar arriba"
-               :command.editor/down                     "Mover cursor abajo / Seleccionar abajo"
-               :command.editor/left                     "Mover cursor a la izquierda / Abrir bloque seleccionado al inicio"
-               :command.editor/right                    "Mover cursor a la derecha / Abrir bloque seleccionado al final"
-               :command.editor/backspace                "Retroceso / Eliminar hacia atrás"
-               :command.editor/delete                   "Suprimir / Eliminar hacia delante"
-               :command.editor/cycle-todo               "Rotar estado TODO del elemento"
-               :command.editor/clear-block              "Borrar contenido del bloque"
-               :command.editor/kill-line-before         "Borrar linea antes del cursor"
-               :command.editor/kill-line-after          "Borrar linea despues del cursor"
-               :command.editor/beginning-of-block       "Mover cursor al inicio del bloque"
-               :command.editor/end-of-block             "Mover cursor al final del bloque"
-               :command.editor/forward-word             "Mover cursor una palabra adelante"
-               :command.editor/backward-word            "Mover cursor una palabra atrás"
-               :command.editor/forward-kill-word        "Borrar palabra posterior"
-               :command.editor/backward-kill-word       "Borrar palabra anterior"
-               :command.editor/open-edit                "Editar bloque seleccionado"
-               :command.editor/delete-selection         "Eliminar bloques seleccionados"
-               :command.editor/toggle-open-blocks       "Alternar bloques abieros, (colapsar o expandir todos)"}
-
-     :ru      {:shortcut.category/formatting            "Форматирование"
-               :shortcut.category/basics                "Базовые"
-               :shortcut.category/navigating            "Навигация"
-               :shortcut.category/block-editing         "Общее редактирование блока"
-               :shortcut.category/block-command-editing "Команды редактирования блока"
-               :shortcut.category/block-selection       "Выделение блоков (нажмите Esc для снятия выделения)"
-               :shortcut.category/toggle                "Переключатели"
-               :shortcut.category/others                "Разное"
-               :command.editor/indent                   "Увеличить отступ"
-               :command.editor/outdent                  "Уменьшить отступ"
-               :command.editor/move-block-up            "Передвинуть блок выше"
-               :command.editor/move-block-down          "Передвинуть блок ниже"
-               :command.editor/new-block                "Создать новый блок"
-               :command.editor/new-line                 "Новая строка в блоке"
-               :command.editor/zoom-in                  "Увеличить / Вперед"
-               :command.editor/zoom-out                 "Уменьшить / Назад"
-               :command.editor/follow-link              "Перейти по ссылке под курсором"
-               :command.editor/open-link-in-sidebar     "Открыть ссылку в боковой панели"
-               :command.editor/expand-block-children    "Раскрыть"
-               :command.editor/collapse-block-children  "Свернуть"
-               :command.editor/select-block-up          "Выбрать блок выше"
-               :command.editor/select-block-down        "Выбрать блок ниже"
-               :command.editor/select-all-blocks        "Выбрать все блоки"
-               :command.ui/toggle-help                  "Переключить помощь"
-               :command.git/commit                      "Подтвердить"
-               :command.go/search                       "Искать на графе"
-               :command.go/search-in-page               "Искать на текущей странице"
-               :command.ui/toggle-document-mode         "Переключить режи документа"
-               :command.ui/toggle-contents              "Переключить контент на боковой панели"
-               :command.ui/toggle-theme                 "Переключение между светлой / темной темой"
-               :command.ui/toggle-right-sidebar         "Переключить боковую панель"
-               :command.ui/toggle-settings              "Переключить параметры"
-               :command.go/journals                     "Перейти в Дневники"
-               :command.ui/toggle-wide-mode             "Переключить широкоформатный режим"
-               :command.ui/toggle-brackets              "Переключить скобки"
-               :command.search/re-index                 "Восстановить индекс поиска"
-               :command.editor/bold                     "Жирный"
-               :command.editor/italics                  "Курсив"
-               :command.editor/insert-link              "HTML ссылка"
-               :command.editor/highlight                "Выделение"
-               :command.editor/undo                     "Отменить"
-               :command.editor/redo                     "Вернуть"
-               :command.editor/copy                     "Копировать"
-               :command.editor/cut                      "Вырезать"
-               :command.editor/up                       "Переместить курсор вверх / Выбрать вверх"
-               :command.editor/down                     "Переместить курсор вниз / Выбрать вниз"
-               :command.editor/left                     "Переместить курсор влево / Открыть выбранный блок в начале"
-               :command.editor/right                    "Переместить курсор вправо / Открыть выбранный блок в конце"
-               :command.editor/backspace                "Удалить перед курсором"
-               :command.editor/delete                   "Удалить после курсора"
-               :command.editor/cycle-todo               "Переключить состояние элемента TODO"
-               :command.editor/clear-block              "Удалить содержимое блока"
-               :command.editor/kill-line-before         "Удалить строку до курсора"
-               :command.editor/kill-line-after          "Удалить строку после курсора"
-               :command.editor/beginning-of-block       "Переместите курсор в начало блока"
-               :command.editor/end-of-block             "Переместите курсор в конец блока"
-               :command.editor/forward-word             "Переместить курсор на одно слово вперед"
-               :command.editor/backward-word            "Переместить курсор на одно слово назад"
-               :command.editor/forward-kill-word        "Удалить следующее слово"
-               :command.editor/backward-kill-word       "Удалить предыдущее слово"
-               :command.editor/open-edit                "Редактировать выбранный блок"
-               :command.editor/delete-selection         "Удалить выбранные блоки"
-               :command.editor/toggle-open-blocks       "Переключить открытые блоки (свернуть или развернуть все)"}
-
-     :nb-NO   {:shortcut.category/formatting            "Formatering"
-               :shortcut.category/basics                "Basis"
-               :shortcut.category/navigating            "Navigasjon"
-               :shortcut.category/block-editing         "Blokkredigering generelt"
-               :shortcut.category/block-command-editing "Blokkredigering kommandoer"
-               :shortcut.category/block-selection       "Blokkseleksjon (trykk ESC for å avslutte)"
-               :shortcut.category/toggle                "Veksling"
-               :shortcut.category/others                "Annet"
-               :command.editor/indent                   "Innrykk inn"
-               :command.editor/outdent                  "Innrykk ut"
-               :command.editor/move-block-up            "Flytt blokk opp"
-               :command.editor/move-block-down          "Flytt blokk ned"
-               :command.editor/new-block                "Opprett ny blokk"
-               :command.editor/new-line                 "Ny linje i nåværende blokk"
-               :command.editor/zoom-in                  "Zoom inn / Fremover"
-               :command.editor/zoom-out                 "Zoom ut / Tilbake"
-               :command.editor/follow-link              "Følg lenke under markøren"
-               :command.editor/open-link-in-sidebar     "Åpne lenke i sidestolpe"
-               :command.editor/expand-block-children    "Utvid"
-               :command.editor/collapse-block-children  "Slå sammen"
-               :command.editor/select-block-up          "Velg blokk over"
-               :command.editor/select-block-down        "Velg blokk under"
-               :command.editor/select-all-blocks        "Velg alle blokker"
-               :command.ui/toggle-help                  "Vis hjelp"
-               :command.git/commit                      "Git commit beskjed"
-               :command.go/search                       "Fulltekst søk"
-               :command.go/search-in-page               "Søk på nåværende side"
-               :command.ui/toggle-document-mode         "Aktiver dokumentmodus"
-               :command.ui/toggle-contents              "Åpne favoritter i sidestolpen"
-               :command.ui/toggle-theme                 "Veksle mellom lyst og mørkt tema"
-               :command.ui/toggle-left-sidebar          "Aktiver venstre sidestolpe"
-               :command.ui/toggle-right-sidebar         "Aktiver høyre sidestolpe"
-               :command.ui/toggle-settings              "Åpne innstillinger"
-               :command.go/journals                     "Gå til dagbok"
-               :command.ui/toggle-wide-mode             "Aktiver vid-modus"
-               :command.ui/toggle-brackets              "Aktiver vising av klammer"
-               :command.search/re-index                 "Gjenoppbygg søkeindeks"
-               :command.editor/bold                     "Fet"
-               :command.editor/italics                  "Kursiv"
-               :command.editor/insert-link              "HTML lenke"
-               :command.editor/highlight                "Markering"
-               :command.editor/undo                     "Angre"
-               :command.editor/redo                     "Gjør om"
-               :command.editor/copy                     "Kopier"
-               :command.editor/cut                      "Klipp ut"
-               :command.editor/up                       "Flytt markøren opp / Velg opp"
-               :command.editor/down                     "Flytt markøren ned / Velg ned"
-               :command.editor/left                     "Flytt markøren til venstre / Åpne valgt blokk på begynnelsen"
-               :command.editor/right                    "Flytt markøren til høyre / Åpne valgt blokk på slutten"
-               :command.editor/backspace                "Backspace / Slett bakover"
-               :command.editor/delete                   "Delete / Slett forover"
-               :command.editor/cycle-todo               "Veksle TODO status for valg linje"
-               :command.editor/clear-block              "Slett alt innhold i blokken"
-               :command.editor/kill-line-before         "Slett linje foran markøren"
-               :command.editor/kill-line-after          "Slett linsje etter markøren"
-               :command.editor/beginning-of-block       "Flytt markøren til begynnelsen av blokken"
-               :command.editor/end-of-block             "Flytt markøren til slutten av blokken"
-               :command.editor/forward-word             "Flytt markøren frem ett ord"
-               :command.editor/backward-word            "Flytt markøren bakover ett ord"
-               :command.editor/forward-kill-word        "Slett ett ord forover"
-               :command.editor/backward-kill-word       "Slett ett ord bakover"
-               :command.editor/open-edit                "Rediger valgt blokk"
-               :command.editor/delete-selection         "Slett valgte blokker"
-               :command.editor/toggle-open-blocks       "Veksle åpne blokker (slå sammen eller utvid alle blokker)"}
-
-     :pt-PT   {:shortcut.category/formatting            "Formatação"
-               :shortcut.category/basics                "Básico"
-               :shortcut.category/navigating            "Navegação"
-               :shortcut.category/block-editing         "Edição geral de blocos"
-               :shortcut.category/block-command-editing "Comandos de edição de blocos"
-               :shortcut.category/block-selection       "Seleção de blocos (premir Esc para sair)"
-               :shortcut.category/toggle                "Alternar"
-               :shortcut.category/others                "Outros"
-               :command.editor/indent                   "Aumentar avanço de parágrafo"
-               :command.editor/outdent                  "Diminuir avanço de parágrafo"
-               :command.editor/move-block-up            "Mover bloco para cima"
-               :command.editor/move-block-down          "Mover bloco para baixo"
-               :command.editor/new-block                "Criar novo bloco"
-               :command.editor/new-line                 "Nova linha no bloco actual"
-               :command.editor/zoom-in                  "Aproximar / Para a frente"
-               :command.editor/zoom-out                 "Afastar / Para trás"
-               :command.editor/follow-link              "Seguir ligação sob o cursor"
-               :command.editor/open-link-in-sidebar     "Abrir ligação na barra lateral"
-               :command.editor/expand-block-children    "Expandir"
-               :command.editor/collapse-block-children  "Colapsar"
-               :command.editor/select-block-up          "Selecionar bloco acima"
-               :command.editor/select-block-down        "Selecionar bloco abaixo"
-               :command.editor/select-all-blocks        "Selecionar todos os blocos"
-               :command.ui/toggle-help                  "Alternar ajuda"
-               :command.git/commit                      "Confirmar"
-               :command.go/search                       "Pesquisar no grafo"
-               :command.go/search-in-page               "Pesquisar na página atual"
-               :command.ui/toggle-document-mode         "Alternar modo de documento"
-               :command.ui/toggle-contents              "Alternar Conteúdo na barra lateral"
-               :command.ui/toggle-theme                 "Alternar entre tema claro/escuro"
-               :command.ui/toggle-right-sidebar         "Alternar barra lateral"
-               :command.ui/toggle-settings              "Alternar Opções"
-               :command.go/journals                     "Ir para diários"
-               :command.ui/toggle-wide-mode             "Alternar modo de ecrã amplo"
-               :command.ui/toggle-brackets              "Alternar parênteses rectos"
-               :command.search/re-index                 "Reconstruir índice de pesquisa"
-               :command.editor/bold                     "Negrito"
-               :command.editor/italics                  "Itálico"
-               :command.editor/insert-link              "Inserir ligação html"
-               :command.editor/highlight                "Realçado"
-               :command.editor/undo                     "Desfazer"
-               :command.editor/redo                     "Refazer"
-               :command.editor/copy                     "Copiar"
-               :command.editor/cut                      "Cortar"
-               :command.editor/up                       "Mover cursor para cima / Selecionar para cima"
-               :command.editor/down                     "Mover cursor para baixo / Selecionar para baixo"
-               :command.editor/left                     "Mover cursor para a esquerda / Abrir bloco selecionado no início"
-               :command.editor/right                    "Mover cursor para a direita / Abrir bloco selecionado no final"
-               :command.editor/backspace                "Retroceder / Eliminar para atrás"
-               :command.editor/delete                   "Apagar / Eliminar para a frente"
-               :command.editor/cycle-todo               "Alternar estado TODO do elemento"
-               :command.editor/clear-block              "Apagar conteúdo do bloco"
-               :command.editor/kill-line-before         "Apagar linha antes do cursor"
-               :command.editor/kill-line-after          "Apagar linha depois do cursor"
-               :command.editor/beginning-of-block       "Mover o cursor para o início do bloco"
-               :command.editor/end-of-block             "Mover o cursor para o fim do bloco"
-               :command.editor/forward-word             "Mover o cursor para a próxima palavra"
-               :command.editor/backward-word            "Mover o cursor para a palavra anterior"
-               :command.editor/forward-kill-word        "Apagar a próxima palavra"
-               :command.editor/backward-kill-word       "Apagar a palavra anterior"
-               :command.editor/open-edit                "Editar bloco selecionado"
-               :command.editor/delete-selection         "Eliminar blocos selecionados"
-               :command.editor/toggle-open-blocks       "Alternar blocos abertos (colapsar ou expandir todos)"}
-
-     :pt-BR   {:shortcut.category/formatting            "Formatação"
-               :shortcut.category/basics                "Básico"
-               :shortcut.category/navigating            "Navegação"
-               :shortcut.category/block-editing         "Edição geral de blocos"
-               :shortcut.category/block-command-editing "Comandos de edição de blocos"
-               :shortcut.category/block-selection       "Seleção de blocos (aperte Esc para sair)"
-               :shortcut.category/toggle                "Alternar"
-               :shortcut.category/others                "Outros"
-               :command.editor/indent                   "Aumentar avanço de parágrafo"
-               :command.editor/outdent                  "Diminuir avanço de parágrafo"
-               :command.editor/move-block-up            "Mover bloco para cima"
-               :command.editor/move-block-down          "Mover bloco para baixo"
-               :command.editor/new-block                "Criar novo bloco"
-               :command.editor/new-line                 "Nova linha no bloco actual"
-               :command.editor/zoom-in                  "Aproximar / Para a frente"
-               :command.editor/zoom-out                 "Afastar / Para trás"
-               :command.editor/follow-link              "Seguir ligação sob o cursor"
-               :command.editor/open-link-in-sidebar     "Abrir ligação na barra lateral"
-               :command.editor/expand-block-children    "Expandir"
-               :command.editor/collapse-block-children  "Recolher"
-               :command.editor/select-block-up          "Selecionar bloco acima"
-               :command.editor/select-block-down        "Selecionar bloco abaixo"
-               :command.editor/select-all-blocks        "Selecionar todos os blocos"
-               :command.ui/toggle-help                  "Alternar ajuda"
-               :command.git/commit                      "Confirmar"
-               :command.go/search                       "Pesquisar no grafo"
-               :command.go/search-in-page               "Pesquisar na página atual"
-               :command.ui/toggle-document-mode         "Alternar modo de documento"
-               :command.ui/toggle-contents              "Alternar Conteúdo na barra lateral"
-               :command.ui/toggle-theme                 "Alternar entre tema claro/escuro"
-               :command.ui/toggle-right-sidebar         "Alternar barra lateral"
-               :command.ui/toggle-settings              "Alternar Opções"
-               :command.go/journals                     "Ir para diários"
-               :command.ui/toggle-wide-mode             "Alternar largura extendida"
-               :command.ui/toggle-brackets              "Alternar colchetes"
-               :command.search/re-index                 "Reconstruir índice de pesquisa"
-               :command.editor/bold                     "Negrito"
-               :command.editor/italics                  "Itálico"
-               :command.editor/insert-link              "Inserir vínculo"
-               :command.editor/highlight                "Realçado"
-               :command.editor/undo                     "Desfazer"
-               :command.editor/redo                     "Refazer"
-               :command.editor/copy                     "Copiar"
-               :command.editor/cut                      "Cortar"
-               :command.editor/up                       "Mover cursor para cima / Selecionar para cima"
-               :command.editor/down                     "Mover cursor para baixo / Selecionar para baixo"
-               :command.editor/left                     "Mover cursor para a esquerda / Abrir bloco selecionado no início"
-               :command.editor/right                    "Mover cursor para a direita / Abrir bloco selecionado no final"
-               :command.editor/backspace                "Retroceder / Eliminar para trás"
-               :command.editor/delete                   "Deletar / Eliminar para frente"
-               :command.editor/cycle-todo               "Alternar estado A FAZER do elemento"
-               :command.editor/clear-block              "Apagar conteúdo do bloco"
-               :command.editor/kill-line-before         "Apagar linha antes do cursor"
-               :command.editor/kill-line-after          "Apagar linha depois do cursor"
-               :command.editor/beginning-of-block       "Mover o cursor para o início do bloco"
-               :command.editor/end-of-block             "Mover o cursor para o fim do bloco"
-               :command.editor/forward-word             "Mover o cursor para a próxima palavra"
-               :command.editor/backward-word            "Mover o cursor para a palavra anterior"
-               :command.editor/forward-kill-word        "Apagar a próxima palavra"
-               :command.editor/backward-kill-word       "Apagar a palavra anterior"
-               :command.editor/open-edit                "Editar bloco selecionado"
-               :command.editor/delete-selection         "Eliminar blocos selecionados"
-               :command.editor/toggle-open-blocks       "Alternar blocos abertos (recolher ou expandir todos)"
-               :command.auto-complete/complete          "Auto-completar: Escolha o item selecionado"
-               :command.auto-complete/next              "Auto-completar: Selecione o próximo item"
-               :command.auto-complete/prev              "Auto-completar: Selecione o item anterior"
-               :command.auto-complete/shift-complete    "Auto-completar: Abra o item selecionado na barra lateral"
-               :command.cards/forgotten                 "Cartas: Esquecido"
-               :command.cards/next-card                 "Cartas: Próxima carta"
-               :command.cards/recall                    "Cartas: Demorar um pouco para lembrar"
-               :command.cards/remembered                "Cartas: Relembrado"
-               :command.cards/toggle-answers            "Cartas: mostrar/esconder as respostas/clozes"
-               :command.command/toggle-favorite         "Adicionar para/remover dos favoritos"
-               :command.command-palette/toggle          "Editar atalhos"
-               :command.date-picker/complete            "Pegar data: Escolha o dia selecionado"
-               :command.date-picker/next-day            "Pegar data: Selecione o próximo dia"
-               :command.date-picker/next-week           "Pegar data: Selecione a próxima semana"
-               :command.date-picker/prev-day            "Pegar data: Selecione o dia anterior"
-               :command.date-picker/prev-week           "Pegar data: Selecione a semana anterior"
-               :command.editor/escape-editing           "Sair da edição"
-               :command.editor/insert-youtube-timestamp "Inserir timestamp do youtube"
-               :command.editor/paste-text-in-one-block-at-point "Colar texto em um bloco no ponto"
-               :command.editor/replace-block-reference-at-point "Substitua a referência do bloco pelo seu conteúdo no ponto"
-               :command.editor/strike-through           "Tachar"
-               :command.go/all-pages                    "Ir para todas as páginas"
-               :command.go/backward                     "Voltar"
-               :command.go/flashcards                   "Trocar flashcards"
-               :command.go/forward                      "Avançar"
-               :command.go/graph-view                   "Ir para o gráfico"
-               :command.go/home                         "Volar para o inicio"
-               :command.go/keyboard-shortcuts           "Ir para os atalhos do teclado"
-               :command.go/next-journal                 "Ir ao proximo jornal"
-               :command.go/prev-journal                 "Ir ao jornal anterior"
-               :command.go/tomorrow                     "Ir para amanhã"
-               :command.graph/add                       "Adicionar um gráfico"
-               :command.graph/open                      "Selecionar gráfico para abrir"
-               :command.graph/remove                    "Remover um gráfico"
-               :command.pdf/next-page                   "Próxima página do atual pdf doc"
-               :command.pdf/previous-page               "Página anterior do atual pdf doc"
-               :command.sidebar/clear                   "Limpar tudo da barra lateral direita"
-               :command.sidebar/open-today-page         "Abrir a página de hoje na barra lateral direita"
-               :command.ui/select-theme-color           "Selecionar as cores do tema disponível"
-               :command.ui/toggle-cards                 "Trocar cartas"
-               :command.ui/toggle-left-sidebar          "Trocar barra lateral esquerda"
-               :command.auto-complete/open-link         "Auto-completar: Abra o item selecionado no navegador"
-               :command.command/run                     "Execute o comando Git"
-               :command.editor/copy-current-file        "Copiar o arquivo atual"
-               :command.editor/open-file-in-default-app "Abra o arquivo no aplicativo padrão"
-               :command.editor/open-file-in-directory   "Abra o arquivo na pasta"
-               :command.graph/save                      "Salvar gráfico atual no computador"
-               :command.misc/copy                       "Copiar (copiar seleção ou referência do bloco)"
-               :command.ui/goto-plugins                 "Ir para o painel de plugins"
-               :command.ui/open-new-window              "Abra uma nova janela"
-               }
-
-    :ja   {:shortcut.category/formatting                "フォーマット"
-               :shortcut.category/basics                "基本操作"
-               :shortcut.category/navigating            "ナビゲーション"
-               :shortcut.category/block-editing         "ブロック単位の編集"
-               :shortcut.category/block-command-editing "ブロック内の編集"
-               :shortcut.category/block-selection       "ブロック選択"
-               :shortcut.category/toggle                "トグル"
-               :shortcut.category/others                "その他"
-               :command.editor/indent                   "インデント"
-               :command.editor/outdent                  "アウトデント"
-               :command.editor/move-block-up            "ブロックを上へ移動"
-               :command.editor/move-block-down          "ブロックを下へ移動"
-               :command.editor/new-block                "新しいブロック"
-               :command.editor/new-line                 "新しい行"
-               :command.editor/zoom-in                  "ズームイン"
-               :command.editor/zoom-out                 "ズームアウト"
-               :command.editor/follow-link              "リンクを開く"
-               :command.editor/open-link-in-sidebar     "サイドバーでリンクを開く"
-               :command.editor/expand-block-children    "子ブロックを展開"
-               :command.editor/collapse-block-children  "子ブロックを折り畳み"
-               :command.editor/select-block-up          "上のブロックを選択"
-               :command.editor/select-block-down        "下のブロックを選択"
-               :command.editor/select-all-blocks        "全てのブロックを選択"
-               :command.editor/replace-block-reference-at-point        "この場所でブロック参照をそのコンテンツで置き換え"
-               :command.editor/paste-text-in-one-block-at-point        "カーソル位置へテキストとして貼り付け"
-               :command.ui/toggle-help                  "ヘルプのトグル"
-               :command.git/commit                      "コミット"
-               :command.go/search                       "検索"
-               :command.go/backward                     "戻る"
-               :command.go/forward                      "前へ"
-               :command.go/flashcards                   "フラッシュカードのトグル"
-               :command.go/home                         "ホームへ移動"
-               :command.go/all-pages                    "全ページへ移動"
-               :command.go/graph-view                   "グラフビューへ移動"
-               :command.go/tomorrow                     "明日へ移動"
-               :command.go/next-journal                 "次の日誌へ移動"
-               :command.go/prev-journal                 "前の日誌へ移動"
-               :command.go/keyboard-shortcuts           "キーボードショートカットへ移動"
-               :command.ui/open-new-window              "別のウィンドウを開く"
-               :command.go/search-in-page               "ページ内を検索"
-               :command.ui/toggle-document-mode         "ドキュメントモードのトグル"
-               :command.ui/toggle-contents              "コンテンツのトグル"
-               :command.ui/toggle-theme                 "テーマのトグル"
-               :command.ui/toggle-right-sidebar         "右サイドバーのトグル"
-               :command.ui/toggle-settings              "トグル設定"
-               :command.go/journals                     "日誌"
-               :command.ui/toggle-wide-mode             "ワイドモードのトグル"
-               :command.ui/toggle-brackets              "ブラケット表示On/Offのトグル"
-               :command.search/re-index                 "インデックス再構築"
-               :command.editor/bold                     "太字"
-               :command.editor/italics                  "斜体"
-               :command.editor/insert-link              "リンク挿入"
-               :command.editor/highlight                "ハイライト"
-               :command.editor/undo                     "元に戻す"
-               :command.editor/redo                     "やり直し"
-               :command.editor/copy                     "コピー"
-               :command.editor/cut                      "切り取り"
-               :command.editor/up                       "カーソル上移動 / 上を選択"
-               :command.editor/down                     "カーソル下移動 / 下を選択"
-               :command.editor/left                     "カーソル左移動 / 左を選択"
-               :command.editor/right                    "カーソル右移動 / 右を選択"
-               :command.editor/backspace                "前の文字を削除"
-               :command.editor/delete                   "次の文字を削除"
-               :command.editor/cycle-todo               "現在の項目の TODO 状態をローテートさせる"
-               :command.editor/clear-block              "ブロックをクリア"
-               :command.editor/kill-line-before         "行中のカーソル位置から前を削除"
-               :command.editor/kill-line-after          "行中のカーソル位置から先を削除"
-               :command.editor/beginning-of-block       "カーソルをブロックのはじめへ移動"
-               :command.editor/end-of-block             "カーソルをブロックの最後へ移動"
-               :command.editor/forward-word             "カーソルを次の単語へ移動"
-               :command.editor/backward-word            "カーソルを前の単語へ移動"
-               :command.editor/forward-kill-word        "次の単語を削除"
-               :command.editor/backward-kill-word       "前の単語を削除"
-               :command.editor/open-edit                "選択したブロックを編集"
-               :command.editor/delete-selection         "選択したブロックを削除"
-               :command.editor/toggle-open-blocks       "ブロック展開のトグル(全てのブロックを折りたたみ/展開)"
-               :command.ui/toggle-cards                 "フラッシュカードのトグル"
-               :command.ui/toggle-left-sidebar          "左サイドバーのトグル"
-               :command.pdf/next-page                   "現在のPDF文書で次のページへ"
-               :command.pdf/previous-page               "現在のPDF文書で前のページへ"
-               :command.command/run                             "Git コマンドを実行"
-               :command.command-palette/toggle                  "コマンドパレットのトグル"
-               :command.graph/open                              "グラフを選択して開く"
-               :command.graph/remove                            "グラフを削除"
-               :command.graph/add                               "グラフを追加"
-               :command.graph/save                              "現在のグラフをディスクへ保存"
-               :command.sidebar/clear                           "右サイドバーの内容を全てクリア"
-               :command.sidebar/open-today-page                 "今日の日誌を右サイドバーで開く"
-               :command.editor/insert-youtube-timestamp         "YouTubeのタイプスタンプを挿入"
-               :command.auto-complete/complete                  "自動補完:項目を選択"
-               :command.auto-complete/prev                      "自動補完:前の項目を選択"
-               :command.auto-complete/next                      "自動補完:次の項目を選択"
-               :command.auto-complete/shift-complete            "自動補完:選択した項目をサイドバーで開く"
-               :command.date-picker/complete                    "日付選択:選択した日で決定"
-               :command.date-picker/prev-day                    "日付選択:前の日を選ぶ"
-               :command.date-picker/next-day                    "日付選択:次の日を選ぶ"
-               :command.date-picker/prev-week                   "日付選択:前の週を選ぶ"
-               :command.date-picker/next-week                   "日付選択:次の週を選ぶ"
-               :command.cards/forgotten                         "カード:忘れられた"
-               :command.cards/next-card                         "カード:次のカード"
-               :command.cards/recall                            "カード:思い出すのに時間がかかる"
-               :command.cards/remembered                        "カード:覚えている"
-               :command.cards/toggle-answers                    "カード:答えや穴埋めの表示/隠すのトグル"
-               :command.command/toggle-favorite                 "お気に入りへの追加/削除のトグル"
-               :command.editor/copy-current-file                "現在のファイルをコピー"
-               :command.editor/escape-editing                   "編集をやめる"
-               :command.editor/open-file-in-default-app         "ファイルを規定のアプリで開く"
-               :command.editor/open-file-in-directory           "ファイルをディレクトリで開く"
-               :command.editor/strike-through                   "打ち消し線"
-               :command.misc/copy                               "コピー"
-               :command.ui/goto-plugins                         "プラグインへ"
-               :command.ui/select-theme-color                   "利用可能なテーマ色を選択"
-               }}))

+ 778 - 0
src/main/frontend/modules/shortcut/dicts.cljc

@@ -0,0 +1,778 @@
+(ns ^:bb-compatible frontend.modules.shortcut.dicts
+  "Provides dictionary entries for shortcuts"
+  (:require [medley.core :as medley]))
+
+(defn- decorate-namespace [k]
+  (let [n (name k)
+        ns (namespace k)]
+    (keyword (str "command." ns) n)))
+
+(def ^:large-vars/data-var all-default-keyboard-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            "Previous page of current pdf doc"
+   :pdf/next-page                "Next page 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/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/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/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/cut                     "Cut"
+   :editor/undo                    "Undo"
+   :editor/redo                    "Redo"
+   :editor/insert-link             "HTML Link"
+   :editor/select-all-blocks       "Select all blocks"
+   :editor/zoom-in                 "Zoom in editing block / Forwards otherwise"
+   :editor/zoom-out                "Zoom out editing block / Backwards otherwise"
+   :ui/toggle-brackets             "Toggle whether to display brackets"
+   :go/search-in-page              "Search in the current page"
+   :go/search                      "Full text search"
+   :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/clear                  "Clear all in the right sidebar"
+   :misc/copy                      "mod+c"
+   :command-palette/toggle         "Toggle command palette"
+   :graph/open                     "Select graph to open"
+   :graph/remove                   "Remove a graph"
+   :graph/add                      "Add a graph"
+   :graph/save                     "Save current graph to disk"
+   :command/run                    "Run git command"
+   :go/home                        "Go to home"
+   :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"
+   :ui/toggle-wide-mode             "Toggle wide mode"
+   :ui/select-theme-color           "Select available theme colors"
+   :ui/goto-plugins                 "Go to plugins dashboard"
+   :editor/toggle-open-blocks       "Toggle open blocks (collapse or expand all blocks)"
+   :ui/toggle-cards                 "Toggle cards"
+   :git/commit                      "Git commit message"})
+
+(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/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 namespce
+        (medley/map-keys decorate-namespace all-default-keyboard-shortcuts)
+        category)
+   :zh-CN   {:shortcut.category/formatting            "格式化"
+             :shortcut.category/basics                "基础操作"
+             :shortcut.category/navigating            "移动"
+             :shortcut.category/block-editing         "块编辑基本"
+             :shortcut.category/block-command-editing "块编辑文本操作"
+             :shortcut.category/block-selection       "块选择操作"
+             :shortcut.category/toggle                "切换"
+             :shortcut.category/others                "其他"
+             :command.editor/indent                   "缩进块标签"
+             :command.editor/outdent                  "取消缩进块"
+             :command.editor/move-block-up            "向上移动块"
+             :command.editor/move-block-down          "向下移动块"
+             :command.editor/new-block                "创建块"
+             :command.editor/new-line                 "块中新建行"
+             :command.editor/zoom-in                  "聚焦"
+             :command.editor/zoom-out                 "退出聚焦"
+             :command.editor/follow-link              "跟随光标下的链接"
+             :command.editor/open-link-in-sidebar     "在侧边栏打开"
+             :command.editor/expand-block-children    "展开"
+             :command.editor/collapse-block-children  "折叠"
+             :command.editor/select-block-up          "选择上方的块"
+             :command.editor/select-block-down        "选择下方的块"
+             :command.editor/select-all-blocks        "选择所有块"
+             :command.ui/toggle-help                  "显示/关闭帮助"
+             :command.git/commit                      "提交消息"
+             :command.go/search                       "全文搜索"
+             :command.go/backward                     "回退"
+             :command.go/forward                      "前进"
+             :command.go/search-in-page               "在当前页面搜索"
+             :command.ui/toggle-document-mode         "切换文档模式"
+             :command.ui/toggle-contents              "打开/关闭目录"
+             :command.ui/toggle-theme                 "在暗色/亮色主题之间切换"
+             :command.ui/toggle-right-sidebar         "启用/关闭右侧栏"
+             :command.ui/toggle-settings              "显示/关闭设置"
+             :command.go/journals                     "跳转到日记"
+             :command.ui/toggle-wide-mode             "切换宽屏模式"
+             :command.ui/toggle-brackets              "切换是否显示括号"
+             :command.search/re-index                 "重新建立搜索索引"
+             :command.editor/bold                     "粗体"
+             :command.editor/italics                  "斜体"
+             :command.editor/insert-link              "Html 链接"
+             :command.editor/highlight                "高亮"
+             :command.editor/undo                     "撤销"
+             :command.editor/redo                     "重做"
+             :command.editor/copy                     "复制"
+             :command.editor/cut                      "剪切"
+             :command.editor/up                       "向上移动光标 / 向上选择"
+             :command.editor/down                     "向下移动光标 / 向下选择"
+             :command.editor/left                     "向左移动光标 / 向左选择"
+             :command.editor/right                    "向右移动光标 / 向右选择"
+             :command.editor/backspace                "向左删除"
+             :command.editor/delete                   "向右删除"
+             :command.editor/cycle-todo               "切换TODO状态"
+             :command.editor/clear-block              "清除块内容"
+             :command.editor/kill-line-before         "删除光标右侧行"
+             :command.editor/kill-line-after          "删除光标左侧行"
+             :command.editor/beginning-of-block       "移动光标到块开始位置"
+             :command.editor/end-of-block             "移动光标到块末尾"
+             :command.editor/forward-word             "光标向后移动一个单词"
+             :command.editor/backward-word            "光标向前移动一个单词"
+             :command.editor/forward-kill-word        "向后删除一个单词"
+             :command.editor/backward-kill-word       "向前删除一个单词"
+             :command.editor/open-edit                "编辑选中块"
+             :command.editor/delete-selection         "删除选中块"
+             :command.editor/toggle-open-blocks       "切换折叠/展开所有块(非编辑状态)"}
+
+   :zh-Hant {:command.editor/indent                  "縮進塊標簽"
+             :command.editor/outdent                 "取消縮進塊"
+             :command.editor/move-block-up           "向上移動塊"
+             :command.editor/move-block-down         "向下移動塊"
+             :command.editor/new-block               "創建塊"
+             :command.editor/new-line                "塊中新建行"
+             :command.editor/zoom-in                 "聚焦"
+             :command.editor/zoom-out                "推出聚焦"
+             :command.editor/follow-link             "跟隨光標下的鏈接"
+             :command.editor/open-link-in-sidebar    "在側邊欄打開"
+             :command.editor/expand-block-children   "展開"
+             :command.editor/collapse-block-children "折疊"
+             :command.editor/select-block-up         "選擇上方的塊"
+             :command.editor/select-block-down       "選擇下方的塊"
+             :command.editor/select-all-blocks       "選擇所有塊"
+             :command.ui/toggle-help                 "顯示/關閉幫助"
+             :command.git/commit                     "提交消息"
+             :command.go/search                      "全文搜索"
+             :command.ui/toggle-document-mode        "切換文檔模式"
+             :command.ui/toggle-theme                "“在暗色/亮色主題之間切換”"
+             :command.ui/toggle-right-sidebar        "啟用/關閉右側欄"
+             :command.go/journals                    "跳轉到日記"}
+
+   :de      {:shortcut.category/formatting           "Formatierung"
+             :command.editor/indent                  "Block einrücken"
+             :command.editor/outdent                 "Block ausrücken"
+             :command.editor/move-block-up           "Block nach oben verschieben"
+             :command.editor/move-block-down         "Block nach unten verschieben"
+             :command.editor/new-block               "Neuen Block erstellen"
+             :command.editor/new-line                "Neue Zeile innerhalb des Blocks erstellen"
+             :command.editor/zoom-in                 "Heranzoomen"
+             :command.editor/zoom-out                "Herauszoomen"
+             :command.editor/follow-link             "Link unter dem Cursor folgen"
+             :command.editor/open-link-in-sidebar    "Link in Seitenleiste öffnen"
+             :command.editor/expand-block-children   "Erweitern"
+             :command.editor/collapse-block-children "Zusammenklappen"
+             :command.editor/select-block-up         "Block oberhalb auswählen"
+             :command.ui/toggle-help                 "Hilfe aktivieren"
+             :command.go/search                      "Volltextsuche"
+             :command.ui/toggle-document-mode        "Dokumentenmodus umschalten"
+             :command.ui/toggle-theme                "Umschalten zwischen dunklem/hellem Thema"
+             :command.ui/toggle-right-sidebar        "Rechte Seitenleiste umschalten"
+             :command.go/journals                    "Zu Journalen springen"
+             :command.git/commit                     "Git Commit-Nachricht"
+             :command.editor/select-block-down       "Block unterhalb auswählen"
+             :command.editor/select-all-blocks       "Alle Blöcke auswählen"}
+
+   :fr      {: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"
+             :command.editor/move-block-down         "Déplacer un bloc en dessous"
+             :command.editor/new-block               "Créer un nouveau bloc"
+             :command.editor/new-line                "Aller à la ligne dans un bloc"
+             :command.editor/zoom-in                 "Zoomer"
+             :command.editor/zoom-out                "Dézoomer"
+             :command.editor/follow-link             "Suivre le lien sous le curseur"
+             :command.editor/open-link-in-sidebar    "Ouvrir le lien dans la barre latérale"
+             :command.editor/expand-block-children   "Etendre"
+             :command.editor/collapse-block-children "Réduire"
+             :command.editor/select-block-up         "Sélectionner le bloc au dessus"
+             :command.editor/select-block-down       "Sélectionner le bloc en dessous"
+             :command.editor/select-all-blocks       "Sélectionner tous les blocs"
+             :command.ui/toggle-help                 "Afficher l'aide"
+             :command.git/commit                     "Message de commit Git"
+             :command.go/search                      "Recherche globale dans le texte"
+             :command.ui/toggle-document-mode        "Intervertir le mode document"
+             :command.ui/toggle-theme                "Intervertir le thème foncé/clair"
+             :command.ui/toggle-right-sidebar        "Afficher/cacher la barre latérale"
+             :command.go/journals                    "Aller au Journal"}
+
+   :af      {:shortcut.category/formatting           "Formatering"
+             :command.editor/indent                  "Ingekeepte blok oortjie"
+             :command.editor/outdent                 "Oningekeepte blok"
+             :command.editor/move-block-up           "Skuif Blok Boontoe"
+             :command.editor/move-block-down         "Skuif Blok Ondertoe"
+             :command.editor/new-block               "Skep 'n nuwe blok"
+             :command.editor/new-line                "Nuwe lyn in blok"
+             :command.editor/zoom-in                 "Zoem in"
+             :command.editor/zoom-out                "Zoem uit"
+             :command.editor/follow-link             "Volg die skakel onder die wyser"
+             :command.editor/open-link-in-sidebar    "Maak skakel in kantlys oop"
+             :command.editor/expand-block-children   "Brei uit"
+             :command.editor/collapse-block-children "Vou in"
+             :command.editor/select-block-up         "Kies blok bo"
+             :command.editor/select-block-down       "Kies blok onder"
+             :command.editor/select-all-blocks       "Kies alle blokke"
+             :command.ui/toggle-help                 "Wissel help"
+             :command.git/commit                     "Jou git stoor boodskap"
+             :command.go/search                      "Volteks soek"
+             :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"}
+
+   :es      {:shortcut.category/formatting            "Formato"
+             :shortcut.category/basics                "Básico"
+             :shortcut.category/navigating            "Navegación"
+             :shortcut.category/block-editing         "Edición de bloque general"
+             :shortcut.category/block-command-editing "Comandos edición de bloque"
+             :shortcut.category/block-selection       "Selección de bloques (pulsar Esc para salir)"
+             :shortcut.category/toggle                "Alternar"
+             :shortcut.category/others                "Otros"
+             :command.editor/indent                   "Aumentar sangría"
+             :command.editor/outdent                  "Disminuir sangría"
+             :command.editor/move-block-up            "Mover bloque arriba"
+             :command.editor/move-block-down          "Mover bloque abajo"
+             :command.editor/new-block                "Crear bloque nuevo"
+             :command.editor/new-line                 "Nueva linea en bloque"
+             :command.editor/zoom-in                  "Acercar / Adelante"
+             :command.editor/zoom-out                 "Alejar / Atrás"
+             :command.editor/follow-link              "Seguir enlace bajo el cursor"
+             :command.editor/open-link-in-sidebar     "Abrir enlace en barra lateral"
+             :command.editor/expand-block-children    "Expandir"
+             :command.editor/collapse-block-children  "Colapsar"
+             :command.editor/select-block-up          "Seleccionar bloque de arriba"
+             :command.editor/select-block-down        "Seleccionar bloque de abajo"
+             :command.editor/select-all-blocks        "Seleccionar todos los bloques"
+             :command.ui/toggle-help                  "Alternar ayuda"
+             :command.git/commit                      "Confirmar"
+             :command.go/search                       "Buscar en el grafo"
+             :command.go/search-in-page               "Buscar en la página actual"
+             :command.ui/toggle-document-mode         "Alternar modo documento"
+             :command.ui/toggle-contents              "Alternar Contenido en barra lateral"
+             :command.ui/toggle-theme                 "Alternar entre tema claro/oscuro"
+             :command.ui/toggle-right-sidebar         "Alternar barra lateral"
+             :command.ui/toggle-settings              "Alternar Opciones"
+             :command.go/journals                     "Ir a los diarios"
+             :command.ui/toggle-wide-mode             "Alternar modo ancho"
+             :command.ui/toggle-brackets              "Alternar corchetes"
+             :command.search/re-index                 "Reconstruir índice de búsqueda"
+             :command.editor/bold                     "Negrita"
+             :command.editor/italics                  "Cursiva"
+             :command.editor/insert-link              "Enlace html"
+             :command.editor/highlight                "Resaltado"
+             :command.editor/undo                     "Deshacer"
+             :command.editor/redo                     "Rehacer"
+             :command.editor/copy                     "Copiar"
+             :command.editor/cut                      "Pegar"
+             :command.editor/up                       "Mover cursor arriba / Seleccionar arriba"
+             :command.editor/down                     "Mover cursor abajo / Seleccionar abajo"
+             :command.editor/left                     "Mover cursor a la izquierda / Abrir bloque seleccionado al inicio"
+             :command.editor/right                    "Mover cursor a la derecha / Abrir bloque seleccionado al final"
+             :command.editor/backspace                "Retroceso / Eliminar hacia atrás"
+             :command.editor/delete                   "Suprimir / Eliminar hacia delante"
+             :command.editor/cycle-todo               "Rotar estado TODO del elemento"
+             :command.editor/clear-block              "Borrar contenido del bloque"
+             :command.editor/kill-line-before         "Borrar linea antes del cursor"
+             :command.editor/kill-line-after          "Borrar linea despues del cursor"
+             :command.editor/beginning-of-block       "Mover cursor al inicio del bloque"
+             :command.editor/end-of-block             "Mover cursor al final del bloque"
+             :command.editor/forward-word             "Mover cursor una palabra adelante"
+             :command.editor/backward-word            "Mover cursor una palabra atrás"
+             :command.editor/forward-kill-word        "Borrar palabra posterior"
+             :command.editor/backward-kill-word       "Borrar palabra anterior"
+             :command.editor/open-edit                "Editar bloque seleccionado"
+             :command.editor/delete-selection         "Eliminar bloques seleccionados"
+             :command.editor/toggle-open-blocks       "Alternar bloques abieros, (colapsar o expandir todos)"}
+
+   :ru      {:shortcut.category/formatting            "Форматирование"
+             :shortcut.category/basics                "Базовые"
+             :shortcut.category/navigating            "Навигация"
+             :shortcut.category/block-editing         "Общее редактирование блока"
+             :shortcut.category/block-command-editing "Команды редактирования блока"
+             :shortcut.category/block-selection       "Выделение блоков (нажмите Esc для снятия выделения)"
+             :shortcut.category/toggle                "Переключатели"
+             :shortcut.category/others                "Разное"
+             :command.editor/indent                   "Увеличить отступ"
+             :command.editor/outdent                  "Уменьшить отступ"
+             :command.editor/move-block-up            "Передвинуть блок выше"
+             :command.editor/move-block-down          "Передвинуть блок ниже"
+             :command.editor/new-block                "Создать новый блок"
+             :command.editor/new-line                 "Новая строка в блоке"
+             :command.editor/zoom-in                  "Увеличить / Вперед"
+             :command.editor/zoom-out                 "Уменьшить / Назад"
+             :command.editor/follow-link              "Перейти по ссылке под курсором"
+             :command.editor/open-link-in-sidebar     "Открыть ссылку в боковой панели"
+             :command.editor/expand-block-children    "Раскрыть"
+             :command.editor/collapse-block-children  "Свернуть"
+             :command.editor/select-block-up          "Выбрать блок выше"
+             :command.editor/select-block-down        "Выбрать блок ниже"
+             :command.editor/select-all-blocks        "Выбрать все блоки"
+             :command.ui/toggle-help                  "Переключить помощь"
+             :command.git/commit                      "Подтвердить"
+             :command.go/search                       "Искать на графе"
+             :command.go/search-in-page               "Искать на текущей странице"
+             :command.ui/toggle-document-mode         "Переключить режи документа"
+             :command.ui/toggle-contents              "Переключить контент на боковой панели"
+             :command.ui/toggle-theme                 "Переключение между светлой / темной темой"
+             :command.ui/toggle-right-sidebar         "Переключить боковую панель"
+             :command.ui/toggle-settings              "Переключить параметры"
+             :command.go/journals                     "Перейти в Дневники"
+             :command.ui/toggle-wide-mode             "Переключить широкоформатный режим"
+             :command.ui/toggle-brackets              "Переключить скобки"
+             :command.search/re-index                 "Восстановить индекс поиска"
+             :command.editor/bold                     "Жирный"
+             :command.editor/italics                  "Курсив"
+             :command.editor/insert-link              "HTML ссылка"
+             :command.editor/highlight                "Выделение"
+             :command.editor/undo                     "Отменить"
+             :command.editor/redo                     "Вернуть"
+             :command.editor/copy                     "Копировать"
+             :command.editor/cut                      "Вырезать"
+             :command.editor/up                       "Переместить курсор вверх / Выбрать вверх"
+             :command.editor/down                     "Переместить курсор вниз / Выбрать вниз"
+             :command.editor/left                     "Переместить курсор влево / Открыть выбранный блок в начале"
+             :command.editor/right                    "Переместить курсор вправо / Открыть выбранный блок в конце"
+             :command.editor/backspace                "Удалить перед курсором"
+             :command.editor/delete                   "Удалить после курсора"
+             :command.editor/cycle-todo               "Переключить состояние элемента TODO"
+             :command.editor/clear-block              "Удалить содержимое блока"
+             :command.editor/kill-line-before         "Удалить строку до курсора"
+             :command.editor/kill-line-after          "Удалить строку после курсора"
+             :command.editor/beginning-of-block       "Переместите курсор в начало блока"
+             :command.editor/end-of-block             "Переместите курсор в конец блока"
+             :command.editor/forward-word             "Переместить курсор на одно слово вперед"
+             :command.editor/backward-word            "Переместить курсор на одно слово назад"
+             :command.editor/forward-kill-word        "Удалить следующее слово"
+             :command.editor/backward-kill-word       "Удалить предыдущее слово"
+             :command.editor/open-edit                "Редактировать выбранный блок"
+             :command.editor/delete-selection         "Удалить выбранные блоки"
+             :command.editor/toggle-open-blocks       "Переключить открытые блоки (свернуть или развернуть все)"}
+
+   :nb-NO   {:shortcut.category/formatting            "Formatering"
+             :shortcut.category/basics                "Basis"
+             :shortcut.category/navigating            "Navigasjon"
+             :shortcut.category/block-editing         "Blokkredigering generelt"
+             :shortcut.category/block-command-editing "Blokkredigering kommandoer"
+             :shortcut.category/block-selection       "Blokkseleksjon (trykk ESC for å avslutte)"
+             :shortcut.category/toggle                "Veksling"
+             :shortcut.category/others                "Annet"
+             :command.editor/indent                   "Innrykk inn"
+             :command.editor/outdent                  "Innrykk ut"
+             :command.editor/move-block-up            "Flytt blokk opp"
+             :command.editor/move-block-down          "Flytt blokk ned"
+             :command.editor/new-block                "Opprett ny blokk"
+             :command.editor/new-line                 "Ny linje i nåværende blokk"
+             :command.editor/zoom-in                  "Zoom inn / Fremover"
+             :command.editor/zoom-out                 "Zoom ut / Tilbake"
+             :command.editor/follow-link              "Følg lenke under markøren"
+             :command.editor/open-link-in-sidebar     "Åpne lenke i sidestolpe"
+             :command.editor/expand-block-children    "Utvid"
+             :command.editor/collapse-block-children  "Slå sammen"
+             :command.editor/select-block-up          "Velg blokk over"
+             :command.editor/select-block-down        "Velg blokk under"
+             :command.editor/select-all-blocks        "Velg alle blokker"
+             :command.ui/toggle-help                  "Vis hjelp"
+             :command.git/commit                      "Git commit beskjed"
+             :command.go/search                       "Fulltekst søk"
+             :command.go/search-in-page               "Søk på nåværende side"
+             :command.ui/toggle-document-mode         "Aktiver dokumentmodus"
+             :command.ui/toggle-contents              "Åpne favoritter i sidestolpen"
+             :command.ui/toggle-theme                 "Veksle mellom lyst og mørkt tema"
+             :command.ui/toggle-left-sidebar          "Aktiver venstre sidestolpe"
+             :command.ui/toggle-right-sidebar         "Aktiver høyre sidestolpe"
+             :command.ui/toggle-settings              "Åpne innstillinger"
+             :command.go/journals                     "Gå til dagbok"
+             :command.ui/toggle-wide-mode             "Aktiver vid-modus"
+             :command.ui/toggle-brackets              "Aktiver vising av klammer"
+             :command.search/re-index                 "Gjenoppbygg søkeindeks"
+             :command.editor/bold                     "Fet"
+             :command.editor/italics                  "Kursiv"
+             :command.editor/insert-link              "HTML lenke"
+             :command.editor/highlight                "Markering"
+             :command.editor/undo                     "Angre"
+             :command.editor/redo                     "Gjør om"
+             :command.editor/copy                     "Kopier"
+             :command.editor/cut                      "Klipp ut"
+             :command.editor/up                       "Flytt markøren opp / Velg opp"
+             :command.editor/down                     "Flytt markøren ned / Velg ned"
+             :command.editor/left                     "Flytt markøren til venstre / Åpne valgt blokk på begynnelsen"
+             :command.editor/right                    "Flytt markøren til høyre / Åpne valgt blokk på slutten"
+             :command.editor/backspace                "Backspace / Slett bakover"
+             :command.editor/delete                   "Delete / Slett forover"
+             :command.editor/cycle-todo               "Veksle TODO status for valg linje"
+             :command.editor/clear-block              "Slett alt innhold i blokken"
+             :command.editor/kill-line-before         "Slett linje foran markøren"
+             :command.editor/kill-line-after          "Slett linsje etter markøren"
+             :command.editor/beginning-of-block       "Flytt markøren til begynnelsen av blokken"
+             :command.editor/end-of-block             "Flytt markøren til slutten av blokken"
+             :command.editor/forward-word             "Flytt markøren frem ett ord"
+             :command.editor/backward-word            "Flytt markøren bakover ett ord"
+             :command.editor/forward-kill-word        "Slett ett ord forover"
+             :command.editor/backward-kill-word       "Slett ett ord bakover"
+             :command.editor/open-edit                "Rediger valgt blokk"
+             :command.editor/delete-selection         "Slett valgte blokker"
+             :command.editor/toggle-open-blocks       "Veksle åpne blokker (slå sammen eller utvid alle blokker)"}
+
+   :pt-PT   {:shortcut.category/formatting            "Formatação"
+             :shortcut.category/basics                "Básico"
+             :shortcut.category/navigating            "Navegação"
+             :shortcut.category/block-editing         "Edição geral de blocos"
+             :shortcut.category/block-command-editing "Comandos de edição de blocos"
+             :shortcut.category/block-selection       "Seleção de blocos (premir Esc para sair)"
+             :shortcut.category/toggle                "Alternar"
+             :shortcut.category/others                "Outros"
+             :command.editor/indent                   "Aumentar avanço de parágrafo"
+             :command.editor/outdent                  "Diminuir avanço de parágrafo"
+             :command.editor/move-block-up            "Mover bloco para cima"
+             :command.editor/move-block-down          "Mover bloco para baixo"
+             :command.editor/new-block                "Criar novo bloco"
+             :command.editor/new-line                 "Nova linha no bloco actual"
+             :command.editor/zoom-in                  "Aproximar / Para a frente"
+             :command.editor/zoom-out                 "Afastar / Para trás"
+             :command.editor/follow-link              "Seguir ligação sob o cursor"
+             :command.editor/open-link-in-sidebar     "Abrir ligação na barra lateral"
+             :command.editor/expand-block-children    "Expandir"
+             :command.editor/collapse-block-children  "Colapsar"
+             :command.editor/select-block-up          "Selecionar bloco acima"
+             :command.editor/select-block-down        "Selecionar bloco abaixo"
+             :command.editor/select-all-blocks        "Selecionar todos os blocos"
+             :command.ui/toggle-help                  "Alternar ajuda"
+             :command.git/commit                      "Confirmar"
+             :command.go/search                       "Pesquisar no grafo"
+             :command.go/search-in-page               "Pesquisar na página atual"
+             :command.ui/toggle-document-mode         "Alternar modo de documento"
+             :command.ui/toggle-contents              "Alternar Conteúdo na barra lateral"
+             :command.ui/toggle-theme                 "Alternar entre tema claro/escuro"
+             :command.ui/toggle-right-sidebar         "Alternar barra lateral"
+             :command.ui/toggle-settings              "Alternar Opções"
+             :command.go/journals                     "Ir para diários"
+             :command.ui/toggle-wide-mode             "Alternar modo de ecrã amplo"
+             :command.ui/toggle-brackets              "Alternar parênteses rectos"
+             :command.search/re-index                 "Reconstruir índice de pesquisa"
+             :command.editor/bold                     "Negrito"
+             :command.editor/italics                  "Itálico"
+             :command.editor/insert-link              "Inserir ligação html"
+             :command.editor/highlight                "Realçado"
+             :command.editor/undo                     "Desfazer"
+             :command.editor/redo                     "Refazer"
+             :command.editor/copy                     "Copiar"
+             :command.editor/cut                      "Cortar"
+             :command.editor/up                       "Mover cursor para cima / Selecionar para cima"
+             :command.editor/down                     "Mover cursor para baixo / Selecionar para baixo"
+             :command.editor/left                     "Mover cursor para a esquerda / Abrir bloco selecionado no início"
+             :command.editor/right                    "Mover cursor para a direita / Abrir bloco selecionado no final"
+             :command.editor/backspace                "Retroceder / Eliminar para atrás"
+             :command.editor/delete                   "Apagar / Eliminar para a frente"
+             :command.editor/cycle-todo               "Alternar estado TODO do elemento"
+             :command.editor/clear-block              "Apagar conteúdo do bloco"
+             :command.editor/kill-line-before         "Apagar linha antes do cursor"
+             :command.editor/kill-line-after          "Apagar linha depois do cursor"
+             :command.editor/beginning-of-block       "Mover o cursor para o início do bloco"
+             :command.editor/end-of-block             "Mover o cursor para o fim do bloco"
+             :command.editor/forward-word             "Mover o cursor para a próxima palavra"
+             :command.editor/backward-word            "Mover o cursor para a palavra anterior"
+             :command.editor/forward-kill-word        "Apagar a próxima palavra"
+             :command.editor/backward-kill-word       "Apagar a palavra anterior"
+             :command.editor/open-edit                "Editar bloco selecionado"
+             :command.editor/delete-selection         "Eliminar blocos selecionados"
+             :command.editor/toggle-open-blocks       "Alternar blocos abertos (colapsar ou expandir todos)"}
+
+   :pt-BR   {:shortcut.category/formatting            "Formatação"
+             :shortcut.category/basics                "Básico"
+             :shortcut.category/navigating            "Navegação"
+             :shortcut.category/block-editing         "Edição geral de blocos"
+             :shortcut.category/block-command-editing "Comandos de edição de blocos"
+             :shortcut.category/block-selection       "Seleção de blocos (aperte Esc para sair)"
+             :shortcut.category/toggle                "Alternar"
+             :shortcut.category/others                "Outros"
+             :command.editor/indent                   "Aumentar avanço de parágrafo"
+             :command.editor/outdent                  "Diminuir avanço de parágrafo"
+             :command.editor/move-block-up            "Mover bloco para cima"
+             :command.editor/move-block-down          "Mover bloco para baixo"
+             :command.editor/new-block                "Criar novo bloco"
+             :command.editor/new-line                 "Nova linha no bloco actual"
+             :command.editor/zoom-in                  "Aproximar / Para a frente"
+             :command.editor/zoom-out                 "Afastar / Para trás"
+             :command.editor/follow-link              "Seguir ligação sob o cursor"
+             :command.editor/open-link-in-sidebar     "Abrir ligação na barra lateral"
+             :command.editor/expand-block-children    "Expandir"
+             :command.editor/collapse-block-children  "Recolher"
+             :command.editor/select-block-up          "Selecionar bloco acima"
+             :command.editor/select-block-down        "Selecionar bloco abaixo"
+             :command.editor/select-all-blocks        "Selecionar todos os blocos"
+             :command.ui/toggle-help                  "Alternar ajuda"
+             :command.git/commit                      "Confirmar"
+             :command.go/search                       "Pesquisar no grafo"
+             :command.go/search-in-page               "Pesquisar na página atual"
+             :command.ui/toggle-document-mode         "Alternar modo de documento"
+             :command.ui/toggle-contents              "Alternar Conteúdo na barra lateral"
+             :command.ui/toggle-theme                 "Alternar entre tema claro/escuro"
+             :command.ui/toggle-right-sidebar         "Alternar barra lateral"
+             :command.ui/toggle-settings              "Alternar Opções"
+             :command.go/journals                     "Ir para diários"
+             :command.ui/toggle-wide-mode             "Alternar largura extendida"
+             :command.ui/toggle-brackets              "Alternar colchetes"
+             :command.search/re-index                 "Reconstruir índice de pesquisa"
+             :command.editor/bold                     "Negrito"
+             :command.editor/italics                  "Itálico"
+             :command.editor/insert-link              "Inserir vínculo"
+             :command.editor/highlight                "Realçado"
+             :command.editor/undo                     "Desfazer"
+             :command.editor/redo                     "Refazer"
+             :command.editor/copy                     "Copiar"
+             :command.editor/cut                      "Cortar"
+             :command.editor/up                       "Mover cursor para cima / Selecionar para cima"
+             :command.editor/down                     "Mover cursor para baixo / Selecionar para baixo"
+             :command.editor/left                     "Mover cursor para a esquerda / Abrir bloco selecionado no início"
+             :command.editor/right                    "Mover cursor para a direita / Abrir bloco selecionado no final"
+             :command.editor/backspace                "Retroceder / Eliminar para trás"
+             :command.editor/delete                   "Deletar / Eliminar para frente"
+             :command.editor/cycle-todo               "Alternar estado A FAZER do elemento"
+             :command.editor/clear-block              "Apagar conteúdo do bloco"
+             :command.editor/kill-line-before         "Apagar linha antes do cursor"
+             :command.editor/kill-line-after          "Apagar linha depois do cursor"
+             :command.editor/beginning-of-block       "Mover o cursor para o início do bloco"
+             :command.editor/end-of-block             "Mover o cursor para o fim do bloco"
+             :command.editor/forward-word             "Mover o cursor para a próxima palavra"
+             :command.editor/backward-word            "Mover o cursor para a palavra anterior"
+             :command.editor/forward-kill-word        "Apagar a próxima palavra"
+             :command.editor/backward-kill-word       "Apagar a palavra anterior"
+             :command.editor/open-edit                "Editar bloco selecionado"
+             :command.editor/delete-selection         "Eliminar blocos selecionados"
+             :command.editor/toggle-open-blocks       "Alternar blocos abertos (recolher ou expandir todos)"
+             :command.auto-complete/complete          "Auto-completar: Escolha o item selecionado"
+             :command.auto-complete/next              "Auto-completar: Selecione o próximo item"
+             :command.auto-complete/prev              "Auto-completar: Selecione o item anterior"
+             :command.auto-complete/shift-complete    "Auto-completar: Abra o item selecionado na barra lateral"
+             :command.cards/forgotten                 "Cartas: Esquecido"
+             :command.cards/next-card                 "Cartas: Próxima carta"
+             :command.cards/recall                    "Cartas: Demorar um pouco para lembrar"
+             :command.cards/remembered                "Cartas: Relembrado"
+             :command.cards/toggle-answers            "Cartas: mostrar/esconder as respostas/clozes"
+             :command.command/toggle-favorite         "Adicionar para/remover dos favoritos"
+             :command.command-palette/toggle          "Editar atalhos"
+             :command.date-picker/complete            "Pegar data: Escolha o dia selecionado"
+             :command.date-picker/next-day            "Pegar data: Selecione o próximo dia"
+             :command.date-picker/next-week           "Pegar data: Selecione a próxima semana"
+             :command.date-picker/prev-day            "Pegar data: Selecione o dia anterior"
+             :command.date-picker/prev-week           "Pegar data: Selecione a semana anterior"
+             :command.editor/escape-editing           "Sair da edição"
+             :command.editor/insert-youtube-timestamp "Inserir timestamp do youtube"
+             :command.editor/paste-text-in-one-block-at-point "Colar texto em um bloco no ponto"
+             :command.editor/replace-block-reference-at-point "Substitua a referência do bloco pelo seu conteúdo no ponto"
+             :command.editor/strike-through           "Tachar"
+             :command.go/all-pages                    "Ir para todas as páginas"
+             :command.go/backward                     "Voltar"
+             :command.go/flashcards                   "Trocar flashcards"
+             :command.go/forward                      "Avançar"
+             :command.go/graph-view                   "Ir para o gráfico"
+             :command.go/home                         "Volar para o inicio"
+             :command.go/keyboard-shortcuts           "Ir para os atalhos do teclado"
+             :command.go/next-journal                 "Ir ao proximo jornal"
+             :command.go/prev-journal                 "Ir ao jornal anterior"
+             :command.go/tomorrow                     "Ir para amanhã"
+             :command.graph/add                       "Adicionar um gráfico"
+             :command.graph/open                      "Selecionar gráfico para abrir"
+             :command.graph/remove                    "Remover um gráfico"
+             :command.pdf/next-page                   "Próxima página do atual pdf doc"
+             :command.pdf/previous-page               "Página anterior do atual pdf doc"
+             :command.sidebar/clear                   "Limpar tudo da barra lateral direita"
+             :command.sidebar/open-today-page         "Abrir a página de hoje na barra lateral direita"
+             :command.ui/select-theme-color           "Selecionar as cores do tema disponível"
+             :command.ui/toggle-cards                 "Trocar cartas"
+             :command.ui/toggle-left-sidebar          "Trocar barra lateral esquerda"
+             :command.auto-complete/open-link         "Auto-completar: Abra o item selecionado no navegador"
+             :command.command/run                     "Execute o comando Git"
+             :command.editor/copy-current-file        "Copiar o arquivo atual"
+             :command.editor/open-file-in-default-app "Abra o arquivo no aplicativo padrão"
+             :command.editor/open-file-in-directory   "Abra o arquivo na pasta"
+             :command.graph/save                      "Salvar gráfico atual no computador"
+             :command.misc/copy                       "Copiar (copiar seleção ou referência do bloco)"
+             :command.ui/goto-plugins                 "Ir para o painel de plugins"
+             :command.ui/open-new-window              "Abra uma nova janela"}
+
+   :ja      {:shortcut.category/formatting                "フォーマット"
+             :shortcut.category/basics                "基本操作"
+             :shortcut.category/navigating            "ナビゲーション"
+             :shortcut.category/block-editing         "ブロック単位の編集"
+             :shortcut.category/block-command-editing "ブロック内の編集"
+             :shortcut.category/block-selection       "ブロック選択"
+             :shortcut.category/toggle                "トグル"
+             :shortcut.category/others                "その他"
+             :command.editor/indent                   "インデント"
+             :command.editor/outdent                  "アウトデント"
+             :command.editor/move-block-up            "ブロックを上へ移動"
+             :command.editor/move-block-down          "ブロックを下へ移動"
+             :command.editor/new-block                "新しいブロック"
+             :command.editor/new-line                 "新しい行"
+             :command.editor/zoom-in                  "ズームイン"
+             :command.editor/zoom-out                 "ズームアウト"
+             :command.editor/follow-link              "リンクを開く"
+             :command.editor/open-link-in-sidebar     "サイドバーでリンクを開く"
+             :command.editor/expand-block-children    "子ブロックを展開"
+             :command.editor/collapse-block-children  "子ブロックを折り畳み"
+             :command.editor/select-block-up          "上のブロックを選択"
+             :command.editor/select-block-down        "下のブロックを選択"
+             :command.editor/select-all-blocks        "全てのブロックを選択"
+             :command.editor/replace-block-reference-at-point        "この場所でブロック参照をそのコンテンツで置き換え"
+             :command.editor/paste-text-in-one-block-at-point        "カーソル位置へテキストとして貼り付け"
+             :command.ui/toggle-help                  "ヘルプのトグル"
+             :command.git/commit                      "コミット"
+             :command.go/search                       "検索"
+             :command.go/backward                     "戻る"
+             :command.go/forward                      "前へ"
+             :command.go/flashcards                   "フラッシュカードのトグル"
+             :command.go/home                         "ホームへ移動"
+             :command.go/all-pages                    "全ページへ移動"
+             :command.go/graph-view                   "グラフビューへ移動"
+             :command.go/tomorrow                     "明日へ移動"
+             :command.go/next-journal                 "次の日誌へ移動"
+             :command.go/prev-journal                 "前の日誌へ移動"
+             :command.go/keyboard-shortcuts           "キーボードショートカットへ移動"
+             :command.ui/open-new-window              "別のウィンドウを開く"
+             :command.go/search-in-page               "ページ内を検索"
+             :command.ui/toggle-document-mode         "ドキュメントモードのトグル"
+             :command.ui/toggle-contents              "コンテンツのトグル"
+             :command.ui/toggle-theme                 "テーマのトグル"
+             :command.ui/toggle-right-sidebar         "右サイドバーのトグル"
+             :command.ui/toggle-settings              "トグル設定"
+             :command.go/journals                     "日誌"
+             :command.ui/toggle-wide-mode             "ワイドモードのトグル"
+             :command.ui/toggle-brackets              "ブラケット表示On/Offのトグル"
+             :command.search/re-index                 "インデックス再構築"
+             :command.editor/bold                     "太字"
+             :command.editor/italics                  "斜体"
+             :command.editor/insert-link              "リンク挿入"
+             :command.editor/highlight                "ハイライト"
+             :command.editor/undo                     "元に戻す"
+             :command.editor/redo                     "やり直し"
+             :command.editor/copy                     "コピー"
+             :command.editor/cut                      "切り取り"
+             :command.editor/up                       "カーソル上移動 / 上を選択"
+             :command.editor/down                     "カーソル下移動 / 下を選択"
+             :command.editor/left                     "カーソル左移動 / 左を選択"
+             :command.editor/right                    "カーソル右移動 / 右を選択"
+             :command.editor/backspace                "前の文字を削除"
+             :command.editor/delete                   "次の文字を削除"
+             :command.editor/cycle-todo               "現在の項目の TODO 状態をローテートさせる"
+             :command.editor/clear-block              "ブロックをクリア"
+             :command.editor/kill-line-before         "行中のカーソル位置から前を削除"
+             :command.editor/kill-line-after          "行中のカーソル位置から先を削除"
+             :command.editor/beginning-of-block       "カーソルをブロックのはじめへ移動"
+             :command.editor/end-of-block             "カーソルをブロックの最後へ移動"
+             :command.editor/forward-word             "カーソルを次の単語へ移動"
+             :command.editor/backward-word            "カーソルを前の単語へ移動"
+             :command.editor/forward-kill-word        "次の単語を削除"
+             :command.editor/backward-kill-word       "前の単語を削除"
+             :command.editor/open-edit                "選択したブロックを編集"
+             :command.editor/delete-selection         "選択したブロックを削除"
+             :command.editor/toggle-open-blocks       "ブロック展開のトグル(全てのブロックを折りたたみ/展開)"
+             :command.ui/toggle-cards                 "フラッシュカードのトグル"
+             :command.ui/toggle-left-sidebar          "左サイドバーのトグル"
+             :command.pdf/next-page                   "現在のPDF文書で次のページへ"
+             :command.pdf/previous-page               "現在のPDF文書で前のページへ"
+             :command.command/run                             "Git コマンドを実行"
+             :command.command-palette/toggle                  "コマンドパレットのトグル"
+             :command.graph/open                              "グラフを選択して開く"
+             :command.graph/remove                            "グラフを削除"
+             :command.graph/add                               "グラフを追加"
+             :command.graph/save                              "現在のグラフをディスクへ保存"
+             :command.sidebar/clear                           "右サイドバーの内容を全てクリア"
+             :command.sidebar/open-today-page                 "今日の日誌を右サイドバーで開く"
+             :command.editor/insert-youtube-timestamp         "YouTubeのタイプスタンプを挿入"
+             :command.auto-complete/complete                  "自動補完:項目を選択"
+             :command.auto-complete/prev                      "自動補完:前の項目を選択"
+             :command.auto-complete/next                      "自動補完:次の項目を選択"
+             :command.auto-complete/shift-complete            "自動補完:選択した項目をサイドバーで開く"
+             :command.date-picker/complete                    "日付選択:選択した日で決定"
+             :command.date-picker/prev-day                    "日付選択:前の日を選ぶ"
+             :command.date-picker/next-day                    "日付選択:次の日を選ぶ"
+             :command.date-picker/prev-week                   "日付選択:前の週を選ぶ"
+             :command.date-picker/next-week                   "日付選択:次の週を選ぶ"
+             :command.cards/forgotten                         "カード:忘れられた"
+             :command.cards/next-card                         "カード:次のカード"
+             :command.cards/recall                            "カード:思い出すのに時間がかかる"
+             :command.cards/remembered                        "カード:覚えている"
+             :command.cards/toggle-answers                    "カード:答えや穴埋めの表示/隠すのトグル"
+             :command.command/toggle-favorite                 "お気に入りへの追加/削除のトグル"
+             :command.editor/copy-current-file                "現在のファイルをコピー"
+             :command.editor/escape-editing                   "編集をやめる"
+             :command.editor/open-file-in-default-app         "ファイルを規定のアプリで開く"
+             :command.editor/open-file-in-directory           "ファイルをディレクトリで開く"
+             :command.editor/strike-through                   "打ち消し線"
+             :command.misc/copy                               "コピー"
+             :command.ui/goto-plugins                         "プラグインへ"
+             :command.ui/select-theme-color                   "利用可能なテーマ色を選択"
+             }})

+ 0 - 11
src/main/frontend/modules/shortcut/macro.cljc

@@ -1,11 +0,0 @@
-(ns frontend.modules.shortcut.macro
-  #?(:cljs (:require-macros [frontend.modules.shortcut.macro])))
-
-(defmacro shortcut-dict
-  "All docs for EN are generated from :desc field of shortcut default-config map.
-  For all other languages, need manual translation in dict file. "
-  [desc category & maps]
-  `(medley.core/deep-merge
-    {:en ~category}
-    {:en ~desc}
-    ~@maps))

+ 1 - 1
src/main/frontend/spec.cljs

@@ -15,7 +15,7 @@
   (when config/dev?
     (if (s/explain-data spec value)
      (let [error-message (expound/expound-str spec value)
-           ex (ex-info "Error in validate" {})]
+           ex (ex-info "Error in validate" {:value value})]
        (log/error :exception ex :spec/validate-failed error-message)
        false)
      true)))

+ 31 - 0
src/test/frontend/context/i18n_test.cljs

@@ -0,0 +1,31 @@
+(ns frontend.context.i18n-test
+  (:require [frontend.context.i18n :as i18n]
+            [frontend.state :as state]
+            [cljs.test :refer [deftest is testing use-fixtures]]))
+
+(use-fixtures :once (fn [f]
+                      (f)
+                      (state/set-state! :preferred-language nil)))
+
+(deftest translations
+  (testing "dict/dicts.cljs translations"
+    (state/set-preferred-language! :en)
+    (is (= "About Logseq"
+           (i18n/t :help/about)))
+
+    (state/set-preferred-language! :es)
+    (is (= "Acerca de Logseq"
+           (i18n/t :help/about))))
+
+  (testing "shortcut/dicts.cljs translations"
+    (state/set-preferred-language! :en)
+    (is (= "Go to journals"
+           (i18n/t :command.go/journals))
+        "Check config/config")
+    (is (= "Basics"
+           (i18n/t :shortcut.category/basics))
+        "Check config/category")
+
+    (state/set-preferred-language! :es)
+    (is (= "Ir a los diarios"
+           (i18n/t :command.go/journals)))))