From 3b9b467a2a197c84dfa4ff3d92ba3d2341386409 Mon Sep 17 00:00:00 2001 From: Haider Date: Tue, 26 Dec 2023 15:18:12 +0500 Subject: [PATCH] add translations (#64) --- .github/workflows/main.yml | 22 +++---- Contribution.md | 4 +- README.md | 5 +- add-key.js | 129 ++++++++++++++++++------------------- en/translation.json | 22 ++++++- es/translation.json | 22 ++++++- fr/translation.json | 22 ++++++- ja/translation.json | 22 ++++++- ko/translation.json | 22 ++++++- main.js | 54 ++++++++-------- ru/translation.json | 22 ++++++- uk/translation.json | 22 ++++++- vi/translation.json | 22 ++++++- zh-CN/translation.json | 22 ++++++- 14 files changed, 293 insertions(+), 119 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 58fd597..8ad9b99 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,14 +4,14 @@ on: pull_request: branches: [main] jobs: - test_keys: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Run a simple diff check - uses: actions/setup-node@v3 - with: - node-version: 18 - - name: Diff Keys - run: node main.js + test_keys: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Run a simple diff check + uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Diff Keys + run: node main.js diff --git a/Contribution.md b/Contribution.md index f2ca575..2da04f2 100644 --- a/Contribution.md +++ b/Contribution.md @@ -52,11 +52,11 @@ Steps to Contribute - Not to send out changes to github - We can send it via `git push` - NOTE: If you get error like `fatal: The current branch YOUR_BRANCH_NAME has no upstream branch.`, don't panic just use the command mentioned below. - - Which should be something like `git push --set-upstream origin YOUR_BRANCH_NAME` + - Which should be something like `git push --set-upstream origin YOUR_BRANCH_NAME` - If we have pushed successfully, we can view that branch in our github account in web browser - Step 6: Creating a PR(Pull Request) - This is the final step to make your contribution to be included in the translations. - Creating a PR is simple, You navigate to your branch in the github repository page. - Then Click `Contribute` and then `Open a pull request` to the `main` repository -You can also refer here to this article on [How to Contribute to Projects on Github](https://docs.github.com/en/get-started/quickstart/contributing-to-projects) \ No newline at end of file +You can also refer here to this article on [How to Contribute to Projects on Github](https://docs.github.com/en/get-started/quickstart/contributing-to-projects) diff --git a/README.md b/README.md index 5200529..81df3d8 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,19 @@ # Voyager Translations ## Simple How to translate + - Checkout to a new branch for your locale say `git checkout -b hi` - Make a copy of folder `en` and rename it as new locale e.g `hi` - Translate all or keys which are required in file `translation.json` which should be inside `YOUR_LOCALE/translation.json` - Once done, commit you changes push to the branch and make a PR to `main` branch. - ## Locales naming + - You can take help and name folder as country code [link](https://www.w3.org/International/O-charset-lang.html) - In case country is present in above link, use respective country code from any other source. - ## Current languages (Languages which are translated) + - English (en) - French (fr) - Korean (ko) diff --git a/add-key.js b/add-key.js index 55f0665..5795e13 100644 --- a/add-key.js +++ b/add-key.js @@ -1,85 +1,80 @@ const fs = require("fs") const ignoreFiles = [ - ".github", - ".git", - "Contribution.md", - "LICENSE", - "main.js", - "add-key.js", - "README.md", -]; + ".github", + ".git", + "Contribution.md", + "LICENSE", + "main.js", + "add-key.js", + "README.md", +] function getFiles(dir, files = []) { - // Get an array of all files and directories in the passed directory using fs.readdirSync - const fileList = fs.readdirSync(dir); + // Get an array of all files and directories in the passed directory using fs.readdirSync + const fileList = fs.readdirSync(dir) - const filteredFileList = fileList.filter( - (file) => !ignoreFiles.includes(file) - ); + const filteredFileList = fileList.filter(file => !ignoreFiles.includes(file)) - for (const file of filteredFileList) { - const name = `${dir}/${file}`; + for (const file of filteredFileList) { + const name = `${dir}/${file}` - if (fs.statSync(name).isDirectory()) { - getFiles(name, files); - } else { - files.push(name); - } + if (fs.statSync(name).isDirectory()) { + getFiles(name, files) + } else { + files.push(name) } - return files; + } + return files } function add_key() { - const args = process.argv.slice(2); - - if (args.length % 2 !== 0) { - throw new Error("Even number or args required. Key+Value like") + const args = process.argv.slice(2) + + if (args.length % 2 !== 0) { + throw new Error("Even number or args required. Key+Value like") + } + + const pairs = [] + for (let i = 0; i < args.length; i += 2) { + if (i + 1 < args.length) { + pairs.push([args[i], args[i + 1]]) + } else { + pairs.push([args[i]]) } - - const pairs = []; - for (let i = 0; i < args.length; i += 2) { - if (i + 1 < args.length) { - pairs.push([args[i], args[i + 1]]); + } + + console.log("Command-line argument pairs:") + console.log(pairs) + + const files = getFiles(".") + + pairs.forEach(pair => { + const [new_key, new_value] = pair + + files.forEach(file => { + try { + const data = fs.readFileSync(file, { + encoding: "utf-8", + }) + const thisLang = JSON.parse(data) + const thisLangKeys = Object.keys(thisLang) + if (!thisLangKeys.includes(new_key)) { + console.info(`Wiriting locale ${file} | Adding ${new_key} ":" ${new_value}`) + // If this lang doesn't contain this key then only update + const newFileData = { + ...thisLang, + [new_key]: new_value, + } + fs.writeFileSync(file, JSON.stringify(newFileData, null, 2)) } else { - pairs.push([args[i]]); + console.warn(`locale ${file} already has ${new_key}. Skipping`) } - } - - console.log("Command-line argument pairs:"); - console.log(pairs); - - const files = getFiles("."); - - pairs.forEach((pair) => { - const [new_key, new_value] = pair; - - files.forEach((file) => { - try { - const data = fs.readFileSync(file, { - encoding: "utf-8", - }); - const thisLang = JSON.parse(data); - const thisLangKeys = Object.keys(thisLang); - if (!thisLangKeys.includes(new_key)) { - console.info(`Wiriting locale ${file} | Adding ${new_key} ":" ${new_value}`) - // If this lang doesn't contain this key then only update - const newFileData = { - ...thisLang, - [new_key]: new_value - }; - fs.writeFileSync(file, JSON.stringify(newFileData, null, 2)) - } else { - console.warn(`locale ${file} already has ${new_key}. Skipping`) - } - } catch (e) { - console.error(`Unexpected Error: ${e}`); - } - }); + } catch (e) { + console.error(`Unexpected Error: ${e}`) + } }) - - - + }) } -add_key() \ No newline at end of file +add_key() diff --git a/en/translation.json b/en/translation.json index 1057049..886411c 100644 --- a/en/translation.json +++ b/en/translation.json @@ -589,5 +589,25 @@ "sierra_bytecode": "Sierra Bytecode", "starknet_remix": "Starknet Remix", "starknet_cli_starkli": "Starknet CLI (Starkli)", - "number_of_owners": "Number of owners" + "number_of_owners": "Number of owners", + "daily_average_standardized_tps": "Daily Average Standardized Transactions Per Second (STPS)", + "daily_average_erc20_scaling": "Daily Average ERC20 Scaling", + "standardized_tps_today": "Standardized Transactions Per Second today", + "erc20_scaling_today": "ERC20 scaling today", + "user_operations": "User Operations", + "daily_average_uops": "Daily Average User Operations Per Second (UOPS)", + "daily_max_uops": "Daily Max User Operations Per Second", + "daily_average_uopb": "Daily Average User Operations Per Block (UOPB)", + "daily_average_acps": "Daily Average Account Calls Per Second (ACPS)", + "daily_max_acps": "Daily Max Account Calls Per Second", + "daily_average_acpb": "Daily Average Account Calls Per Block (ACPB)", + "number_upos_today": "Number of user operations per second today", + "max_recorded_uops_today": "Max recorded user operations per second today", + "number_uopb_today": "Number of user operations per block today", + "total_user_operations": "Total number of user operations today", + "number_acps_today": "Number of account calls per second today", + "max_recorded_acps_today": "Max recorded account calls per second today", + "number_acpb_today": "Number of account calls per block today", + "total_account_calls": "Total number of account calls today", + "relative_compute": "Relative Compute" } diff --git a/es/translation.json b/es/translation.json index 3e74fd7..d423df8 100644 --- a/es/translation.json +++ b/es/translation.json @@ -589,5 +589,25 @@ "sierra_bytecode": "Sierra Bytecode", "starknet_remix": "Starknet Remix", "starknet_cli_starkli": "Starknet CLI (Starkli)", - "number_of_owners": "Number of owners" + "number_of_owners": "Number of owners", + "daily_average_standardized_tps": "Daily Average Standardized Transactions Per Second (STPS)", + "daily_average_erc20_scaling": "Daily Average ERC20 Scaling", + "standardized_tps_today": "Standardized Transactions Per Second today", + "erc20_scaling_today": "ERC20 scaling today", + "user_operations": "User Operations", + "daily_average_uops": "Daily Average User Operations Per Second (UOPS)", + "daily_max_uops": "Daily Max User Operations Per Second", + "daily_average_uopb": "Daily Average User Operations Per Block (UOPB)", + "daily_average_acps": "Daily Average Account Calls Per Second (ACPS)", + "daily_max_acps": "Daily Max Account Calls Per Second", + "daily_average_acpb": "Daily Average Account Calls Per Block (ACPB)", + "number_upos_today": "Number of user operations per second today", + "max_recorded_uops_today": "Max recorded user operations per second today", + "number_uopb_today": "Number of user operations per block today", + "total_user_operations": "Total number of user operations today", + "number_acps_today": "Number of account calls per second today", + "max_recorded_acps_today": "Max recorded account calls per second today", + "number_acpb_today": "Number of account calls per block today", + "total_account_calls": "Total number of account calls today", + "relative_compute": "Relative Compute" } diff --git a/fr/translation.json b/fr/translation.json index 77d6bce..eb74db7 100644 --- a/fr/translation.json +++ b/fr/translation.json @@ -589,5 +589,25 @@ "sierra_bytecode": "Sierra Bytecode", "starknet_remix": "Starknet Remix", "starknet_cli_starkli": "Starknet CLI (Starkli)", - "number_of_owners": "Number of owners" + "number_of_owners": "Number of owners", + "daily_average_standardized_tps": "Daily Average Standardized Transactions Per Second (STPS)", + "daily_average_erc20_scaling": "Daily Average ERC20 Scaling", + "standardized_tps_today": "Standardized Transactions Per Second today", + "erc20_scaling_today": "ERC20 scaling today", + "user_operations": "User Operations", + "daily_average_uops": "Daily Average User Operations Per Second (UOPS)", + "daily_max_uops": "Daily Max User Operations Per Second", + "daily_average_uopb": "Daily Average User Operations Per Block (UOPB)", + "daily_average_acps": "Daily Average Account Calls Per Second (ACPS)", + "daily_max_acps": "Daily Max Account Calls Per Second", + "daily_average_acpb": "Daily Average Account Calls Per Block (ACPB)", + "number_upos_today": "Number of user operations per second today", + "max_recorded_uops_today": "Max recorded user operations per second today", + "number_uopb_today": "Number of user operations per block today", + "total_user_operations": "Total number of user operations today", + "number_acps_today": "Number of account calls per second today", + "max_recorded_acps_today": "Max recorded account calls per second today", + "number_acpb_today": "Number of account calls per block today", + "total_account_calls": "Total number of account calls today", + "relative_compute": "Relative Compute" } diff --git a/ja/translation.json b/ja/translation.json index 888f74c..dcec708 100644 --- a/ja/translation.json +++ b/ja/translation.json @@ -594,5 +594,25 @@ "sierra_bytecode": "Sierra Bytecode", "starknet_remix": "Starknet Remix", "starknet_cli_starkli": "Starknet CLI (Starkli)", - "number_of_owners": "Number of owners" + "number_of_owners": "Number of owners", + "daily_average_standardized_tps": "Daily Average Standardized Transactions Per Second (STPS)", + "daily_average_erc20_scaling": "Daily Average ERC20 Scaling", + "standardized_tps_today": "Standardized Transactions Per Second today", + "erc20_scaling_today": "ERC20 scaling today", + "user_operations": "User Operations", + "daily_average_uops": "Daily Average User Operations Per Second (UOPS)", + "daily_max_uops": "Daily Max User Operations Per Second", + "daily_average_uopb": "Daily Average User Operations Per Block (UOPB)", + "daily_average_acps": "Daily Average Account Calls Per Second (ACPS)", + "daily_max_acps": "Daily Max Account Calls Per Second", + "daily_average_acpb": "Daily Average Account Calls Per Block (ACPB)", + "number_upos_today": "Number of user operations per second today", + "max_recorded_uops_today": "Max recorded user operations per second today", + "number_uopb_today": "Number of user operations per block today", + "total_user_operations": "Total number of user operations today", + "number_acps_today": "Number of account calls per second today", + "max_recorded_acps_today": "Max recorded account calls per second today", + "number_acpb_today": "Number of account calls per block today", + "total_account_calls": "Total number of account calls today", + "relative_compute": "Relative Compute" } diff --git a/ko/translation.json b/ko/translation.json index e8718f6..185ecc8 100644 --- a/ko/translation.json +++ b/ko/translation.json @@ -589,5 +589,25 @@ "sierra_bytecode": "Sierra Bytecode", "starknet_remix": "Starknet Remix", "starknet_cli_starkli": "Starknet CLI (Starkli)", - "number_of_owners": "Number of owners" + "number_of_owners": "Number of owners", + "daily_average_standardized_tps": "Daily Average Standardized Transactions Per Second (STPS)", + "daily_average_erc20_scaling": "Daily Average ERC20 Scaling", + "standardized_tps_today": "Standardized Transactions Per Second today", + "erc20_scaling_today": "ERC20 scaling today", + "user_operations": "User Operations", + "daily_average_uops": "Daily Average User Operations Per Second (UOPS)", + "daily_max_uops": "Daily Max User Operations Per Second", + "daily_average_uopb": "Daily Average User Operations Per Block (UOPB)", + "daily_average_acps": "Daily Average Account Calls Per Second (ACPS)", + "daily_max_acps": "Daily Max Account Calls Per Second", + "daily_average_acpb": "Daily Average Account Calls Per Block (ACPB)", + "number_upos_today": "Number of user operations per second today", + "max_recorded_uops_today": "Max recorded user operations per second today", + "number_uopb_today": "Number of user operations per block today", + "total_user_operations": "Total number of user operations today", + "number_acps_today": "Number of account calls per second today", + "max_recorded_acps_today": "Max recorded account calls per second today", + "number_acpb_today": "Number of account calls per block today", + "total_account_calls": "Total number of account calls today", + "relative_compute": "Relative Compute" } diff --git a/main.js b/main.js index b814413..70ebcfa 100644 --- a/main.js +++ b/main.js @@ -1,4 +1,4 @@ -const fs = require("fs"); +const fs = require("fs") const ignoreFiles = [ ".github", @@ -8,59 +8,57 @@ const ignoreFiles = [ "main.js", "add-key.js", "README.md", -]; +] function getFiles(dir, files = []) { // Get an array of all files and directories in the passed directory using fs.readdirSync - const fileList = fs.readdirSync(dir); + const fileList = fs.readdirSync(dir) - const filteredFileList = fileList.filter( - (file) => !ignoreFiles.includes(file) - ); + const filteredFileList = fileList.filter(file => !ignoreFiles.includes(file)) for (const file of filteredFileList) { - const name = `${dir}/${file}`; + const name = `${dir}/${file}` if (fs.statSync(name).isDirectory()) { - getFiles(name, files); + getFiles(name, files) } else { - files.push(name); + files.push(name) } } - return files; + return files } const main = () => { // We already know this - const enPath = "./en/translation.json"; + const enPath = "./en/translation.json" const enData = fs.readFileSync(enPath, { encoding: "utf-8", - }); - const targetKeys = Object.keys(JSON.parse(enData)); + }) + const targetKeys = Object.keys(JSON.parse(enData)) - const files = getFiles("."); + const files = getFiles(".") - files.forEach((file) => { + files.forEach(file => { if (file != enPath) { - console.info(`Checking locale ${file}`) - let not_included = []; + console.info(`Checking locale ${file}`) + let not_included = [] try { const data = fs.readFileSync(file, { encoding: "utf-8", - }); - const thisLang = JSON.parse(data); - const thisLangKeys = Object.keys(thisLang); - not_included = targetKeys.filter( - (t_key) => !thisLangKeys.includes(t_key) - ); + }) + const thisLang = JSON.parse(data) + const thisLangKeys = Object.keys(thisLang) + not_included = targetKeys.filter(t_key => !thisLangKeys.includes(t_key)) } catch (e) { - console.error(`Unexpected Error: ${e}`); + console.error(`Unexpected Error: ${e}`) } if (not_included.length > 0) { - throw new Error(`Missing keys for locale ${file}: \n - ${not_included.join(" \n - ")}\n\n`); + throw new Error( + `Missing keys for locale ${file}: \n - ${not_included.join(" \n - ")}\n\n` + ) } } - }); -}; + }) +} -main(); +main() diff --git a/ru/translation.json b/ru/translation.json index c5d4d24..55b0f61 100644 --- a/ru/translation.json +++ b/ru/translation.json @@ -589,5 +589,25 @@ "sierra_bytecode": "Sierra Bytecode", "starknet_remix": "Starknet Remix", "starknet_cli_starkli": "Starknet CLI (Starkli)", - "number_of_owners": "Number of owners" + "number_of_owners": "Number of owners", + "daily_average_standardized_tps": "Daily Average Standardized Transactions Per Second (STPS)", + "daily_average_erc20_scaling": "Daily Average ERC20 Scaling", + "standardized_tps_today": "Standardized Transactions Per Second today", + "erc20_scaling_today": "ERC20 scaling today", + "user_operations": "User Operations", + "daily_average_uops": "Daily Average User Operations Per Second (UOPS)", + "daily_max_uops": "Daily Max User Operations Per Second", + "daily_average_uopb": "Daily Average User Operations Per Block (UOPB)", + "daily_average_acps": "Daily Average Account Calls Per Second (ACPS)", + "daily_max_acps": "Daily Max Account Calls Per Second", + "daily_average_acpb": "Daily Average Account Calls Per Block (ACPB)", + "number_upos_today": "Number of user operations per second today", + "max_recorded_uops_today": "Max recorded user operations per second today", + "number_uopb_today": "Number of user operations per block today", + "total_user_operations": "Total number of user operations today", + "number_acps_today": "Number of account calls per second today", + "max_recorded_acps_today": "Max recorded account calls per second today", + "number_acpb_today": "Number of account calls per block today", + "total_account_calls": "Total number of account calls today", + "relative_compute": "Relative Compute" } diff --git a/uk/translation.json b/uk/translation.json index 9219963..61feb8a 100644 --- a/uk/translation.json +++ b/uk/translation.json @@ -589,5 +589,25 @@ "sierra_bytecode": "Sierra Bytecode", "starknet_remix": "Starknet Remix", "starknet_cli_starkli": "Starknet CLI (Starkli)", - "number_of_owners": "Number of owners" + "number_of_owners": "Number of owners", + "daily_average_standardized_tps": "Daily Average Standardized Transactions Per Second (STPS)", + "daily_average_erc20_scaling": "Daily Average ERC20 Scaling", + "standardized_tps_today": "Standardized Transactions Per Second today", + "erc20_scaling_today": "ERC20 scaling today", + "user_operations": "User Operations", + "daily_average_uops": "Daily Average User Operations Per Second (UOPS)", + "daily_max_uops": "Daily Max User Operations Per Second", + "daily_average_uopb": "Daily Average User Operations Per Block (UOPB)", + "daily_average_acps": "Daily Average Account Calls Per Second (ACPS)", + "daily_max_acps": "Daily Max Account Calls Per Second", + "daily_average_acpb": "Daily Average Account Calls Per Block (ACPB)", + "number_upos_today": "Number of user operations per second today", + "max_recorded_uops_today": "Max recorded user operations per second today", + "number_uopb_today": "Number of user operations per block today", + "total_user_operations": "Total number of user operations today", + "number_acps_today": "Number of account calls per second today", + "max_recorded_acps_today": "Max recorded account calls per second today", + "number_acpb_today": "Number of account calls per block today", + "total_account_calls": "Total number of account calls today", + "relative_compute": "Relative Compute" } diff --git a/vi/translation.json b/vi/translation.json index a660123..d9a146f 100644 --- a/vi/translation.json +++ b/vi/translation.json @@ -589,5 +589,25 @@ "sierra_bytecode": "Sierra Bytecode", "starknet_remix": "Starknet Remix", "starknet_cli_starkli": "Starknet CLI (Starkli)", - "number_of_owners": "Number of owners" + "number_of_owners": "Number of owners", + "daily_average_standardized_tps": "Daily Average Standardized Transactions Per Second (STPS)", + "daily_average_erc20_scaling": "Daily Average ERC20 Scaling", + "standardized_tps_today": "Standardized Transactions Per Second today", + "erc20_scaling_today": "ERC20 scaling today", + "user_operations": "User Operations", + "daily_average_uops": "Daily Average User Operations Per Second (UOPS)", + "daily_max_uops": "Daily Max User Operations Per Second", + "daily_average_uopb": "Daily Average User Operations Per Block (UOPB)", + "daily_average_acps": "Daily Average Account Calls Per Second (ACPS)", + "daily_max_acps": "Daily Max Account Calls Per Second", + "daily_average_acpb": "Daily Average Account Calls Per Block (ACPB)", + "number_upos_today": "Number of user operations per second today", + "max_recorded_uops_today": "Max recorded user operations per second today", + "number_uopb_today": "Number of user operations per block today", + "total_user_operations": "Total number of user operations today", + "number_acps_today": "Number of account calls per second today", + "max_recorded_acps_today": "Max recorded account calls per second today", + "number_acpb_today": "Number of account calls per block today", + "total_account_calls": "Total number of account calls today", + "relative_compute": "Relative Compute" } diff --git a/zh-CN/translation.json b/zh-CN/translation.json index a7b2704..0b58fe6 100644 --- a/zh-CN/translation.json +++ b/zh-CN/translation.json @@ -592,5 +592,25 @@ "sierra_bytecode": "Sierra Bytecode", "starknet_remix": "Starknet Remix", "starknet_cli_starkli": "Starknet CLI (Starkli)", - "number_of_owners": "Number of owners" + "number_of_owners": "Number of owners", + "daily_average_standardized_tps": "Daily Average Standardized Transactions Per Second (STPS)", + "daily_average_erc20_scaling": "Daily Average ERC20 Scaling", + "standardized_tps_today": "Standardized Transactions Per Second today", + "erc20_scaling_today": "ERC20 scaling today", + "user_operations": "User Operations", + "daily_average_uops": "Daily Average User Operations Per Second (UOPS)", + "daily_max_uops": "Daily Max User Operations Per Second", + "daily_average_uopb": "Daily Average User Operations Per Block (UOPB)", + "daily_average_acps": "Daily Average Account Calls Per Second (ACPS)", + "daily_max_acps": "Daily Max Account Calls Per Second", + "daily_average_acpb": "Daily Average Account Calls Per Block (ACPB)", + "number_upos_today": "Number of user operations per second today", + "max_recorded_uops_today": "Max recorded user operations per second today", + "number_uopb_today": "Number of user operations per block today", + "total_user_operations": "Total number of user operations today", + "number_acps_today": "Number of account calls per second today", + "max_recorded_acps_today": "Max recorded account calls per second today", + "number_acpb_today": "Number of account calls per block today", + "total_account_calls": "Total number of account calls today", + "relative_compute": "Relative Compute" }