Clone JSON files for Logseq full languages based on one translation file
English | Local Language |
---|---|
Afrikaans | Afrikaans |
German | Deutsch |
Spanish | Español |
French | Français |
Indonesian | Bahasa Indonesia |
Italian | Italiano |
Japanese | 日本語 |
Korean | 한국어 |
Norwegian | Norsk |
Dutch | Nederlands |
Polish | Polski |
Portuguese | Português |
Russian | Русский |
Slovak | Slovenčina |
Turkish | Türkçe |
Ukrainian | Українська |
Chinese Simplified | 简体中文 |
Chinese Traditional | 繁體中文 |
- Use Microsoft Azure Cognitive Services Translation API
- Use logseq-l10n: L10N framework for Logseq plugins
- Clone this repo. Run command '
pnpm install
' for dependencies. - Edit config.js and change the API key etc. (Azure Portal)
- First, set up "logseq-l10n". Then, create one translation file.
- Enter the file name and path in config.js.
- Run “
node index.cjs
” command in terminal. - Files will be created.
If a file with the same name exists, it will not be updated.
- The sample code for importing the created translation files is as follows.
import { setup as l10nSetup } from "logseq-l10n" //https://github.com/sethyuan/logseq-l10n
import af from "./translations/af.json"
import de from "./translations/de.json"
import es from "./translations/es.json"
import fr from "./translations/fr.json"
import id from "./translations/id.json"
import it from "./translations/it.json"
import ja from "./translations/ja.json"
import ko from "./translations/ko.json"
import nbNO from "./translations/nb-NO.json"
import nl from "./translations/nl.json"
import pl from "./translations/pl.json"
import ptBR from "./translations/pt-BR.json"
import ptPT from "./translations/pt-PT.json"
import ru from "./translations/ru.json"
import sk from "./translations/sk.json"
import tr from "./translations/tr.json"
import uk from "./translations/uk.json"
import zhCN from "./translations/zh-CN.json"
import zhHant from "./translations/zh-Hant.json"
const main = async () => {
await l10nSetup({
builtinTranslations: {//Full translations
af, de, es, fr, id, it, ja, ko, "nb-NO": nbNO, nl, pl, "pt-BR": ptBR, "pt-PT": ptPT, ru, sk, tr, uk, "zh-CN": zhCN, "zh-Hant": zhHant
}
})
}
- Generate JSON file for translation > logseq-l10n-generate-json: Extract ' t("string") ' from the scripts in the folder and create one JSON file.