diff --git a/apps/client/README.md b/apps/client/README.md index 02db9c0f..1ebe379f 100644 --- a/apps/client/README.md +++ b/apps/client/README.md @@ -25,9 +25,3 @@ If you are developing a production application, we recommend updating the config - Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` - Optionally add `plugin:@typescript-eslint/stylistic-type-checked` - Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list - -## Add i18n namespaces - -`node scripts/i18n-tools.js add-ns ` - -For example `node scripts/i18n-tools.js add-ns login` diff --git a/apps/client/scripts/i18n-tools.js b/apps/client/scripts/i18n-tools.js deleted file mode 100644 index 33862824..00000000 --- a/apps/client/scripts/i18n-tools.js +++ /dev/null @@ -1,59 +0,0 @@ -const fs = require("node:fs"); -const path = require("node:path"); - -const localsPath = path.join(__dirname, "../public/locales"); - -const supportLanguages = ["en", "zh"]; -const supportCommands = ["add-ns"]; - -function ensureLanguageDirectories() { - if (!fs.existsSync(localsPath)) { - fs.mkdirSync(localsPath, { recursive: true }); - } - - supportLanguages.forEach((lang) => { - const langPath = path.join(localsPath, lang); - - if (!fs.existsSync(langPath)) { - fs.mkdirSync(langPath); - } - }); -} - -function addNamespaces(namespaces) { - supportLanguages.forEach((lang) => { - const langPath = path.join(localsPath, lang); - - namespaces.forEach((ns) => { - const nsFilePath = path.join(langPath, `${ns}.json`); - - if (!fs.existsSync(nsFilePath)) { - fs.writeFileSync(nsFilePath, "{}", "utf8"); - console.log(`Created empty ${ns}.json file in ${lang} directory`); - } else { - console.log( - `${ns}.json file already exists in ${lang} directory, skipping creation`, - ); - } - }); - }); -} - -ensureLanguageDirectories(); - -const [command, ...params] = process.argv.slice(2); - -if (!supportCommands.includes(command)) { - console.warn( - `Only support the follow commands: ${supportCommands.join(" ")} `, - ); - console.log(); -} - -switch (command) { - case "add-ns": - addNamespaces(params); - break; - default: - console.warn("You should input a command"); -}