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 c8c7613a2d..ccecf3bbc4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -143,3 +143,11 @@ 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 `npm run inlang:lint` inside `website` to find missing translations. diff --git a/inlang.config.js b/inlang.config.js new file mode 100644 index 0000000000..715a67aca9 --- /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(), + ], + }; +} diff --git a/website/package-lock.json b/website/package-lock.json index 1d6f40d897..25825c4c32 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -20,6 +20,7 @@ "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", "@icons-pack/react-simple-icons": "^5.11.0", + "@inlang/cli": "^0.10.1", "@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.10.1", + "resolved": "https://registry.npmjs.org/@inlang/cli/-/cli-0.10.1.tgz", + "integrity": "sha512-hzosMLQVF87y5Y2SDQZy5bsk2GBLo6XeHrnNXEQDI1IBfvCM7oi3w5sVjCU84BjqBme5N2YWfNkvhYZRQAo0qg==", + "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 3c4a8c06df..f9f197fe94 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,6 +41,7 @@ "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", "@icons-pack/react-simple-icons": "^5.11.0", + "@inlang/cli": "^0.10.1", "@marsidev/react-turnstile": "^0.0.7", "@next-auth/prisma-adapter": "^1.0.6", "@next/bundle-analyzer": "^13.4.4",