Skip to content

Commit

Permalink
Tutorial fix and refactor. Update docs
Browse files Browse the repository at this point in the history
* Some langs like es didn't have tutorials translated and were
  pretending to
* it lang had tutorials but they weren't being used
* Moved tutorials to the more appropriate src/resources/tutorials
* Also fixed typos and bb task
  • Loading branch information
logseq-cldwalker committed May 24, 2023
1 parent 28ff6b1 commit ad3eda7
Show file tree
Hide file tree
Showing 47 changed files with 41 additions and 51 deletions.
2 changes: 2 additions & 0 deletions CODEBASE_OVERVIEW.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ After cloning the [Logseq repository](https://github.com/logseq/logseq), there a

- `src/test/` contains all the tests and `src/dev-cljs/` contains some development utilities.

- `src/resources/` - directory and classpath for resources used by Clojure(Script)

- `src/main/frontend/` contains code that powers the Logseq editor. Folders and files inside are organized by features or functions. For example, `components` contains all the UI components and `handler` contains all the event-handling code. You can explore on your own interest.

- `src/main/logseq/` contains the api used by plugins.
Expand Down
2 changes: 1 addition & 1 deletion bb.edn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{:paths ["scripts/src" "src/main" "templates" "src/resources"]
{:paths ["scripts/src" "src/main" "src/resources"]
:deps
{metosin/malli
{:mvn/version "0.10.0"}
Expand Down
18 changes: 9 additions & 9 deletions docs/contributing-to-translations.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ In order to run the commands in this doc, you will need to install
## Where to Contribute

Language translations are under,
[src/main/frontend/dicts/](https://github.com/logseq/logseq/blob/master/src/main/frontend/dicts/) with each language having it's own file. For example, the es locale is in `es.cljc `.
[src/resources/dicts/](https://github.com/logseq/logseq/blob/master/src/resources/dicts/) with each language having it's own file. For example, the es locale is in `es.edn`.

## Language Overview

Expand Down Expand Up @@ -58,9 +58,9 @@ To see what translations are missing for your language, let's run a command usin
$ bb lang:missing es
| :translation-key | :string-to-translate | :file |
|---------------------------------------+-------------------------------------------------------+---------------|
| :command.editor/toggle-number-list | Toggle number list | dicts/es.cljc |
| :command.whiteboard/bring-forward | Move forward | dicts/es.cljc |
| :command.whiteboard/bring-to-front | Move to front | dicts/es.cljc |
| :command.editor/toggle-number-list | Toggle number list | dicts/es.edn |
| :command.whiteboard/bring-forward | Move forward | dicts/es.edn |
| :command.whiteboard/bring-to-front | Move to front | dicts/es.edn |
...
```

Expand All @@ -71,14 +71,14 @@ Over time you're aiming to have this list drop to zero. Since this process can b
# When pasting this content, be sure to update the indentation to match the file
$ bb lang:missing es --copy

;; For dicts/es.cljc
;; For dicts/es.edn
:command.editor/toggle-number-list "Toggle number list"
:command.whiteboard/bring-forward "Move forward"
:command.whiteboard/bring-to-front "Move to front"
...
```

Almost all translations are small. The only exceptions to this are the keys `:tutorial/text` and `:tutorial/dummy-notes`. These reference files that are part of the onboarding tutorial. Most languages don't have this translated. If you are willing to do this, we would be happy to have this translated.
Almost all translations are small. The only exceptions to this are the keys `:tutorial/text` and `:tutorial/dummy-notes`. These translations are files that are part of the onboarding tutorial and can be found under [src/resources/tutorials/](https://github.com/logseq/logseq/blob/master/src/resources/tutorials/).

## Fix Untranslated

Expand Down Expand Up @@ -106,6 +106,6 @@ and tell you what's wrong.

To add a new language:
* Add an entry to `frontend.dicts/languages`
* Create a new file under `src/main/frontend/dicts/` and name the file the same as the locale e.g. zz.cljc for a hypothetical zz locale.
* Add a `(def dicts {})` in that file and then add a entry in the `dicts` map in `src/main/frontend/dicts.cljc`.
* Then start translating for your language and adding entries in your language's `dicts` using the `bb lang:missing` workflow.
* Create a new file under `src/resources/dicts/` and name the file the same as the locale e.g. zz.edn for a hypothetical zz locale.
* Add an entry in `frontend.dicts/dicts` referencing the file you created.
* Then start translating for your language and adding entries in your language's EDN file using the `bb lang:missing` workflow.
6 changes: 3 additions & 3 deletions scripts/src/logseq/tasks/lang.clj
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
{:translation-key k
;; Shorten values
:string-to-translate (shorten v 50)
:file (str "dicts/"
(-> lang name string/lower-case)
".edn")}))
:file (if (= "tutorial" (namespace k))
(str "Under tutorials/")
(str "dicts/" (-> lang name string/lower-case) ".edn"))}))
(sort-by (juxt :file :translation-key)))]
(if (:copy options)
(doseq [[file missing-for-file] (group-by :file sorted-missing)]
Expand Down
2 changes: 1 addition & 1 deletion src/main/frontend/dicts.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#?@(:bb [[clojure.java.io :as io]]
:clj [[clojure.java.io :as io]
[shadow.resource :as rc]]))
#?(:cljs (:require-macros [frontend.dicts :refer [resource edn-resource]])))
#?(:cljs (:require-macros [frontend.dicts :refer [edn-resource]])))

#?(:clj (defn resource [file] (slurp (io/resource file))))

Expand Down
3 changes: 0 additions & 3 deletions src/resources/dicts/de.edn
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,6 @@

:tips/all-done "Alles erledigt"

:tutorial/dummy-notes #resource "dummy-notes-en.md"
:tutorial/text #resource "tutorial-en.md"

:updater/new-version-install "Eine neue Version wurde heruntergeladen."
:updater/quit-and-install "Neu starten, um zu installieren"

Expand Down
4 changes: 2 additions & 2 deletions src/resources/dicts/en.edn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{:accessibility/skip-to-main-content "Skip to main content"
:tutorial/text #resource "tutorial-en.md"
:tutorial/dummy-notes #resource "dummy-notes-en.md"
:tutorial/text #resource "tutorials/tutorial-en.md"
:tutorial/dummy-notes #resource "tutorials/dummy-notes-en.md"
:on-boarding/demo-graph "This is a demo graph, changes will not be saved until you open a local folder."
:on-boarding/add-graph "Add a graph"
:on-boarding/open-local-dir "Open a local directory"
Expand Down
4 changes: 2 additions & 2 deletions src/resources/dicts/es.edn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{:tutorial/text #resource "tutorial-es.md"
:tutorial/dummy-notes #resource "dummy-notes-es.md"
{:tutorial/text #resource "tutorials/tutorial-es.md"
:tutorial/dummy-notes #resource "tutorials/dummy-notes-es.md"
:on-boarding/demo-graph "Este es un grafo de demostración, los cambios no serán guardados hasta que abras una carpeta local."
:on-boarding/add-graph "Añadir gráfico"
:on-boarding/open-local-dir "Abrir un directorio local"
Expand Down
4 changes: 2 additions & 2 deletions src/resources/dicts/fr.edn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{:tutorial/text #resource "tutorial-fr.md"
:tutorial/dummy-notes #resource "dummy-notes-fr.md"
{:tutorial/text #resource "tutorials/tutorial-fr.md"
:tutorial/dummy-notes #resource "tutorials/dummy-notes-fr.md"
:help/about "A propos de Logseq"
:help/bug "Signaler une anomalie"
:help/feature "Demander une fonctionnalité"
Expand Down
4 changes: 2 additions & 2 deletions src/resources/dicts/it.edn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{:tutorial/text #resource "tutorial-en.md"
:tutorial/dummy-notes #resource "dummy-notes-en.md"
{:tutorial/text #resource "tutorials/tutorial-it.md"
:tutorial/dummy-notes #resource "tutorials/dummy-notes-it.md"
:on-boarding/demo-graph "Questo è un grafo dimostrativo, le modifiche non saranno salvate finché non aprirai una cartella locale."
:on-boarding/add-graph "Aggiungi un grafo"
:on-boarding/open-local-dir "Apri una cartella locale"
Expand Down
4 changes: 2 additions & 2 deletions src/resources/dicts/ja.edn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{:tutorial/text #resource "tutorial-ja.md"
:tutorial/dummy-notes #resource "dummy-notes-ja.md"
{:tutorial/text #resource "tutorials/tutorial-ja.md"
:tutorial/dummy-notes #resource "tutorials/dummy-notes-ja.md"
:on-boarding/demo-graph "これはデモ用のグラフなので変更内容は保存されません。保存するにはローカルフォルダを選んで新規グラフを追加してください。"
:on-boarding/add-graph "新規グラフを追加"
:on-boarding/open-local-dir "ここをクリックして、データ保存先のローカルフォルダを選んでください"
Expand Down
4 changes: 2 additions & 2 deletions src/resources/dicts/ko.edn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{:tutorial/text #resource "tutorial-ko.md"
:tutorial/dummy-notes #resource "dummy-notes-ko.md"
{:tutorial/text #resource "tutorials/tutorial-ko.md"
:tutorial/dummy-notes #resource "tutorials/dummy-notes-ko.md"
:on-boarding/demo-graph "이 그래프는 데모 그래프입니다. 로컬 폴더를 열기 전까지 변경 사항은 저장되지 않습니다."
:on-boarding/add-graph "그래프 추가"
:on-boarding/open-local-dir "로컬 폴더 열기"
Expand Down
4 changes: 2 additions & 2 deletions src/resources/dicts/nb-no.edn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{:tutorial/text #resource "tutorial-no.md"
:tutorial/dummy-notes #resource "dummy-notes-no.md"
{:tutorial/text #resource "tutorials/tutorial-no.md"
:tutorial/dummy-notes #resource "tutorials/dummy-notes-no.md"
:on-boarding/demo-graph "Dette er en demo graf, endringer vil ikke bli lagret før du åpner en lokal mappe."
:on-boarding/add-graph "Legg til en graf"
:on-boarding/open-local-dir "Åpne en lokal mappe"
Expand Down
3 changes: 0 additions & 3 deletions src/resources/dicts/nl.edn
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,6 @@

:tips/all-done "Alles klaar"

:tutorial/dummy-notes #resource "dummy-notes-en.md"
:tutorial/text #resource "tutorial-en.md"

:updater/new-version-install "Een nieuwe versie is gedownload."
:updater/quit-and-install "Herstart om te installeren"

Expand Down
4 changes: 2 additions & 2 deletions src/resources/dicts/pl.edn
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{:tutorial/text #resource "tutorial-pl.md"
:tutorial/dummy-notes #resource "dummy-notes-pl.md"
{:tutorial/text #resource "tutorials/tutorial-pl.md"
:tutorial/dummy-notes #resource "tutorials/dummy-notes-pl.md"
:on-boarding/demo-graph "To jest przykładowy graf, zmiany nie zostaną zapisane dopóki nie otworzysz lokalnego katalogu."
:on-boarding/add-graph "Dodaj graf"
:on-boarding/open-local-dir "Otwórz lokalny katalog"
Expand Down
2 changes: 0 additions & 2 deletions src/resources/dicts/pt-br.edn
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@

:page/copy-page-url "Copiar URL da página"
:plugin/not-installed "Não instalado"
:tutorial/dummy-notes #resource "dummy-notes-en.md"
:tutorial/text #resource "tutorial-en.md"
:settings-page/edit-export-css "Editar export.css"
:settings-page/enable-flashcards "Flashcards"
:settings-page/export-theme "Exportar Tema"
Expand Down
2 changes: 0 additions & 2 deletions src/resources/dicts/pt-pt.edn
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{:accessibility/skip-to-main-content "Ir para o conteúdo principal"
:tutorial/text #resource "tutorial-en.md"
:tutorial/dummy-notes #resource "dummy-notes-en.md"
:on-boarding/demo-graph "Isto é um grafo de demonstração, nenhuma mudança será guardada até abrir uma pasta local."
:on-boarding/add-graph "Adicionar grafo"
:on-boarding/open-local-dir "Abrir uma pasta local"
Expand Down
4 changes: 2 additions & 2 deletions src/resources/dicts/ru.edn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{:accessibility/skip-to-main-content "Перейти к основному содержимому"
:tutorial/text #resource "tutorial-ru.md"
:tutorial/dummy-notes #resource "dummy-notes-ru.md"
:tutorial/text #resource "tutorials/tutorial-ru.md"
:tutorial/dummy-notes #resource "tutorials/dummy-notes-ru.md"
:on-boarding/demo-graph "Это демонстрационный граф, изменения не будут сохранены, пока вы не откроете локальный файл."
:on-boarding/add-graph "Добавить новый граф"
:on-boarding/open-local-dir "Открыть локальный каталог"
Expand Down
4 changes: 2 additions & 2 deletions src/resources/dicts/sk.edn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{:accessibility/skip-to-main-content "Preskočiť na hlavný obsah"
:tutorial/text #resource "tutorial-sk.md"
:tutorial/dummy-notes #resource "dummy-notes-sk.md"
:tutorial/text #resource "tutorials/tutorial-sk.md"
:tutorial/dummy-notes #resource "tutorials/dummy-notes-sk.md"
:on-boarding/demo-graph "Toto je ukážkový graf, zmeny nebudú uložené, kým neotvoríte lokálny adresár."
:on-boarding/add-graph "Pridať graf"
:on-boarding/open-local-dir "Otvoriť lokálny adresár"
Expand Down
4 changes: 2 additions & 2 deletions src/resources/dicts/tr.edn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{:accessibility/skip-to-main-content "Ana içeriğe geç"
:tutorial/text #resource "tutorial-tr.md"
:tutorial/dummy-notes #resource "dummy-notes-tr.md"
:tutorial/text #resource "tutorials/tutorial-tr.md"
:tutorial/dummy-notes #resource "tutorials/dummy-notes-tr.md"
:on-boarding/demo-graph "Bu bir demo graftır, yerel bir klasör açana kadar değişiklikler kaydedilmeyecektir."
:on-boarding/add-graph "Bir graf ekle"
:on-boarding/open-local-dir "Yerel bir dizin açın"
Expand Down
4 changes: 2 additions & 2 deletions src/resources/dicts/uk.edn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{:accessibility/skip-to-main-content "Перейти до головної"
:tutorial/text #resource "tutorial-uk.md"
:tutorial/dummy-notes #resource "dummy-notes-uk.md"
:tutorial/text #resource "tutorials/tutorial-uk.md"
:tutorial/dummy-notes #resource "tutorials/dummy-notes-uk.md"
:on-boarding/demo-graph "Це демонстраційний графік, зміни не будуть збереженні поки ви не відкриєте локальну папку."
:on-boarding/add-graph "Додати графік"
:on-boarding/open-local-dir "Відкрити локальну директорію"
Expand Down
2 changes: 0 additions & 2 deletions src/resources/dicts/zh-cn.edn
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@
:settings-page/enable-flashcards "记忆卡片"
:settings-page/enable-shortcut-tooltip "启用快捷键提示"
:settings-page/export-theme "导出主题"
:tutorial/dummy-notes #resource "dummy-notes-en.md"
:tutorial/text #resource "tutorial-en.md"
:right-side-bar/help "帮助"
:right-side-bar/switch-theme "主题模式"
:right-side-bar/contents "目录"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ fo = "fo"
aks = "aks"
Mannor = "Mannor"
[files]
extend-exclude = ["resources/*", "templates/*", "src/main/frontend/dicts/*.cljc"]
extend-exclude = ["resources/*", "templates/*", "src/resources/*"]

0 comments on commit ad3eda7

Please sign in to comment.