From 3b0ae2dc6befa7137cd4bc4010f78378c22300b7 Mon Sep 17 00:00:00 2001 From: Niklas Buchfink <59048346+NiklasBuchfink@users.noreply.github.com> Date: Mon, 12 Jun 2023 16:35:41 +0200 Subject: [PATCH 1/6] Create inlang.config.js --- inlang.config.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 inlang.config.js diff --git a/inlang.config.js b/inlang.config.js new file mode 100644 index 0000000000..ace492f103 --- /dev/null +++ b/inlang.config.js @@ -0,0 +1,18 @@ +export async function defineConfig(env) { + const { default: i18nextPlugin } = await env.$import( + "https://cdn.jsdelivr.net/npm/@inlang/plugin-i18next@2/dist/index.js", + ) + const { default: standardLintRules } = await env.$import( + "https://cdn.jsdelivr.net/gh/inlang/standard-lint-rules@2/dist/index.js", + ) + + return { + referenceLanguage: "en", + plugins: [ + i18nextPlugin({ + pathPattern: "./website/public/locales/{language}/*.json", + }), + standardLintRules(), + ], + } +} From 87f06c257d92417a0f8fe54bccbae7d4735749d9 Mon Sep 17 00:00:00 2001 From: Niklas Buchfink <59048346+NiklasBuchfink@users.noreply.github.com> Date: Mon, 12 Jun 2023 14:55:44 +0000 Subject: [PATCH 2/6] add inlang cli --- .gitignore | 3 +++ package-lock.json | 23 +++++++++++++++++++++++ package.json | 5 +++++ 3 files changed, 31 insertions(+) create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore index 0a684fe957..9968aeec7d 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,6 @@ backend/openapi.json # JetBrains PyCharm: .idea/ + +# Dependency directories +node_modules/ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000000..e2a46afb44 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,23 @@ +{ + "name": "Open-Assistant", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "@inlang/cli": "^0.9.16" + } + }, + "node_modules/@inlang/cli": { + "version": "0.9.16", + "resolved": "https://registry.npmjs.org/@inlang/cli/-/cli-0.9.16.tgz", + "integrity": "sha512-51P3/2qWkGeJ7noySjsz+PmQ2xBRqLQ/QXtAQVMt156CfftcOcBfVQdGNgtw1I1NSmSNObd8Ihvcr5+QkPt0Cg==", + "bin": { + "inlang": "bin/run.js" + }, + "engines": { + "node": ">=16.15.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000000..1d2b3b90e1 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@inlang/cli": "^0.9.16" + } +} From 14229628ab04200e66cfbd7b25ef37c7ecdd711f Mon Sep 17 00:00:00 2001 From: Niklas Buchfink <59048346+NiklasBuchfink@users.noreply.github.com> Date: Mon, 12 Jun 2023 17:12:24 +0200 Subject: [PATCH 3/6] Update CONTRIBUTING.md --- CONTRIBUTING.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c8c7613a2d..199681acfb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -143,3 +143,8 @@ automatically deploy the built release to the dev machine. See [here](https://github.com/LAION-AI/Open-Assistant/blob/main/data/datasets/README.md) + +## Translations +[![translation badge](https://inlang.com/badge?url=github.com/LAION-AI/Open-Assistant)](https://inlang.com/editor/github.com/LAION-AI/Open-Assistant?ref=badge) + +To add translations, you can manually edit the JSON translation files in `website/public/locales`, use the [inlang](https://inlang.com/) online editor, or run the `@inlang/cli` to find missing translations and create machine translations. From 6e43186350afb1a8b3215696bbe8bb0817c82301 Mon Sep 17 00:00:00 2001 From: NiklasBuchfink Date: Mon, 12 Jun 2023 18:40:52 +0200 Subject: [PATCH 4/6] run prettier to pass pre-commit --- CONTRIBUTING.md | 6 +++++- inlang.config.js | 26 +++++++++++++------------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 199681acfb..c4567f5b39 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -145,6 +145,10 @@ See [here](https://github.com/LAION-AI/Open-Assistant/blob/main/data/datasets/README.md) ## Translations + [![translation badge](https://inlang.com/badge?url=github.com/LAION-AI/Open-Assistant)](https://inlang.com/editor/github.com/LAION-AI/Open-Assistant?ref=badge) -To add translations, you can manually edit the JSON translation files in `website/public/locales`, use the [inlang](https://inlang.com/) online editor, or run the `@inlang/cli` to find missing translations and create machine translations. +To add translations, you can manually edit the JSON translation files in +`website/public/locales`, use the [inlang](https://inlang.com/) online editor, +or run the `@inlang/cli` to find missing translations and create machine +translations. diff --git a/inlang.config.js b/inlang.config.js index ace492f103..715a67aca9 100644 --- a/inlang.config.js +++ b/inlang.config.js @@ -1,18 +1,18 @@ export async function defineConfig(env) { - const { default: i18nextPlugin } = await env.$import( - "https://cdn.jsdelivr.net/npm/@inlang/plugin-i18next@2/dist/index.js", - ) + const { default: i18nextPlugin } = await env.$import( + "https://cdn.jsdelivr.net/npm/@inlang/plugin-i18next@2/dist/index.js" + ); const { default: standardLintRules } = await env.$import( - "https://cdn.jsdelivr.net/gh/inlang/standard-lint-rules@2/dist/index.js", - ) + "https://cdn.jsdelivr.net/gh/inlang/standard-lint-rules@2/dist/index.js" + ); - return { - referenceLanguage: "en", - plugins: [ - i18nextPlugin({ - pathPattern: "./website/public/locales/{language}/*.json", - }), + return { + referenceLanguage: "en", + plugins: [ + i18nextPlugin({ + pathPattern: "./website/public/locales/{language}/*.json", + }), standardLintRules(), - ], - } + ], + }; } From 0015f68deae9c69f93c3fc4bbfa9ace14c22b09d Mon Sep 17 00:00:00 2001 From: NiklasBuchfink Date: Tue, 13 Jun 2023 10:35:04 +0200 Subject: [PATCH 5/6] move @inlang/cli to /website --- .gitignore | 3 --- package-lock.json | 23 ----------------------- package.json | 5 ----- website/package-lock.json | 12 ++++++++++++ website/package.json | 1 + 5 files changed, 13 insertions(+), 31 deletions(-) delete mode 100644 package-lock.json delete mode 100644 package.json diff --git a/.gitignore b/.gitignore index 9968aeec7d..0a684fe957 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,3 @@ backend/openapi.json # JetBrains PyCharm: .idea/ - -# Dependency directories -node_modules/ diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index e2a46afb44..0000000000 --- a/package-lock.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "Open-Assistant", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "dependencies": { - "@inlang/cli": "^0.9.16" - } - }, - "node_modules/@inlang/cli": { - "version": "0.9.16", - "resolved": "https://registry.npmjs.org/@inlang/cli/-/cli-0.9.16.tgz", - "integrity": "sha512-51P3/2qWkGeJ7noySjsz+PmQ2xBRqLQ/QXtAQVMt156CfftcOcBfVQdGNgtw1I1NSmSNObd8Ihvcr5+QkPt0Cg==", - "bin": { - "inlang": "bin/run.js" - }, - "engines": { - "node": ">=16.15.0" - } - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index 1d2b3b90e1..0000000000 --- a/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "@inlang/cli": "^0.9.16" - } -} diff --git a/website/package-lock.json b/website/package-lock.json index 38be0a6864..230214e361 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -20,6 +20,7 @@ "@emotion/react": "^11.11.0", "@emotion/styled": "^11.11.0", "@icons-pack/react-simple-icons": "^5.11.0", + "@inlang/cli": "^0.9.16", "@marsidev/react-turnstile": "^0.0.7", "@next-auth/prisma-adapter": "^1.0.6", "@next/bundle-analyzer": "^13.4.4", @@ -4183,6 +4184,17 @@ "react": "^16.13 || ^17 || ^18" } }, + "node_modules/@inlang/cli": { + "version": "0.9.16", + "resolved": "https://registry.npmjs.org/@inlang/cli/-/cli-0.9.16.tgz", + "integrity": "sha512-51P3/2qWkGeJ7noySjsz+PmQ2xBRqLQ/QXtAQVMt156CfftcOcBfVQdGNgtw1I1NSmSNObd8Ihvcr5+QkPt0Cg==", + "bin": { + "inlang": "bin/run.js" + }, + "engines": { + "node": ">=16.15.0" + } + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", diff --git a/website/package.json b/website/package.json index b3a3cc04a5..a93faee7a9 100644 --- a/website/package.json +++ b/website/package.json @@ -38,6 +38,7 @@ "@emotion/react": "^11.11.0", "@emotion/styled": "^11.11.0", "@icons-pack/react-simple-icons": "^5.11.0", + "@inlang/cli": "^0.9.16", "@marsidev/react-turnstile": "^0.0.7", "@next-auth/prisma-adapter": "^1.0.6", "@next/bundle-analyzer": "^13.4.4", From 8d4bad8ed5ace14c9d5ea246d4cc9764debcf030 Mon Sep 17 00:00:00 2001 From: NiklasBuchfink Date: Tue, 13 Jun 2023 15:10:18 +0200 Subject: [PATCH 6/6] update @inlang/cli, add extension recommendation --- .vscode/extensions.json | 3 ++- CONTRIBUTING.md | 3 +-- website/package-lock.json | 8 ++++---- website/package.json | 5 ++++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index cf91a68b2d..ac3b940a0a 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,6 +2,7 @@ "recommendations": [ "ms-vscode-remote.remote-containers", "ms-vscode-remote.vscode-remote-extensionpack", - "esbenp.prettier-vscode" + "esbenp.prettier-vscode", + "inlang.vs-code-extension" ] } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c4567f5b39..ccecf3bbc4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -150,5 +150,4 @@ See To add translations, you can manually edit the JSON translation files in `website/public/locales`, use the [inlang](https://inlang.com/) online editor, -or run the `@inlang/cli` to find missing translations and create machine -translations. +or run `npm run inlang:lint` inside `website` to find missing translations. diff --git a/website/package-lock.json b/website/package-lock.json index 230214e361..4f9188ae67 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -20,7 +20,7 @@ "@emotion/react": "^11.11.0", "@emotion/styled": "^11.11.0", "@icons-pack/react-simple-icons": "^5.11.0", - "@inlang/cli": "^0.9.16", + "@inlang/cli": "^0.10.1", "@marsidev/react-turnstile": "^0.0.7", "@next-auth/prisma-adapter": "^1.0.6", "@next/bundle-analyzer": "^13.4.4", @@ -4185,9 +4185,9 @@ } }, "node_modules/@inlang/cli": { - "version": "0.9.16", - "resolved": "https://registry.npmjs.org/@inlang/cli/-/cli-0.9.16.tgz", - "integrity": "sha512-51P3/2qWkGeJ7noySjsz+PmQ2xBRqLQ/QXtAQVMt156CfftcOcBfVQdGNgtw1I1NSmSNObd8Ihvcr5+QkPt0Cg==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@inlang/cli/-/cli-0.10.1.tgz", + "integrity": "sha512-hzosMLQVF87y5Y2SDQZy5bsk2GBLo6XeHrnNXEQDI1IBfvCM7oi3w5sVjCU84BjqBme5N2YWfNkvhYZRQAo0qg==", "bin": { "inlang": "bin/run.js" }, diff --git a/website/package.json b/website/package.json index a93faee7a9..a7ed54aec8 100644 --- a/website/package.json +++ b/website/package.json @@ -17,6 +17,9 @@ "cypress:run:contract": "cypress run --config-file ./cypress.config.contract.js", "cypress:component": "cypress run --component", "cypress:image-baseline": "cypress-image-diff -u", + "inlang:lint": "npx inlang lint --config ../inlang.config.js", + "inlang:machine-translate": "npx inlang machine translate --config ../inlang.config.js", + "inlang:open-editor": "npx inlang open editor", "jest": "jest --watch", "fix:lint": "eslint --fix src/ --ext .js,.jsx,.ts,.tsx", "fix:format": "prettier --write ./src", @@ -38,7 +41,7 @@ "@emotion/react": "^11.11.0", "@emotion/styled": "^11.11.0", "@icons-pack/react-simple-icons": "^5.11.0", - "@inlang/cli": "^0.9.16", + "@inlang/cli": "^0.10.1", "@marsidev/react-turnstile": "^0.0.7", "@next-auth/prisma-adapter": "^1.0.6", "@next/bundle-analyzer": "^13.4.4",