Skip to content

Latest commit

 

History

History
43 lines (26 loc) · 1.09 KB

README.md

File metadata and controls

43 lines (26 loc) · 1.09 KB

logseq-l10n-generate-json

Extract ' t("string") ' from the scripts in the folder and generate one JSON file.

Dependencies

Install

  1. Clone this repo.
  2. Run command ' pnpm install '.
  3. Edit "config.js".

Usage

  1. Enclose all strings to be translated in the scripts with ' t("string") '..
  2. Create a "translations" folder.
  3. Enter "targetFolderPath" in "config.js".
  4. Run ' node index.cjs ' command in terminal.
  5. One File will be created in the target folder.

    If a file with the same name exists, it will be updated.

import { setup as l10nSetup , t } from "logseq-l10n"

const main = async () => {
    //await l10nSetup({builtinTranslations: { }})


    // Use `t` for text with translations.

    console.log(t("Hello world!"))

    logseq.UI.showMsg(t("Success"), "success")


}

Recommend

  1. Translation > logseq-l10n-clone-json: Clone JSON files for Logseq full languages based on one translation file