diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ad75b766..e0d41bd6 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,48 +1,49 @@ ## Description + ## Related Issues + ## Changes Made + -- -- -- -- + +- +- +- ## Testing Done + ## Screenshots (if applicable) + ## Checklist + + - [ ] Code follows project style guidelines - [ ] Documentation has been updated or added - [ ] Tests have been added or updated -- [ ] All CI checks pass -- [ ] Dependent changes have been merged - -## Additional Notes - \ No newline at end of file +- [ ] All i18n translation labels have bee added diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a6230fb..e9a230d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,9 @@ -name: Push to Master/Main CI +name: Push to Main CI on: push: branches: - main - - master permissions: contents: write diff --git a/.github/workflows/crowdin-download.yml b/.github/workflows/crowdin-download.yml new file mode 100644 index 00000000..cbead21d --- /dev/null +++ b/.github/workflows/crowdin-download.yml @@ -0,0 +1,35 @@ +name: Crowdin Download Translations Action + +on: + schedule: # Every Sunday at midnight + - cron: '0 0 * * 0' + workflow_dispatch: # Allow manual triggering + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download translations with Crowdin + uses: crowdin/github-action@v2 + with: + base_url: 'https://meshtastic.crowdin.com/api/v2' + config: 'crowdin.yml' + upload_sources: false + upload_translations: false + download_translations: true + localization_branch_name: i18n_crowdin_translations + commit_message: 'chore(i18n): New Crowdin Translations by GitHub Action' + create_pull_request: true + pull_request_title: 'chore(i18n): New Crowdin Translations' + pull_request_body: 'New Crowdin translations by [Crowdin GH Action](https://github.com/crowdin/github-action)' + pull_request_base_branch_name: 'main' + pull_request_labels: 'i18n' + crowdin_branch_name: 'main' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/crowdin-upload-sources.yml b/.github/workflows/crowdin-upload-sources.yml new file mode 100644 index 00000000..4f77f1b3 --- /dev/null +++ b/.github/workflows/crowdin-upload-sources.yml @@ -0,0 +1,32 @@ +name: Crowdin Upload Sources Action + +on: + push: + # Monitor all .json files within the /src/i18n/locales/en/ directory. + # This ensures the workflow triggers if any the English namespace files are modified on the main branch. + paths: + - '/src/i18n/locales/en/**/*.json' + branches: [ main ] + workflow_dispatch: # Allow manual triggering + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Upload sources with Crowdin + uses: crowdin/github-action@v2 + with: + base_url: 'https://meshtastic.crowdin.com/api/v2' + config: 'crowdin.yml' + upload_sources: true + upload_translations: false + download_translations: false + crowdin_branch_name: 'main' + + env: + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/crowdin-upload-translations.yml b/.github/workflows/crowdin-upload-translations.yml new file mode 100644 index 00000000..e5e94010 --- /dev/null +++ b/.github/workflows/crowdin-upload-translations.yml @@ -0,0 +1,25 @@ +name: Crowdin Upload Translations Action + +on: + workflow_dispatch: # Allow manual triggering + +jobs: + synchronize-with-crowdin: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Upload translations with Crowdin + uses: crowdin/github-action@v2 + with: + base_url: "https://meshtastic.crowdin.com/api/v2" + config: "crowdin.yml" + upload_sources: false + upload_translations: true + download_translations: false + crowdin_branch_name: "main" + env: + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} diff --git a/.github/workflows/update-stable-from-master.yml b/.github/workflows/update-stable-from-master.yml index c77f1c72..601d113c 100644 --- a/.github/workflows/update-stable-from-master.yml +++ b/.github/workflows/update-stable-from-master.yml @@ -1,4 +1,4 @@ -name: Update Stable Branch from Master on Latest Release +name: Update Stable Branch from Main on Latest Release on: release: @@ -9,7 +9,7 @@ permissions: jobs: update-stable-branch: - name: Update Stable Branch from Master + name: Update Stable Branch from Main runs-on: ubuntu-latest steps: @@ -24,14 +24,14 @@ jobs: git config user.name "GitHub Actions Bot" git config user.email "github-actions[bot]@users.noreply.github.com" - - name: Fetch latest master and stable branches + - name: Fetch latest main and stable branches run: | - git fetch origin master:master + git fetch origin main:main git fetch origin stable:stable || echo "Stable branch not found remotely, will create." - - name: Get latest master commit SHA - id: get_master_sha - run: echo "MASTER_SHA=$(git rev-parse master)" >> $GITHUB_ENV + - name: Get latest main commit SHA + id: get_main_sha + run: echo "MAIN_SHA=$(git rev-parse main)" >> $GITHUB_ENV - name: Check out stable branch run: | @@ -39,12 +39,12 @@ jobs: git checkout stable git pull origin stable # Sync with remote stable if it exists else - echo "Creating local stable branch based on master HEAD." - git checkout -b stable ${{ env.MASTER_SHA }} + echo "Creating local stable branch based on main HEAD." + git checkout -b stable ${{ env.MAIN_SHA }} fi - - name: Reset stable branch to latest master - run: git reset --hard ${{ env.MASTER_SHA }} + - name: Reset stable branch to latest main + run: git reset --hard ${{ env.MAIN_SHA }} - name: Force push stable branch run: git push origin stable --force \ No newline at end of file diff --git a/crowdin.yml b/crowdin.yml new file mode 100644 index 00000000..14d994ec --- /dev/null +++ b/crowdin.yml @@ -0,0 +1,10 @@ +project_id_env: CROWDIN_PROJECT_ID +api_token_env: CROWDIN_PERSONAL_TOKEN +base_path: "." +base_url: "https://meshtastic.crowdin.com/api/v2" + +preserve_hierarchy: true + +files: + - source: "/src/i18n/locales/en/**/*.json" + translation: "/src/i18n/locales/%locale%/%original_file_name%" diff --git a/deno.json b/deno.json index 6a835aef..c1a8d131 100644 --- a/deno.json +++ b/deno.json @@ -4,7 +4,8 @@ "@pages/": "./src/pages/", "@components/": "./src/components/", "@core/": "./src/core/", - "@layouts/": "./src/layouts/" + "@layouts/": "./src/layouts/", + "@std/path": "jsr:@std/path@^1.1.0" }, "compilerOptions": { "lib": [ diff --git a/deno.lock b/deno.lock index 33d1e81a..4ca22c46 100644 --- a/deno.lock +++ b/deno.lock @@ -1,6 +1,8 @@ { "version": "5", "specifiers": { + "jsr:@std/path@*": "1.0.6", + "jsr:@std/path@^1.1.0": "1.1.0", "npm:@bufbuild/protobuf@^2.2.5": "2.2.5", "npm:@jsr/meshtastic__core@2.6.2": "2.6.2", "npm:@jsr/meshtastic__js@2.6.0-0": "2.6.0-0", @@ -22,6 +24,7 @@ "npm:@radix-ui/react-switch@^1.2.2": "1.2.2_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "npm:@radix-ui/react-tabs@^1.1.9": "1.1.9_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "npm:@radix-ui/react-toast@^1.2.11": "1.2.11_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", + "npm:@radix-ui/react-toggle-group@^1.1.9": "1.1.10_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "npm:@radix-ui/react-tooltip@^1.2.4": "1.2.4_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "npm:@tailwindcss/postcss@^4.1.5": "4.1.5", "npm:@testing-library/jest-dom@^6.6.3": "6.6.3", @@ -46,6 +49,9 @@ "npm:crypto-random-string@5": "5.0.0", "npm:gzipper@^8.2.1": "8.2.1", "npm:happy-dom@^17.4.6": "17.4.6", + "npm:i18next-browser-languagedetector@^8.1.0": "8.1.0", + "npm:i18next-http-backend@^3.0.2": "3.0.2", + "npm:i18next@^25.2.0": "25.2.0_typescript@5.8.3", "npm:idb-keyval@^6.2.1": "6.2.1", "npm:immer@^10.1.1": "10.1.1", "npm:js-cookie@^3.0.5": "3.0.5", @@ -55,6 +61,7 @@ "npm:react-dom@^19.1.0": "19.1.0_react@19.1.0", "npm:react-error-boundary@6": "6.0.0_react@19.1.0", "npm:react-hook-form@^7.56.2": "7.56.2_react@19.1.0", + "npm:react-i18next@^15.5.1": "15.5.1_i18next@25.2.0__typescript@5.8.3_react@19.1.0_typescript@5.8.3", "npm:react-map-gl@8.0.4": "8.0.4_maplibre-gl@5.4.0_react@19.1.0_react-dom@19.1.0__react@19.1.0", "npm:react-qrcode-logo@3": "3.0.0_react@19.1.0_react-dom@19.1.0__react@19.1.0", "npm:react@^19.1.0": "19.1.0", @@ -66,6 +73,7 @@ "npm:tar@^7.4.3": "7.4.3", "npm:testing-library@^0.0.2": "0.0.2_@angular+common@6.1.10__@angular+core@6.1.10___rxjs@6.6.7___zone.js@0.8.29__rxjs@6.6.7_@angular+core@6.1.10__rxjs@6.6.7__zone.js@0.8.29", "npm:typescript@^5.8.3": "5.8.3", + "npm:vite-plugin-i18n-ally@^6.0.1": "6.0.1_vite@6.3.4__@types+node@22.15.3__picomatch@4.0.2_@types+node@22.15.3", "npm:vite-plugin-node-polyfills@0.23": "0.23.0_vite@6.3.4__@types+node@22.15.3__picomatch@4.0.2_@types+node@22.15.3", "npm:vite-plugin-pwa@1": "1.0.0_vite@6.3.4__@types+node@22.15.3__picomatch@4.0.2_workbox-build@7.3.0__ajv@8.17.1__@babel+core@7.27.1__rollup@2.79.2_workbox-window@7.3.0_@types+node@22.15.3", "npm:vite@^6.3.4": "6.3.4_@types+node@22.15.3_picomatch@4.0.2", @@ -73,6 +81,14 @@ "npm:zod@^3.24.3": "3.24.3", "npm:zustand@5.0.4": "5.0.4_@types+react@19.1.2_immer@10.1.1_react@19.1.0" }, + "jsr": { + "@std/path@1.0.6": { + "integrity": "ab2c55f902b380cf28e0eec501b4906e4c1960d13f00e11cfbcd21de15f18fed" + }, + "@std/path@1.1.0": { + "integrity": "ddc94f8e3c275627281cbc23341df6b8bcc874d70374f75fec2533521e3d6886" + } + }, "npm": { "@adobe/css-tools@4.4.2": { "integrity": "sha512-baYZExFpsdkBNuvGKTKWCwKH57HRZLVtycZS05WTQNVOiXVSeAki3nU35zlRbToeMW8aHlJfyS+1C4BOv27q0A==" @@ -1206,6 +1222,23 @@ "@noble/hashes@1.8.0": { "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==" }, + "@nodelib/fs.scandir@2.1.5": { + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dependencies": [ + "@nodelib/fs.stat", + "run-parallel" + ] + }, + "@nodelib/fs.stat@2.0.5": { + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==" + }, + "@nodelib/fs.walk@1.2.8": { + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dependencies": [ + "@nodelib/fs.scandir", + "fastq" + ] + }, "@radix-ui/number@1.1.1": { "integrity": "sha512-MkKCwxlXTgz6CFoJx3pCwn07GKp36+aZyu/u2Ln2VrA5DcdyCZkASEDBTd8x5whTQQL5CiYf4prXKLcgQdv29g==" }, @@ -1217,12 +1250,12 @@ "dependencies": [ "@radix-ui/primitive", "@radix-ui/react-collapsible", - "@radix-ui/react-collection", + "@radix-ui/react-collection@1.1.4_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-compose-refs", "@radix-ui/react-context", "@radix-ui/react-direction", "@radix-ui/react-id", - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-use-controllable-state", "@types/react", "@types/react-dom", @@ -1237,7 +1270,7 @@ "@radix-ui/react-arrow@1.1.4_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0": { "integrity": "sha512-qz+fxrqgNxG0dYew5l7qR3c7wdgRu1XVUHGnGYX7rg5HM4p9SWaRmJwfgR3J0SgyUKayLmzQIun+N6rWRgiRKw==", "dependencies": [ - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@types/react", "@types/react-dom", "react", @@ -1255,7 +1288,7 @@ "@radix-ui/react-compose-refs", "@radix-ui/react-context", "@radix-ui/react-presence", - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-use-controllable-state", "@radix-ui/react-use-previous", "@radix-ui/react-use-size", @@ -1277,7 +1310,7 @@ "@radix-ui/react-context", "@radix-ui/react-id", "@radix-ui/react-presence", - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-use-controllable-state", "@radix-ui/react-use-layout-effect", "@types/react", @@ -1295,8 +1328,25 @@ "dependencies": [ "@radix-ui/react-compose-refs", "@radix-ui/react-context", - "@radix-ui/react-primitive", - "@radix-ui/react-slot", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", + "@radix-ui/react-slot@1.2.0_@types+react@19.1.2_react@19.1.0", + "@types/react", + "@types/react-dom", + "react", + "react-dom" + ], + "optionalPeers": [ + "@types/react", + "@types/react-dom" + ] + }, + "@radix-ui/react-collection@1.1.7_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0": { + "integrity": "sha512-Fh9rGN0MoI4ZFUNyfFVNU4y9LUz93u9/0K+yLgA2bwRojxM8JU1DyvvMBabnZPBgMWREAJvU2jjVzq+LrFUglw==", + "dependencies": [ + "@radix-ui/react-compose-refs", + "@radix-ui/react-context", + "@radix-ui/react-primitive@2.1.3_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", + "@radix-ui/react-slot@1.2.3_@types+react@19.1.2_react@19.1.0", "@types/react", "@types/react-dom", "react", @@ -1339,8 +1389,8 @@ "@radix-ui/react-id", "@radix-ui/react-portal", "@radix-ui/react-presence", - "@radix-ui/react-primitive", - "@radix-ui/react-slot", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", + "@radix-ui/react-slot@1.2.0_@types+react@19.1.2_react@19.1.0", "@radix-ui/react-use-controllable-state", "@types/react", "@types/react-dom", @@ -1369,7 +1419,7 @@ "dependencies": [ "@radix-ui/primitive", "@radix-ui/react-compose-refs", - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-use-callback-ref", "@radix-ui/react-use-escape-keydown", "@types/react", @@ -1390,7 +1440,7 @@ "@radix-ui/react-context", "@radix-ui/react-id", "@radix-ui/react-menu", - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-use-controllable-state", "@types/react", "@types/react-dom", @@ -1416,7 +1466,7 @@ "integrity": "sha512-r2annK27lIW5w9Ho5NyQgqs0MmgZSTIKXWpVCJaLC1q2kZrZkcqnmHkCHMEmv8XLvsLlurKMPT+kbKkRkm/xVA==", "dependencies": [ "@radix-ui/react-compose-refs", - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-use-callback-ref", "@types/react", "@types/react-dom", @@ -1442,7 +1492,7 @@ "@radix-ui/react-label@2.1.4_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0": { "integrity": "sha512-wy3dqizZnZVV4ja0FNnUhIWNwWdoldXrneEyUcVtLYDAt8ovGS4ridtMAOGgXBBIfggL4BOveVWsjXDORdGEQg==", "dependencies": [ - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@types/react", "@types/react-dom", "react", @@ -1457,7 +1507,7 @@ "integrity": "sha512-+qYq6LfbiGo97Zz9fioX83HCiIYYFNs8zAsVCMQrIakoNYylIzWuoD/anAD3UzvvR6cnswmfRFJFq/zYYq/k7Q==", "dependencies": [ "@radix-ui/primitive", - "@radix-ui/react-collection", + "@radix-ui/react-collection@1.1.4_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-compose-refs", "@radix-ui/react-context", "@radix-ui/react-direction", @@ -1468,9 +1518,9 @@ "@radix-ui/react-popper", "@radix-ui/react-portal", "@radix-ui/react-presence", - "@radix-ui/react-primitive", - "@radix-ui/react-roving-focus", - "@radix-ui/react-slot", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", + "@radix-ui/react-roving-focus@1.1.7_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", + "@radix-ui/react-slot@1.2.0_@types+react@19.1.2_react@19.1.0", "@radix-ui/react-use-callback-ref", "@types/react", "@types/react-dom", @@ -1488,14 +1538,14 @@ "integrity": "sha512-bM2vT5nxRqJH/d1vFQ9jLsW4qR70yFQw2ZD1TUPWUNskDsV0eYeMbbNJqxNjGMOVogEkOJaHtu11kzYdTJvVJg==", "dependencies": [ "@radix-ui/primitive", - "@radix-ui/react-collection", + "@radix-ui/react-collection@1.1.4_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-compose-refs", "@radix-ui/react-context", "@radix-ui/react-direction", "@radix-ui/react-id", "@radix-ui/react-menu", - "@radix-ui/react-primitive", - "@radix-ui/react-roving-focus", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", + "@radix-ui/react-roving-focus@1.1.7_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-use-controllable-state", "@types/react", "@types/react-dom", @@ -1520,8 +1570,8 @@ "@radix-ui/react-popper", "@radix-ui/react-portal", "@radix-ui/react-presence", - "@radix-ui/react-primitive", - "@radix-ui/react-slot", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", + "@radix-ui/react-slot@1.2.0_@types+react@19.1.2_react@19.1.0", "@radix-ui/react-use-controllable-state", "@types/react", "@types/react-dom", @@ -1542,7 +1592,7 @@ "@radix-ui/react-arrow", "@radix-ui/react-compose-refs", "@radix-ui/react-context", - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-use-callback-ref", "@radix-ui/react-use-layout-effect", "@radix-ui/react-use-rect", @@ -1561,7 +1611,7 @@ "@radix-ui/react-portal@1.1.6_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0": { "integrity": "sha512-XmsIl2z1n/TsYFLIdYam2rmFwf9OC/Sh2avkbmVMDuBZIe7hSpM0cYnWPAo7nHOVx8zTuwDZGByfcqLdnzp3Vw==", "dependencies": [ - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-use-layout-effect", "@types/react", "@types/react-dom", @@ -1591,7 +1641,43 @@ "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0": { "integrity": "sha512-/J/FhLdK0zVcILOwt5g+dH4KnkonCtkVJsa2G6JmvbbtZfBEI1gMsO3QMjseL4F/SwfAMt1Vc/0XKYKq+xJ1sw==", "dependencies": [ - "@radix-ui/react-slot", + "@radix-ui/react-slot@1.2.0_@types+react@19.1.2_react@19.1.0", + "@types/react", + "@types/react-dom", + "react", + "react-dom" + ], + "optionalPeers": [ + "@types/react", + "@types/react-dom" + ] + }, + "@radix-ui/react-primitive@2.1.3_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0": { + "integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==", + "dependencies": [ + "@radix-ui/react-slot@1.2.3_@types+react@19.1.2_react@19.1.0", + "@types/react", + "@types/react-dom", + "react", + "react-dom" + ], + "optionalPeers": [ + "@types/react", + "@types/react-dom" + ] + }, + "@radix-ui/react-roving-focus@1.1.10_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0": { + "integrity": "sha512-dT9aOXUen9JSsxnMPv/0VqySQf5eDQ6LCk5Sw28kamz8wSOW2bJdlX2Bg5VUIIcV+6XlHpWTIuTPCf/UNIyq8Q==", + "dependencies": [ + "@radix-ui/primitive", + "@radix-ui/react-collection@1.1.7_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", + "@radix-ui/react-compose-refs", + "@radix-ui/react-context", + "@radix-ui/react-direction", + "@radix-ui/react-id", + "@radix-ui/react-primitive@2.1.3_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", + "@radix-ui/react-use-callback-ref", + "@radix-ui/react-use-controllable-state", "@types/react", "@types/react-dom", "react", @@ -1606,12 +1692,12 @@ "integrity": "sha512-C6oAg451/fQT3EGbWHbCQjYTtbyjNO1uzQgMzwyivcHT3GKNEmu1q3UuREhN+HzHAVtv3ivMVK08QlC+PkYw9Q==", "dependencies": [ "@radix-ui/primitive", - "@radix-ui/react-collection", + "@radix-ui/react-collection@1.1.4_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-compose-refs", "@radix-ui/react-context", "@radix-ui/react-direction", "@radix-ui/react-id", - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-use-callback-ref", "@radix-ui/react-use-controllable-state", "@types/react", @@ -1633,7 +1719,7 @@ "@radix-ui/react-context", "@radix-ui/react-direction", "@radix-ui/react-presence", - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-use-callback-ref", "@radix-ui/react-use-layout-effect", "@types/react", @@ -1651,7 +1737,7 @@ "dependencies": [ "@radix-ui/number", "@radix-ui/primitive", - "@radix-ui/react-collection", + "@radix-ui/react-collection@1.1.4_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-compose-refs", "@radix-ui/react-context", "@radix-ui/react-direction", @@ -1661,8 +1747,8 @@ "@radix-ui/react-id", "@radix-ui/react-popper", "@radix-ui/react-portal", - "@radix-ui/react-primitive", - "@radix-ui/react-slot", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", + "@radix-ui/react-slot@1.2.0_@types+react@19.1.2_react@19.1.0", "@radix-ui/react-use-callback-ref", "@radix-ui/react-use-controllable-state", "@radix-ui/react-use-layout-effect", @@ -1683,7 +1769,7 @@ "@radix-ui/react-separator@1.1.4_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0": { "integrity": "sha512-2fTm6PSiUm8YPq9W0E4reYuv01EE3aFSzt8edBiXqPHshF8N9+Kymt/k0/R+F3dkY5lQyB/zPtrP82phskLi7w==", "dependencies": [ - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@types/react", "@types/react-dom", "react", @@ -1699,11 +1785,11 @@ "dependencies": [ "@radix-ui/number", "@radix-ui/primitive", - "@radix-ui/react-collection", + "@radix-ui/react-collection@1.1.4_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-compose-refs", "@radix-ui/react-context", "@radix-ui/react-direction", - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-use-controllable-state", "@radix-ui/react-use-layout-effect", "@radix-ui/react-use-previous", @@ -1729,13 +1815,24 @@ "@types/react" ] }, + "@radix-ui/react-slot@1.2.3_@types+react@19.1.2_react@19.1.0": { + "integrity": "sha512-aeNmHnBxbi2St0au6VBVC7JXFlhLlOnvIIlePNniyUNAClzmtAUEY8/pBiK3iHjufOlwA+c20/8jngo7xcrg8A==", + "dependencies": [ + "@radix-ui/react-compose-refs", + "@types/react", + "react" + ], + "optionalPeers": [ + "@types/react" + ] + }, "@radix-ui/react-switch@1.2.2_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0": { "integrity": "sha512-7Z8n6L+ifMIIYZ83f28qWSceUpkXuslI2FJ34+kDMTiyj91ENdpdQ7VCidrzj5JfwfZTeano/BnGBbu/jqa5rQ==", "dependencies": [ "@radix-ui/primitive", "@radix-ui/react-compose-refs", "@radix-ui/react-context", - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-use-controllable-state", "@radix-ui/react-use-previous", "@radix-ui/react-use-size", @@ -1757,8 +1854,8 @@ "@radix-ui/react-direction", "@radix-ui/react-id", "@radix-ui/react-presence", - "@radix-ui/react-primitive", - "@radix-ui/react-roving-focus", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", + "@radix-ui/react-roving-focus@1.1.7_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-use-controllable-state", "@types/react", "@types/react-dom", @@ -1774,13 +1871,13 @@ "integrity": "sha512-Ed2mlOmT+tktOsu2NZBK1bCSHh/uqULu1vWOkpQTVq53EoOuZUZw7FInQoDB3uil5wZc2oe0XN9a7uVZB7/6AQ==", "dependencies": [ "@radix-ui/primitive", - "@radix-ui/react-collection", + "@radix-ui/react-collection@1.1.4_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-compose-refs", "@radix-ui/react-context", "@radix-ui/react-dismissable-layer", "@radix-ui/react-portal", "@radix-ui/react-presence", - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@radix-ui/react-use-callback-ref", "@radix-ui/react-use-controllable-state", "@radix-ui/react-use-layout-effect", @@ -1795,6 +1892,42 @@ "@types/react-dom" ] }, + "@radix-ui/react-toggle-group@1.1.10_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0": { + "integrity": "sha512-kiU694Km3WFLTC75DdqgM/3Jauf3rD9wxeS9XtyWFKsBUeZA337lC+6uUazT7I1DhanZ5gyD5Stf8uf2dbQxOQ==", + "dependencies": [ + "@radix-ui/primitive", + "@radix-ui/react-context", + "@radix-ui/react-direction", + "@radix-ui/react-primitive@2.1.3_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", + "@radix-ui/react-roving-focus@1.1.10_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", + "@radix-ui/react-toggle", + "@radix-ui/react-use-controllable-state", + "@types/react", + "@types/react-dom", + "react", + "react-dom" + ], + "optionalPeers": [ + "@types/react", + "@types/react-dom" + ] + }, + "@radix-ui/react-toggle@1.1.9_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0": { + "integrity": "sha512-ZoFkBBz9zv9GWer7wIjvdRxmh2wyc2oKWw6C6CseWd6/yq1DK/l5lJ+wnsmFwJZbBYqr02mrf8A2q/CVCuM3ZA==", + "dependencies": [ + "@radix-ui/primitive", + "@radix-ui/react-primitive@2.1.3_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", + "@radix-ui/react-use-controllable-state", + "@types/react", + "@types/react-dom", + "react", + "react-dom" + ], + "optionalPeers": [ + "@types/react", + "@types/react-dom" + ] + }, "@radix-ui/react-tooltip@1.2.4_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0": { "integrity": "sha512-DyW8VVeeMSSLFvAmnVnCwvI3H+1tpJFHT50r+tdOoMse9XqYDBCcyux8u3G2y+LOpt7fPQ6KKH0mhs+ce1+Z5w==", "dependencies": [ @@ -1806,8 +1939,8 @@ "@radix-ui/react-popper", "@radix-ui/react-portal", "@radix-ui/react-presence", - "@radix-ui/react-primitive", - "@radix-ui/react-slot", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", + "@radix-ui/react-slot@1.2.0_@types+react@19.1.2_react@19.1.0", "@radix-ui/react-use-controllable-state", "@radix-ui/react-visually-hidden", "@types/react", @@ -1909,7 +2042,7 @@ "@radix-ui/react-visually-hidden@1.2.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0": { "integrity": "sha512-rQj0aAWOpCdCMRbI6pLQm8r7S2BM3YhTa0SzOYD55k+hJA8oo9J+H+9wLM9oMlZWOX/wJWPTzfDfmZkf7LvCfg==", "dependencies": [ - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "@types/react", "@types/react-dom", "react", @@ -3838,6 +3971,9 @@ "ansi-styles@5.2.0": { "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==" }, + "argparse@2.0.1": { + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, "aria-hidden@1.2.4": { "integrity": "sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A==", "dependencies": [ @@ -3979,6 +4115,12 @@ "balanced-match" ] }, + "braces@3.0.3": { + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dependencies": [ + "fill-range" + ] + }, "brorand@1.1.0": { "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" }, @@ -4071,6 +4213,13 @@ "builtin-status-codes@3.0.0": { "integrity": "sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ==" }, + "bundle-require@5.1.0_esbuild@0.25.3": { + "integrity": "sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==", + "dependencies": [ + "esbuild", + "load-tsconfig" + ] + }, "bytewise-core@1.2.3": { "integrity": "sha512-nZD//kc78OOxeYtRlVk8/zXqTB4gf/nlguL1ggWA8FuchMyOxcyHR4QPQZMUmA7czC+YnaBrPUCubqAWe50DaA==", "dependencies": [ @@ -4173,7 +4322,7 @@ "@radix-ui/react-compose-refs", "@radix-ui/react-dialog", "@radix-ui/react-id", - "@radix-ui/react-primitive", + "@radix-ui/react-primitive@2.1.0_@types+react@19.1.2_@types+react-dom@19.1.3__@types+react@19.1.2_react@19.1.0_react-dom@19.1.0__react@19.1.0", "react", "react-dom" ] @@ -4217,6 +4366,9 @@ "convert-source-map@2.0.0": { "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" }, + "cookie@1.0.2": { + "integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==" + }, "core-js-compat@3.42.0": { "integrity": "sha512-bQasjMfyDGyaeWKBIu33lHh9qlSR0MFE/Nmc6nMjf/iU9b3rSMdAYz1Baxrv4lPdGUsTqZudHA4jIGSJy0SWZQ==", "dependencies": [ @@ -4260,6 +4412,12 @@ "create-require@1.1.1": { "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==" }, + "cross-fetch@4.0.0": { + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", + "dependencies": [ + "node-fetch" + ] + }, "crypto-browserify@3.12.1": { "integrity": "sha512-r4ESw/IlusD17lgQi1O20Fa3qNnsckR126TdUuBgAu7GBYSIPvdNyONd3Zrxh0xCwA4+6w/TDArBPsMvhur+KQ==", "dependencies": [ @@ -4337,6 +4495,9 @@ "deep-eql@5.0.2": { "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==" }, + "deep-object-diff@1.1.9": { + "integrity": "sha512-Rn+RuwkmkDwCi2/oXOFS9Gsr5lJZu/yTGpK7wAaAIE75CC+LCGEZHpY6VQJa/RoJcrmaA/docWJZvYohlNkWPA==" + }, "deepmerge@4.3.1": { "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==" }, @@ -4617,12 +4778,28 @@ "fast-deep-equal@3.1.3": { "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, + "fast-glob@3.3.3": { + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dependencies": [ + "@nodelib/fs.stat", + "@nodelib/fs.walk", + "glob-parent", + "merge2", + "micromatch" + ] + }, "fast-json-stable-stringify@2.1.0": { "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, "fast-uri@3.0.6": { "integrity": "sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw==" }, + "fastq@1.19.1": { + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dependencies": [ + "reusify" + ] + }, "fdir@6.4.4_picomatch@4.0.2": { "integrity": "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg==", "dependencies": [ @@ -4638,11 +4815,25 @@ "minimatch@5.1.6" ] }, + "fill-range@7.1.1": { + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dependencies": [ + "to-regex-range" + ] + }, "find-up@5.0.0": { "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dependencies": [ - "locate-path", - "path-exists" + "locate-path@6.0.0", + "path-exists@4.0.0" + ] + }, + "find-up@7.0.0": { + "integrity": "sha512-YyZM99iHrqLKjmt4LJDj58KI+fYyufRLBSYcqycxf//KpBk9FoewoGX0450m9nB44qrZnovzC2oeP5hUibxc/g==", + "dependencies": [ + "locate-path@7.2.0", + "path-exists@5.0.0", + "unicorn-magic" ] }, "for-each@0.3.5": { @@ -4745,12 +4936,24 @@ "get-intrinsic" ] }, + "get-tsconfig@4.10.1": { + "integrity": "sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==", + "dependencies": [ + "resolve-pkg-maps" + ] + }, "get-value@2.0.6": { "integrity": "sha512-Ln0UQDlxH1BapMu3GPtf7CuYNwRZf2gwCuPqbyG6pB8WfmFpzqcy4xtAaAMUhnNqjMKTiCPZG2oMT3YSx8U2NA==" }, "gl-matrix@3.4.3": { "integrity": "sha512-wcCp8vu8FT22BnvKVPjXa/ICBWRq/zjFfdofZy1WSpQZpphblv12/bOQLBC1rMM7SGOFS9ltVmKOHil5+Ml7gA==" }, + "glob-parent@5.1.2": { + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": [ + "is-glob" + ] + }, "glob@7.2.3": { "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dependencies": [ @@ -4858,9 +5061,37 @@ "minimalistic-crypto-utils" ] }, + "html-parse-stringify@3.0.1": { + "integrity": "sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==", + "dependencies": [ + "void-elements" + ] + }, "https-browserify@1.0.0": { "integrity": "sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg==" }, + "i18next-browser-languagedetector@8.1.0": { + "integrity": "sha512-mHZxNx1Lq09xt5kCauZ/4bsXOEA2pfpwSoU11/QTJB+pD94iONFwp+ohqi///PwiFvjFOxe1akYCdHyFo1ng5Q==", + "dependencies": [ + "@babel/runtime" + ] + }, + "i18next-http-backend@3.0.2": { + "integrity": "sha512-PdlvPnvIp4E1sYi46Ik4tBYh/v/NbYfFFgTjkwFl0is8A18s7/bx9aXqsrOax9WUbeNS6mD2oix7Z0yGGf6m5g==", + "dependencies": [ + "cross-fetch" + ] + }, + "i18next@25.2.0_typescript@5.8.3": { + "integrity": "sha512-ERhJICsxkw1vE7G0lhCUYv4ZxdBEs03qblt1myJs94rYRK9loJF3xDj8mgQz3LmCyp0yYrNjbN/1/GWZTZDGCA==", + "dependencies": [ + "@babel/runtime", + "typescript" + ], + "optionalPeers": [ + "typescript" + ] + }, "idb-keyval@6.2.1": { "integrity": "sha512-8Sb3veuYCyrZL+VBt9LJfZjLUPWVvqn8tG28VqYNFCo43KHcKuq+b4EiXGeuaLAQWL2YmyDgMp2aSpH9JHsEQg==" }, @@ -4873,6 +5104,17 @@ "immer@10.1.1": { "integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==" }, + "importx@0.5.2_esbuild@0.25.3": { + "integrity": "sha512-YEwlK86Ml5WiTxN/ECUYC5U7jd1CisAVw7ya4i9ZppBoHfFkT2+hChhr3PE2fYxUKLkNyivxEQpa5Ruil1LJBQ==", + "dependencies": [ + "bundle-require", + "debug", + "esbuild", + "jiti", + "pathe", + "tsx" + ] + }, "indent-string@4.0.0": { "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==" }, @@ -4969,6 +5211,9 @@ "is-plain-object" ] }, + "is-extglob@2.1.1": { + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==" + }, "is-finalizationregistry@1.1.1": { "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", "dependencies": [ @@ -4984,6 +5229,12 @@ "safe-regex-test" ] }, + "is-glob@4.0.3": { + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": [ + "is-extglob" + ] + }, "is-map@2.0.3": { "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==" }, @@ -5004,6 +5255,9 @@ "has-tostringtag" ] }, + "is-number@7.0.0": { + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, "is-obj@1.0.1": { "integrity": "sha512-l4RyHgRqGN4Y3+9JHVrNqO+tN0rV5My76uW5/nuO4K1b6vw5G8d/cmFjP9tRfEsdhZNt0IFdZuK/c2Vr4Nb+Qg==" }, @@ -5112,6 +5366,13 @@ "js-tokens@4.0.0": { "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" }, + "js-yaml@4.1.0": { + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": [ + "argparse" + ], + "bin": true + }, "jsesc@3.0.2": { "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==", "bin": true @@ -5157,6 +5418,15 @@ "kind-of@6.0.3": { "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" }, + "language-subtag-registry@0.3.23": { + "integrity": "sha512-0K65Lea881pHotoGEa5gDlMxt3pctLi2RplBb7Ezh4rRdLEOtgi7n4EwK9lamnUCkKBqaeKRVebTq6BAxSkpXQ==" + }, + "language-tags@2.1.0": { + "integrity": "sha512-D4CgpyCt+61f6z2jHjJS1OmZPviAWM57iJ9OKdFFWSNgS7Udj9QVWqyGs/cveVNF57XpZmhSvMdVIV5mjLA7Vg==", + "dependencies": [ + "language-subtag-registry" + ] + }, "leven@3.1.0": { "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==" }, @@ -5231,10 +5501,19 @@ "lightningcss-win32-x64-msvc" ] }, + "load-tsconfig@0.2.5": { + "integrity": "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==" + }, "locate-path@6.0.0": { "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dependencies": [ - "p-locate" + "p-locate@5.0.0" + ] + }, + "locate-path@7.2.0": { + "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", + "dependencies": [ + "p-locate@6.0.0" ] }, "lodash.debounce@4.0.8": { @@ -5326,6 +5605,16 @@ "safe-buffer@5.2.1" ] }, + "merge2@1.4.1": { + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" + }, + "micromatch@4.0.8": { + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dependencies": [ + "braces", + "picomatch@2.3.1" + ] + }, "miller-rabin@4.0.1": { "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", "dependencies": [ @@ -5381,6 +5670,15 @@ "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", "bin": true }, + "negotiator@1.0.0": { + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==" + }, + "node-fetch@2.7.0": { + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": [ + "whatwg-url@5.0.0" + ] + }, "node-releases@2.0.19": { "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==" }, @@ -5463,13 +5761,25 @@ "p-limit@3.1.0": { "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dependencies": [ - "yocto-queue" + "yocto-queue@0.1.0" + ] + }, + "p-limit@4.0.0": { + "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", + "dependencies": [ + "yocto-queue@1.2.1" ] }, "p-locate@5.0.0": { "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dependencies": [ - "p-limit" + "p-limit@3.1.0" + ] + }, + "p-locate@6.0.0": { + "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", + "dependencies": [ + "p-limit@4.0.0" ] }, "pako@1.0.11": { @@ -5492,6 +5802,9 @@ "path-exists@4.0.0": { "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" }, + "path-exists@5.0.0": { + "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==" + }, "path-is-absolute@1.0.1": { "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" }, @@ -5542,7 +5855,7 @@ "pkg-dir@5.0.0": { "integrity": "sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==", "dependencies": [ - "find-up" + "find-up@5.0.0" ] }, "point-in-polygon-hao@1.2.4": { @@ -5636,6 +5949,9 @@ "querystring-es3@0.2.1": { "integrity": "sha512-773xhDQnZBMFobEiztv8LIl70ch5MSF/jUQVlhwFyBILqq96anmoctVIYz+ZRp0qbCKATTn6ev02M3r7Ga5vqA==" }, + "queue-microtask@1.2.3": { + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, "quickselect@1.1.1": { "integrity": "sha512-qN0Gqdw4c4KGPsBOQafj6yj/PA6c/L63f6CaZ/DCF/xF4Esu3jVmKLUDYxghFx8Kb/O7y9tI7x2RjTSXwdK1iQ==" }, @@ -5690,6 +6006,19 @@ "react" ] }, + "react-i18next@15.5.1_i18next@25.2.0__typescript@5.8.3_react@19.1.0_typescript@5.8.3": { + "integrity": "sha512-C8RZ7N7H0L+flitiX6ASjq9p5puVJU1Z8VyL3OgM/QOMRf40BMZX+5TkpxzZVcTmOLPX5zlti4InEX5pFyiVeA==", + "dependencies": [ + "@babel/runtime", + "html-parse-stringify", + "i18next", + "react", + "typescript" + ], + "optionalPeers": [ + "typescript" + ] + }, "react-is@17.0.2": { "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" }, @@ -5844,6 +6173,9 @@ "require-from-string@2.0.2": { "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" }, + "resolve-pkg-maps@1.0.0": { + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==" + }, "resolve-protobuf-schema@2.1.0": { "integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==", "dependencies": [ @@ -5859,6 +6191,9 @@ ], "bin": true }, + "reusify@1.1.0": { + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==" + }, "rfc4648@1.5.4": { "integrity": "sha512-rRg/6Lb+IGfJqO05HZkN50UtY7K/JhxJag1kP23+zyMfrvoB0B7RWv06MbOzoc79RgCdNTiUaNsTT1AJZ7Z+cg==" }, @@ -5912,6 +6247,12 @@ ], "bin": true }, + "run-parallel@1.2.0": { + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dependencies": [ + "queue-microtask" + ] + }, "rw@1.3.3": { "integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==" }, @@ -6105,7 +6446,7 @@ "source-map@0.8.0-beta.0": { "integrity": "sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==", "dependencies": [ - "whatwg-url" + "whatwg-url@7.1.0" ] }, "sourcemap-codec@1.4.8": { @@ -6355,6 +6696,12 @@ "tinyspy@3.0.2": { "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==" }, + "to-regex-range@5.0.1": { + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": [ + "is-number" + ] + }, "topojson-client@3.1.0": { "integrity": "sha512-605uxS6bcYxGXw9qi62XyrV6Q3xwbndjachmNxu8HWTtVPxZfEJN9fd/SZS1Q54Sn2y0TMyMxFj/cJINqGHrKw==", "dependencies": [ @@ -6369,6 +6716,9 @@ ], "bin": true }, + "tr46@0.0.3": { + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "tr46@1.0.1": { "integrity": "sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==", "dependencies": [ @@ -6384,6 +6734,17 @@ "tslog@4.9.3": { "integrity": "sha512-oDWuGVONxhVEBtschLf2cs/Jy8i7h1T+CpdkTNWQgdAF7DhRo2G8vMCgILKe7ojdEkLhICWgI1LYSSKaJsRgcw==" }, + "tsx@4.19.4": { + "integrity": "sha512-gK5GVzDkJK1SI1zwHf32Mqxf2tSJkNx+eYcNly5+nHvWqXUJYUkWBQtKauoESz3ymezAI++ZwT855x5p5eop+Q==", + "dependencies": [ + "esbuild", + "get-tsconfig" + ], + "optionalDependencies": [ + "fsevents" + ], + "bin": true + }, "tty-browserify@0.0.1": { "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==" }, @@ -6475,6 +6836,9 @@ "unicode-property-aliases-ecmascript@2.1.0": { "integrity": "sha512-6t3foTQI9qne+OZoVQB/8x8rk2k1eVy1gRXhV3oFQ5T6R1dqQ1xtin3XqSlx3+ATBkliTaR/hHyJBm+LVPNM8w==" }, + "unicorn-magic@0.1.0": { + "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==" + }, "union-value@1.0.1": { "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", "dependencies": [ @@ -6562,6 +6926,23 @@ ], "bin": true }, + "vite-plugin-i18n-ally@6.0.1_vite@6.3.4__@types+node@22.15.3__picomatch@4.0.2_@types+node@22.15.3": { + "integrity": "sha512-BmXlAkrmSRrbaho7iJpBf1d2EPyDK2oqY1AKVxkJEUikGDPducFpLfpmlqTyUNhsWZT01ZLWdjR2uIRnnVJXzw==", + "dependencies": [ + "cookie", + "debug", + "deep-object-diff", + "fast-glob", + "find-up@7.0.0", + "importx", + "js-yaml", + "json5", + "language-tags", + "negotiator", + "picocolors", + "vite" + ] + }, "vite-plugin-node-polyfills@0.23.0_vite@6.3.4__@types+node@22.15.3__picomatch@4.0.2_@types+node@22.15.3": { "integrity": "sha512-4n+Ys+2bKHQohPBKigFlndwWQ5fFKwaGY6muNDMTb0fSQLyBzS+jjUNRZG9sKF0S/Go4ApG6LFnUGopjkILg3w==", "dependencies": [ @@ -6636,6 +7017,9 @@ "vm-browserify@1.1.2": { "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==" }, + "void-elements@3.1.0": { + "integrity": "sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==" + }, "vt-pbf@3.1.3": { "integrity": "sha512-2LzDFzt0mZKZ9IpVF2r69G9bXaP2Q2sArJCmcCgvfTdCCZzSyz4aCLoQyUilu37Ll56tCblIZrXFIjNUpGIlmA==", "dependencies": [ @@ -6644,6 +7028,9 @@ "pbf" ] }, + "webidl-conversions@3.0.1": { + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, "webidl-conversions@4.0.2": { "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" }, @@ -6653,11 +7040,18 @@ "whatwg-mimetype@3.0.0": { "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==" }, + "whatwg-url@5.0.0": { + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": [ + "tr46@0.0.3", + "webidl-conversions@3.0.1" + ] + }, "whatwg-url@7.1.0": { "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", "dependencies": [ "lodash.sortby", - "tr46", + "tr46@1.0.1", "webidl-conversions@4.0.2" ] }, @@ -6880,6 +7274,9 @@ "yocto-queue@0.1.0": { "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" }, + "yocto-queue@1.2.1": { + "integrity": "sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg==" + }, "zod@3.24.3": { "integrity": "sha512-HhY1oqzWCQWuUqvBFnsyrtZRhyPeR7SUGv+C4+MsisMuVfSPx8HpwWqH8tRahSlt6M3PiFAcoeFhZAqIXTxoSg==" }, @@ -6901,6 +7298,9 @@ } }, "workspace": { + "dependencies": [ + "jsr:@std/path@^1.1.0" + ], "packageJson": { "dependencies": [ "npm:@bufbuild/protobuf@^2.2.5", @@ -6924,6 +7324,7 @@ "npm:@radix-ui/react-switch@^1.2.2", "npm:@radix-ui/react-tabs@^1.1.9", "npm:@radix-ui/react-toast@^1.2.11", + "npm:@radix-ui/react-toggle-group@^1.1.9", "npm:@radix-ui/react-tooltip@^1.2.4", "npm:@tailwindcss/postcss@^4.1.5", "npm:@testing-library/jest-dom@^6.6.3", @@ -6948,6 +7349,9 @@ "npm:crypto-random-string@5", "npm:gzipper@^8.2.1", "npm:happy-dom@^17.4.6", + "npm:i18next-browser-languagedetector@^8.1.0", + "npm:i18next-http-backend@^3.0.2", + "npm:i18next@^25.2.0", "npm:idb-keyval@^6.2.1", "npm:immer@^10.1.1", "npm:js-cookie@^3.0.5", @@ -6957,6 +7361,7 @@ "npm:react-dom@^19.1.0", "npm:react-error-boundary@6", "npm:react-hook-form@^7.56.2", + "npm:react-i18next@^15.5.1", "npm:react-map-gl@8.0.4", "npm:react-qrcode-logo@3", "npm:react@^19.1.0", @@ -6968,6 +7373,7 @@ "npm:tar@^7.4.3", "npm:testing-library@^0.0.2", "npm:typescript@^5.8.3", + "npm:vite-plugin-i18n-ally@^6.0.1", "npm:vite-plugin-node-polyfills@0.23", "npm:vite-plugin-pwa@1", "npm:vite@^6.3.4", diff --git a/package.json b/package.json index ccaa07a0..15393e75 100644 --- a/package.json +++ b/package.json @@ -34,12 +34,12 @@ }, "homepage": "https://meshtastic.org", "dependencies": { + "@bufbuild/protobuf": "^2.2.5", "@meshtastic/core": "npm:@jsr/meshtastic__core@2.6.2", "@meshtastic/js": "npm:@jsr/meshtastic__js@2.6.0-0", "@meshtastic/transport-http": "npm:@jsr/meshtastic__transport-http", "@meshtastic/transport-web-bluetooth": "npm:@jsr/meshtastic__transport-web-bluetooth", "@meshtastic/transport-web-serial": "npm:@jsr/meshtastic__transport-web-serial", - "@bufbuild/protobuf": "^2.2.5", "@noble/curves": "^1.9.0", "@radix-ui/react-accordion": "^1.2.8", "@radix-ui/react-checkbox": "^1.2.3", @@ -64,6 +64,9 @@ "clsx": "^2.1.1", "cmdk": "^1.1.1", "crypto-random-string": "^5.0.0", + "i18next": "^25.2.0", + "i18next-browser-languagedetector": "^8.1.0", + "i18next-http-backend": "^3.0.2", "idb-keyval": "^6.2.1", "immer": "^10.1.1", "js-cookie": "^3.0.5", @@ -73,9 +76,11 @@ "react-dom": "^19.1.0", "react-error-boundary": "^6.0.0", "react-hook-form": "^7.56.2", + "react-i18next": "^15.5.1", "react-map-gl": "8.0.4", "react-qrcode-logo": "^3.0.0", "rfc4648": "^1.5.4", + "vite-plugin-i18n-ally": "^6.0.1", "vite-plugin-node-polyfills": "^0.23.0", "zod": "^3.24.3", "zustand": "5.0.4" @@ -106,7 +111,7 @@ "testing-library": "^0.0.2", "typescript": "^5.8.3", "vite": "^6.3.4", - "vitest": "^3.1.2", - "vite-plugin-pwa": "^1.0.0" + "vite-plugin-pwa": "^1.0.0", + "vitest": "^3.1.2" } } diff --git a/src/components/BatteryStatus.tsx b/src/components/BatteryStatus.tsx index c615feff..c80bb87e 100644 --- a/src/components/BatteryStatus.tsx +++ b/src/components/BatteryStatus.tsx @@ -5,16 +5,8 @@ import { BatteryMediumIcon, PlugZapIcon, } from "lucide-react"; -import { Subtle } from "@components/UI/Typography/Subtle.tsx"; - -interface DeviceMetrics { - batteryLevel?: number | null; - voltage?: number | null; -} - -interface BatteryStatusProps { - deviceMetrics?: DeviceMetrics | null; -} +import { useTranslation } from "react-i18next"; +import { DeviceMetrics } from "./types.ts"; interface BatteryStateConfig { condition: (level: number) => boolean; @@ -23,34 +15,45 @@ interface BatteryStateConfig { text: (level: number) => string; } -const batteryStates: BatteryStateConfig[] = [ - { - condition: (level) => level > 100, - Icon: PlugZapIcon, - className: "text-gray-500", - text: () => "Plugged in", - }, - { - condition: (level) => level > 80, - Icon: BatteryFullIcon, - className: "text-green-500", - text: (level) => `${level}% charging`, - }, - { - condition: (level) => level > 20, - Icon: BatteryMediumIcon, - className: "text-yellow-500", - text: (level) => `${level}% charging`, - }, - { - condition: () => true, - Icon: BatteryLowIcon, - className: "text-red-500", - text: (level) => `${level}% charging`, - }, -]; +interface BatteryStatusProps { + deviceMetrics?: DeviceMetrics | null; +} + +const getBatteryStates = ( + t: (key: string, options?: object) => string, +): BatteryStateConfig[] => { + return [ + { + condition: (level) => level > 100, + Icon: PlugZapIcon, + className: "text-gray-500", + text: () => t("batteryStatus.pluggedIn"), + }, + { + condition: (level) => level > 80, + Icon: BatteryFullIcon, + className: "text-green-500", + text: (level) => t("batteryStatus.charging", { level }), + }, + { + condition: (level) => level > 20, + Icon: BatteryMediumIcon, + className: "text-yellow-500", + text: (level) => t("batteryStatus.charging", { level }), + }, + { + condition: () => true, + Icon: BatteryLowIcon, + className: "text-red-500", + text: (level) => t("batteryStatus.charging", { level }), + }, + ]; +}; -const getBatteryState = (level: number) => { +const getBatteryState = ( + level: number, + batteryStates: BatteryStateConfig[], +) => { return batteryStates.find((state) => state.condition(level)); }; @@ -62,25 +65,24 @@ const BatteryStatus: React.FC = ({ deviceMetrics }) => { return null; } - const { batteryLevel, voltage } = deviceMetrics; - const currentState = getBatteryState(batteryLevel) ?? + const { t } = useTranslation(); + const batteryStates = getBatteryStates(t); + + const { batteryLevel } = deviceMetrics; + const currentState = getBatteryState(batteryLevel, batteryStates) ?? batteryStates[batteryStates.length - 1]; const BatteryIcon = currentState.Icon; const iconClassName = currentState.className; const statusText = currentState.text(batteryLevel); - const voltageTitle = `${voltage?.toPrecision(3) ?? "Unknown"} volts`; - return (
- - {statusText} - + {statusText}
); }; diff --git a/src/components/CommandPalette/index.tsx b/src/components/CommandPalette/index.tsx index 9e44fde5..c8cb4140 100644 --- a/src/components/CommandPalette/index.tsx +++ b/src/components/CommandPalette/index.tsx @@ -33,9 +33,11 @@ import { import { useEffect } from "react"; import { Avatar } from "@components/UI/Avatar.tsx"; import { cn } from "@core/utils/cn.ts"; +import { useTranslation } from "react-i18next"; import { usePinnedItems } from "@core/hooks/usePinnedItems.ts"; export interface Group { + id: string; label: string; icon: LucideIcon; commands: Command[]; @@ -65,28 +67,30 @@ export const CommandPalette = () => { const { pinnedItems, togglePinnedItem } = usePinnedItems({ storageName: "pinnedCommandMenuGroups", }); + const { t } = useTranslation("commandPalette"); const groups: Group[] = [ { - label: "Goto", + id: "gotoGroup", + label: t("goto.label"), icon: LinkIcon, commands: [ { - label: "Messages", + label: t("goto.command.messages"), icon: MessageSquareIcon, action() { setActivePage("messages"); }, }, { - label: "Map", + label: t("goto.command.map"), icon: MapIcon, action() { setActivePage("map"); }, }, { - label: "Config", + label: t("goto.command.config"), icon: SettingsIcon, action() { setActivePage("config"); @@ -94,14 +98,14 @@ export const CommandPalette = () => { tags: ["settings"], }, { - label: "Channels", + label: t("goto.command.channels"), icon: LayersIcon, action() { setActivePage("channels"); }, }, { - label: "Nodes", + label: t("goto.command.nodes"), icon: UsersIcon, action() { setActivePage("nodes"); @@ -110,19 +114,20 @@ export const CommandPalette = () => { ], }, { - label: "Manage", + id: "manageGroup", + label: t("manage.label"), icon: SmartphoneIcon, commands: [ { - label: "Switch Node", + label: t("manage.command.switchNode"), icon: ArrowLeftRightIcon, subItems: getDevices().map((device) => ({ label: getNode(device.hardware.myNodeNum)?.user?.longName ?? - device.hardware.myNodeNum.toString(), + t("unknown.shortName"), icon: ( ), action() { @@ -131,7 +136,7 @@ export const CommandPalette = () => { })), }, { - label: "Connect New Node", + label: t("manage.command.connectNewNode"), icon: PlusIcon, action() { setConnectDialogOpen(true); @@ -140,22 +145,23 @@ export const CommandPalette = () => { ], }, { - label: "Contextual", + id: "contextualGroup", + label: t("contextual.label"), icon: BoxSelectIcon, commands: [ { - label: "QR Code", + label: t("contextual.command.qrCode"), icon: QrCodeIcon, subItems: [ { - label: "Generator", + label: t("contextual.command.qrGenerator"), icon: , action() { setDialogOpen("QR", true); }, }, { - label: "Import", + label: t("contextual.command.qrImport"), icon: , action() { setDialogOpen("import", true); @@ -164,42 +170,42 @@ export const CommandPalette = () => { ], }, { - label: "Schedule Shutdown", + label: t("contextual.command.scheduleShutdown"), icon: PowerIcon, action() { setDialogOpen("shutdown", true); }, }, { - label: "Schedule Reboot", + label: t("contextual.command.scheduleReboot"), icon: RefreshCwIcon, action() { setDialogOpen("reboot", true); }, }, { - label: "Reboot To OTA Mode", + label: t("contextual.command.rebootToOtaMode"), icon: RefreshCwIcon, action() { setDialogOpen("rebootOTA", true); }, }, { - label: "Reset Nodes", + label: t("contextual.command.resetNodeDb"), icon: TrashIcon, action() { connection?.resetNodes(); }, }, { - label: "Factory Reset Device", + label: t("contextual.command.factoryResetDevice"), icon: FactoryIcon, action() { connection?.factoryResetDevice(); }, }, { - label: "Factory Reset Config", + label: t("contextual.command.factoryResetConfig"), icon: FactoryIcon, action() { connection?.factoryResetConfig(); @@ -208,18 +214,19 @@ export const CommandPalette = () => { ], }, { - label: "Debug", + id: "debugGroup", + label: t("debug.label"), icon: BugIcon, commands: [ { - label: "Reconfigure", + label: t("debug.command.reconfigure"), icon: RefreshCwIcon, action() { void connection?.configure(); }, }, { - label: "Clear All Stored Message", + label: t("debug.command.clearAllStoredMessages"), icon: EraserIcon, action() { setDialogOpen("deleteMessages", true); @@ -230,8 +237,8 @@ export const CommandPalette = () => { ]; const sortedGroups = [...groups].sort((a, b) => { - const aPinned = pinnedItems.includes(a.label) ? 1 : 0; - const bPinned = pinnedItems.includes(b.label) ? 1 : 0; + const aPinned = pinnedItems.includes(a.id) ? 1 : 0; + const bPinned = pinnedItems.includes(b.id) ? 1 : 0; return bPinned - aPinned; }); @@ -252,9 +259,9 @@ export const CommandPalette = () => { open={commandPaletteOpen} onOpenChange={setCommandPaletteOpen} > - + - No results found. + {t("emptyState")} {sortedGroups.map((group) => ( { {group.label} + ); + })} + {/* {import.meta.env.COMMIT_HASH} */} + + + + ); +}; diff --git a/src/components/Dialog/DeleteMessagesDialog/DeleteMessagesDialog.tsx b/src/components/Dialog/DeleteMessagesDialog/DeleteMessagesDialog.tsx index 562a522e..78427da4 100644 --- a/src/components/Dialog/DeleteMessagesDialog/DeleteMessagesDialog.tsx +++ b/src/components/Dialog/DeleteMessagesDialog/DeleteMessagesDialog.tsx @@ -10,6 +10,7 @@ import { } from "@components/UI/Dialog.tsx"; import { AlertTriangleIcon } from "lucide-react"; import { useMessageStore } from "../../../core/stores/messageStore/index.ts"; +import { useTranslation } from "react-i18next"; export interface DeleteMessagesDialogProps { open: boolean; @@ -20,6 +21,7 @@ export const DeleteMessagesDialog = ({ open, onOpenChange, }: DeleteMessagesDialogProps) => { + const { t } = useTranslation("dialog"); const { deleteAllMessages } = useMessageStore(); const handleCloseDialog = () => { onOpenChange(false); @@ -32,19 +34,19 @@ export const DeleteMessagesDialog = ({ - Clear All Messages + {t("deleteMessages.title")} - This action will clear all message history. This cannot be undone. - Are you sure you want to continue? + {t("deleteMessages.description")} diff --git a/src/components/Dialog/DeviceNameDialog.tsx b/src/components/Dialog/DeviceNameDialog.tsx index 7fbe310d..6b4d5803 100644 --- a/src/components/Dialog/DeviceNameDialog.tsx +++ b/src/components/Dialog/DeviceNameDialog.tsx @@ -10,11 +10,12 @@ import { DialogHeader, DialogTitle, } from "@components/UI/Dialog.tsx"; -import { Label } from "@components/UI/Label.tsx"; import { Protobuf } from "@meshtastic/core"; import { useForm } from "react-hook-form"; import { GenericInput } from "@components/Form/FormInput.tsx"; +import { useTranslation } from "react-i18next"; import { validateMaxByteLength } from "@core/utils/string.ts"; +import { Label } from "../UI/Label.tsx"; export interface User { longName: string; @@ -32,12 +33,13 @@ export const DeviceNameDialog = ({ open, onOpenChange, }: DeviceNameDialogProps) => { + const { t } = useTranslation("dialog"); const { hardware, getNode, connection } = useDevice(); const myNode = getNode(hardware.myNodeNum); const defaultValues = { - longName: myNode?.user?.longName ?? "Unknown", - shortName: myNode?.user?.shortName ?? "??", + longName: myNode?.user?.longName ?? t("unknown.longName"), + shortName: myNode?.user?.shortName ?? t("unknown.shortName"), }; const { getValues, setValue, reset, control, handleSubmit } = useForm({ @@ -74,19 +76,21 @@ export const DeviceNameDialog = ({ - Change Device Name + {t("deviceName.title")} - The Device will restart once the config is saved. + {t("deviceName.description")}
- +
- + - - + diff --git a/src/components/Dialog/ImportDialog.tsx b/src/components/Dialog/ImportDialog.tsx index cb6a5389..ac76d022 100644 --- a/src/components/Dialog/ImportDialog.tsx +++ b/src/components/Dialog/ImportDialog.tsx @@ -17,6 +17,7 @@ import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; import { toByteArray } from "base64-js"; import { useEffect, useState } from "react"; +import { useTranslation } from "react-i18next"; export interface ImportDialogProps { open: boolean; @@ -28,6 +29,7 @@ export const ImportDialog = ({ open, onOpenChange, }: ImportDialogProps) => { + const { t } = useTranslation("dialog"); const [importDialogInput, setImportDialogInput] = useState(""); const [channelSet, setChannelSet] = useState(); const [validUrl, setValidUrl] = useState(false); @@ -44,7 +46,7 @@ export const ImportDialog = ({ channelsUrl.pathname !== "/e/") || !channelsUrl.hash ) { - throw "Invalid Meshtastic URL"; + throw t("import.error.invalidUrl"); } const encodedChannelConfig = channelsUrl.hash.substring(1); @@ -99,13 +101,13 @@ export const ImportDialog = ({ - Import Channel Set + {t("import.title")} - The current LoRa configuration will be overridden. + {t("import.description")}
- +
- + - Channels: + {t("import.channels")}
{channelSet?.settings.map((channel) => ( @@ -152,7 +154,7 @@ export const ImportDialog = ({
@@ -162,8 +164,8 @@ export const ImportDialog = ({ )}
- diff --git a/src/components/Dialog/LocationResponseDialog.tsx b/src/components/Dialog/LocationResponseDialog.tsx index a338e865..bd376de3 100644 --- a/src/components/Dialog/LocationResponseDialog.tsx +++ b/src/components/Dialog/LocationResponseDialog.tsx @@ -1,4 +1,4 @@ -import { useDevice } from "../../core/stores/deviceStore.ts"; +import { useDevice } from "@core/stores/deviceStore.ts"; import { Dialog, DialogClose, @@ -9,6 +9,7 @@ import { } from "../UI/Dialog.tsx"; import type { Protobuf, Types } from "@meshtastic/core"; import { numberToHexUnpadded } from "@noble/curves/abstract/utils"; +import { useTranslation } from "react-i18next"; export interface LocationResponseDialogProps { location: Types.PacketMetadata | undefined; @@ -21,26 +22,33 @@ export const LocationResponseDialog = ({ open, onOpenChange, }: LocationResponseDialogProps) => { + const { t } = useTranslation("dialog"); const { getNode } = useDevice(); const from = getNode(location?.from ?? 0); const longName = from?.user?.longName ?? - (from ? `!${numberToHexUnpadded(from?.num)}` : "Unknown"); + (from ? `!${numberToHexUnpadded(from?.num)}` : t("unknown.shortName")); const shortName = from?.user?.shortName ?? - (from ? `${numberToHexUnpadded(from?.num).substring(0, 4)}` : "UNK"); + (from + ? `${numberToHexUnpadded(from?.num).substring(0, 4)}` + : t("unknown.shortName")); return ( - {`Location: ${longName} (${shortName})`} + + {t("locationResponse.title", { + identifier: `${longName} (${shortName})`, + })} + diff --git a/src/components/Dialog/NewDeviceDialog.tsx b/src/components/Dialog/NewDeviceDialog.tsx index dd73632a..f821c05b 100644 --- a/src/components/Dialog/NewDeviceDialog.tsx +++ b/src/components/Dialog/NewDeviceDialog.tsx @@ -1,7 +1,7 @@ import { type BrowserFeature, useBrowserFeatureDetection, -} from "../../core/hooks/useBrowserFeatureDetection.ts"; +} from "@core/hooks/useBrowserFeatureDetection.ts"; import { BLE } from "@components/PageComponents/Connect/BLE.tsx"; import { HTTP } from "@components/PageComponents/Connect/HTTP.tsx"; import { Serial } from "@components/PageComponents/Connect/Serial.tsx"; @@ -20,8 +20,9 @@ import { } from "@components/UI/Tabs.tsx"; import { Subtle } from "@components/UI/Typography/Subtle.tsx"; import { AlertCircle } from "lucide-react"; +import { useMemo } from "react"; +import { Trans, useTranslation } from "react-i18next"; import { Link } from "../UI/Typography/Link.tsx"; -import { Fragment } from "react/jsx-runtime"; export interface TabElementProps { closeDialog: () => void; @@ -51,12 +52,18 @@ const links: { [key: string]: string } = { "https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts", }; -const listFormatter = new Intl.ListFormat("en", { - style: "long", - type: "disjunction", -}); - const ErrorMessage = ({ missingFeatures }: FeatureErrorProps) => { + const { i18n } = useTranslation("dialog"); + + const listFormatter = useMemo( + () => + new Intl.ListFormat(i18n.language, { + style: "long", + type: "disjunction", + }), + [i18n.language], + ); + if (missingFeatures.length === 0) return null; const browserFeatures = missingFeatures.filter( @@ -74,10 +81,12 @@ const ErrorMessage = ({ missingFeatures }: FeatureErrorProps) => { ); } - return {part.value}; + return {part.value}; }); }; + const featureNodes = formatFeatureList(browserFeatures); + return (
@@ -85,20 +94,28 @@ const ErrorMessage = ({ missingFeatures }: FeatureErrorProps) => {

{browserFeatures.length > 0 && ( - <> - This connection type requires{" "} - {formatFeatureList(browserFeatures)}. Please use a supported - browser, like Chrome or Edge. - + {featureNodes}, + }} + /> )} + {browserFeatures.length > 0 && needsSecureContext && " "} {needsSecureContext && ( - <> - {browserFeatures.length > 0 && " Additionally, it"} - {browserFeatures.length === 0 && "This application"} requires a - {" "} - secure context. - Please connect using HTTPS or localhost. - + 0 + ? "newDeviceDialog.validation.additionallyRequiresSecureContext" + : "newDeviceDialog.validation.requiresSecureContext"} + components={{ + "0": ( + + ), + }} + /> )}

@@ -111,22 +128,23 @@ export const NewDeviceDialog = ({ open, onOpenChange, }: NewDeviceProps) => { + const { t } = useTranslation("dialog"); const { unsupported } = useBrowserFeatureDetection(); const tabs: TabManifest[] = [ { - label: "HTTP", + label: t("newDeviceDialog.tabHttp"), element: HTTP, isDisabled: false, }, { - label: "Bluetooth", + label: t("newDeviceDialog.tabBluetooth"), element: BLE, isDisabled: unsupported.includes("Web Bluetooth") || unsupported.includes("Secure Context"), }, { - label: "Serial", + label: t("newDeviceDialog.tabSerial"), element: Serial, isDisabled: unsupported.includes("Web Serial") || unsupported.includes("Secure Context"), @@ -138,7 +156,7 @@ export const NewDeviceDialog = ({ - Connect New Device + {t("newDeviceDialog.title")} @@ -151,7 +169,8 @@ export const NewDeviceDialog = ({ {tabs.map((tab) => (
- {(tab.label !== "HTTP" && tab.isDisabled) + {(tab.label !== "HTTP" && + tab.isDisabled) ? : null} { + const { t } = useTranslation("dialog"); const { setDialogOpen, connection, setActivePage, getNode } = useDevice(); const { setNodeNumToBeRemoved, nodeNumDetails } = useAppStore(); const { setChatType, setActiveChat } = useMessageStore(); @@ -93,11 +95,11 @@ export const NodeDetailsDialog = ({ if (!node) return; toast({ - title: "Requesting position, please wait...", + title: t("toast.requestingPosition.title", { ns: "ui" }), }); connection?.requestPosition(node.num).then(() => toast({ - title: "Position request sent.", + title: t("toast.positionRequestSent.title", { ns: "ui" }), }) ); onOpenChange(false); @@ -107,11 +109,11 @@ export const NodeDetailsDialog = ({ if (!node) return; toast({ - title: "Sending Traceroute, please wait...", + title: t("toast.sendingTraceroute.title", { ns: "ui" }), }); connection?.traceRoute(node.num).then(() => toast({ - title: "Traceroute sent.", + title: t("toast.tracerouteSent.title", { ns: "ui" }), }) ); onOpenChange(false); @@ -142,25 +144,25 @@ export const NodeDetailsDialog = ({ const deviceMetricsMap = [ { key: "airUtilTx", - label: "Air TX utilization", + label: t("nodeDetails.airTxUtilization"), value: node.deviceMetrics?.airUtilTx, format: (val: number) => `${val.toFixed(2)}%`, }, { key: "channelUtilization", - label: "Channel utilization", + label: t("nodeDetails.channelUtilization"), value: node.deviceMetrics?.channelUtilization, format: (val: number) => `${val.toFixed(2)}%`, }, { key: "batteryLevel", - label: "Battery level", + label: t("nodeDetails.batteryLevel"), value: node.deviceMetrics?.batteryLevel, format: (val: number) => `${val.toFixed(2)}%`, }, { key: "voltage", - label: "Voltage", + label: t("nodeDetails.voltage"), value: node.deviceMetrics?.voltage, format: (val: number) => `${val.toFixed(2)}V`, }, @@ -172,20 +174,31 @@ export const NodeDetailsDialog = ({ - Node Details for {node.user?.longName ?? "UNKNOWN"} ( - {node.user?.shortName ?? "UNK"}) + {t("nodeDetails.title", { + identifier: `${node.user?.longName ?? t("unknown.shortName")} (${ + node.user?.shortName ?? t("unknown.shortName") + })`, + })}
- - - Remove node + {t("nodeDetails.removeNode")} @@ -242,23 +257,30 @@ export const NodeDetailsDialog = ({
-

Details:

-

Node Number: {node.num}

-

Node Hex: !{numberToHexUnpadded(node.num)}

+

+ {t("nodeDetails.details")} +

+

{t("nodeDetails.nodeNumber")}{node.num}

+

+ {t("nodeDetails.nodeHexPrefix")} + {numberToHexUnpadded(node.num)} +

- Role: {Protobuf.Config.Config_DeviceConfig_Role[ + {t("nodeDetails.role")} + {Protobuf.Config.Config_DeviceConfig_Role[ node.user?.role ?? 0 ].replace(/_/g, " ")}

- Last Heard: {node.lastHeard === 0 - ? "Never" + {t("nodeDetails.lastHeard")} + {node.lastHeard === 0 + ? t("nodesTable.lastHeardStatus.never", { ns: "nodes" }) : }

- Hardware:{" "} + {t("nodeDetails.hardware")} {(Protobuf.Mesh.HardwareModel[node.user?.hwModel ?? 0] ?? - "Unknown") + t("unknown.shortName")) .replace(/_/g, " ")}

@@ -272,7 +294,9 @@ export const NodeDetailsDialog = ({
{node.deviceMetrics && (

- Device Metrics: + {t("nodeDetails.deviceMetrics")}

{deviceMetricsMap.map( (metric) => @@ -321,7 +353,7 @@ export const NodeDetailsDialog = ({ )} {node.deviceMetrics.uptimeSeconds && (

- Uptime:{" "} + {t("nodeDetails.uptime")}

)} @@ -334,7 +366,7 @@ export const NodeDetailsDialog = ({

- All Raw Metrics: + {t("nodeDetails.allRawMetrics")}

diff --git a/src/components/Dialog/PKIBackupDialog.tsx b/src/components/Dialog/PKIBackupDialog.tsx index 3cd16727..189d5053 100644 --- a/src/components/Dialog/PKIBackupDialog.tsx +++ b/src/components/Dialog/PKIBackupDialog.tsx @@ -12,6 +12,7 @@ import { import { fromByteArray } from "base64-js"; import { DownloadIcon, PrinterIcon } from "lucide-react"; import React from "react"; +import { useTranslation } from "react-i18next"; export interface PkiBackupDialogProps { open: boolean; @@ -22,7 +23,8 @@ export const PkiBackupDialog = ({ open, onOpenChange, }: PkiBackupDialogProps) => { - const { config, setDialogOpen } = useDevice(); + const { t } = useTranslation("dialog"); + const { config, setDialogOpen, getMyNode } = useDevice(); const privateKey = config.security?.privateKey; const publicKey = config.security?.publicKey; @@ -46,7 +48,12 @@ export const PkiBackupDialog = ({ printWindow.document.write(` - === MESHTASTIC KEYS === + ${ + t("pkiBackup.header", { + shortName: getMyNode()?.user?.shortName ?? t("unknown.shortName"), + longName: getMyNode()?.user?.longName ?? t("unknown.longName"), + }) + } -

=== MESHTASTIC KEYS ===

-
-

Public Key:

+

${ + t("pkiBackup.header", { + shortName: getMyNode()?.user?.shortName ?? t("unknown.shortName"), + longName: getMyNode()?.user?.longName ?? t("unknown.longName"), + }) + }

+

${t("pkiBackup.secureBackup")}

+

${t("pkiBackup.publicKey")}

${decodeKeyData(publicKey)}

-

Private Key:

+

${t("pkiBackup.privateKey")}

${decodeKeyData(privateKey)}

-
-

=== END OF KEYS ===

+

${t("pkiBackup.footer")}

`); @@ -69,7 +80,7 @@ export const PkiBackupDialog = ({ printWindow.print(); closeDialog(); } - }, [decodeKeyData, privateKey, publicKey, closeDialog]); + }, [decodeKeyData, privateKey, publicKey, closeDialog, t]); const createDownloadKeyFile = React.useCallback(() => { if (!privateKey || !publicKey) return; @@ -78,12 +89,12 @@ export const PkiBackupDialog = ({ const decodedPublicKey = decodeKeyData(publicKey); const formattedContent = [ - "=== MESHTASTIC KEYS ===\n\n", - "Private Key:\n", + `${t("pkiBackup.header")}\n\n`, + `${t("pkiBackup.privateKey")}\n`, decodedPrivateKey, - "\n\nPublic Key:\n", + `\n\n${t("pkiBackup.publicKey")}\n`, decodedPublicKey, - "\n\n=== END OF KEYS ===", + `\n\n${t("pkiBackup.footer")}`, ].join(""); const blob = new Blob([formattedContent], { type: "text/plain" }); @@ -91,43 +102,47 @@ export const PkiBackupDialog = ({ const link = document.createElement("a"); link.href = url; - link.download = "meshtastic_keys.txt"; + link.download = t("pkiBackup.fileName", { + shortName: getMyNode()?.user?.shortName ?? t("unknown.shortName"), + longName: getMyNode()?.user?.longName ?? t("unknown.longName"), + }); + link.style.display = "none"; document.body.appendChild(link); link.click(); document.body.removeChild(link); closeDialog(); URL.revokeObjectURL(url); - }, [decodeKeyData, privateKey, publicKey, closeDialog]); + }, [decodeKeyData, privateKey, publicKey, closeDialog, t]); return ( - Backup Keys + {t("pkiBackup.title")} - Its important to backup your public and private keys and store your - backup securely! + {t("pkiBackup.secureBackup")} - If you lose your keys, you will need to reset your device. + {t("pkiBackup.loseKeysWarning")} diff --git a/src/components/Dialog/PkiRegenerateDialog.tsx b/src/components/Dialog/PkiRegenerateDialog.tsx index 58fb7208..aa09aa1f 100644 --- a/src/components/Dialog/PkiRegenerateDialog.tsx +++ b/src/components/Dialog/PkiRegenerateDialog.tsx @@ -8,6 +8,7 @@ import { DialogHeader, DialogTitle, } from "@components/UI/Dialog.tsx"; +import { useTranslation } from "react-i18next"; export interface PkiRegenerateDialogProps { text: { @@ -22,27 +23,38 @@ export interface PkiRegenerateDialogProps { export const PkiRegenerateDialog = ({ text = { - title: "Regenerate Key Pair", - description: "Are you sure you want to regenerate key pair?", - button: "Regenerate", + title: "", + description: "", + button: "", }, open, onOpenChange, onSubmit, }: PkiRegenerateDialogProps) => { + const { t } = useTranslation("dialog"); + const dialogText = { + title: text.title || t("pkiRegenerate.title"), + description: text.description || + t("pkiRegenerate.description"), + button: text.button || t("button.regenerate"), + }; return ( - {text?.title} + {dialogText.title} - {text?.description} + {dialogText.description} - diff --git a/src/components/Dialog/QRDialog.tsx b/src/components/Dialog/QRDialog.tsx index 0dc67fb7..ae3d259f 100644 --- a/src/components/Dialog/QRDialog.tsx +++ b/src/components/Dialog/QRDialog.tsx @@ -16,6 +16,7 @@ import { fromByteArray } from "base64-js"; import { ClipboardIcon } from "lucide-react"; import { useEffect, useMemo, useState } from "react"; import { QRCode } from "react-qrcode-logo"; +import { useTranslation } from "react-i18next"; export interface QRDialogProps { open: boolean; @@ -30,6 +31,7 @@ export const QRDialog = ({ loraConfig, channels, }: QRDialogProps) => { + const { t } = useTranslation("dialog"); const [selectedChannels, setSelectedChannels] = useState([0]); const [qrCodeUrl, setQrCodeUrl] = useState(""); const [qrCodeAdd, setQrCodeAdd] = useState(); @@ -65,9 +67,9 @@ export const QRDialog = ({ - Generate QR Code + {t("qr.title")} - The current LoRa configuration will also be shared. + {t("qr.description")}
@@ -79,8 +81,13 @@ export const QRDialog = ({ {channel.settings?.name.length ? channel.settings.name : channel.role === Protobuf.Channel.Channel_Role.PRIMARY - ? "Primary" - : `Channel: ${channel.index}`} + ? t("page.broadcastLabel", { ns: "channels" }) + : `${ + t("page.channelIndex", { + ns: "channels", + index: channel.index, + }) + }${channel.index}`} setQrCodeAdd(true)} > - Add Channels + {t("qr.addChannels")}
- + { + const { t } = useTranslation("dialog"); const { connection } = useDevice(); const [time, setTime] = useState(5); @@ -30,9 +32,11 @@ export const RebootDialog = ({ - Schedule Reboot + + {t("reboot.title")} + - Reboot the connected node after x minutes. + {t("reboot.description")}
@@ -50,12 +54,13 @@ export const RebootDialog = ({ />
diff --git a/src/components/Dialog/RebootOTADialog.test.tsx b/src/components/Dialog/RebootOTADialog.test.tsx index 94cc5e7c..4ded7def 100644 --- a/src/components/Dialog/RebootOTADialog.test.tsx +++ b/src/components/Dialog/RebootOTADialog.test.tsx @@ -60,7 +60,8 @@ describe("RebootOTADialog", () => { it("renders dialog with default input value", () => { render( {}} />); expect(screen.getByPlaceholderText(/enter delay/i)).toHaveValue(5); - expect(screen.getByText(/schedule reboot/i)).toBeInTheDocument(); + expect(screen.getByRole("heading", { name: /schedule reboot/i, level: 1 })) + .toBeInTheDocument(); expect(screen.getByText(/reboot to ota mode now/i)).toBeInTheDocument(); }); @@ -72,7 +73,7 @@ describe("RebootOTADialog", () => { target: { value: "3" }, }); - fireEvent.click(screen.getByText(/schedule reboot/i)); + fireEvent.click(screen.getByTestId("scheduleRebootBtn")); expect(screen.getByText(/reboot has been scheduled/i)).toBeInTheDocument(); @@ -99,12 +100,11 @@ describe("RebootOTADialog", () => { it("does not call reboot if connection is undefined", async () => { const onOpenChangeMock = vi.fn(); - // simulate no connection mockConnection = undefined; render(); - fireEvent.click(screen.getByText(/schedule reboot/i)); + fireEvent.click(screen.getByTestId("scheduleRebootBtn")); vi.advanceTimersByTime(5000); await waitFor(() => { @@ -112,7 +112,6 @@ describe("RebootOTADialog", () => { expect(onOpenChangeMock).not.toHaveBeenCalled(); }); - // reset connection for other tests mockConnection = { rebootOta: rebootOtaMock }; }); }); diff --git a/src/components/Dialog/RebootOTADialog.tsx b/src/components/Dialog/RebootOTADialog.tsx index b554b28e..5276b81b 100644 --- a/src/components/Dialog/RebootOTADialog.tsx +++ b/src/components/Dialog/RebootOTADialog.tsx @@ -11,6 +11,7 @@ import { } from "@components/UI/Dialog.tsx"; import { Input } from "@components/UI/Input.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; +import { useTranslation } from "react-i18next"; export interface RebootOTADialogProps { open: boolean; @@ -22,6 +23,7 @@ const DEFAULT_REBOOT_DELAY = 5; // seconds export const RebootOTADialog = ( { open, onOpenChange }: RebootOTADialogProps, ) => { + const { t } = useTranslation("dialog"); const { connection } = useDevice(); const [time, setTime] = useState(DEFAULT_REBOOT_DELAY); const [isScheduled, setIsScheduled] = useState(false); @@ -50,7 +52,6 @@ export const RebootOTADialog = ( await new Promise((resolve) => { setTimeout(() => { - console.log("Rebooting..."); resolve(); }, delay * 1000); }).finally(() => { @@ -73,10 +74,11 @@ export const RebootOTADialog = ( - Reboot to OTA Mode + + {t("rebootOta.title")} + - Reboot the connected node after a delay into OTA (Over-the-Air) - mode. + {t("rebootOta.description")} @@ -88,17 +90,25 @@ export const RebootOTADialog = ( className="dark:text-slate-900 appearance-none" value={inputValue} onChange={handleSetTime} - placeholder="Enter delay (sec)" + placeholder={t("rebootOta.enterDelay")} /> -
-
diff --git a/src/components/Dialog/RefreshKeysDialog/RefreshKeysDialog.tsx b/src/components/Dialog/RefreshKeysDialog/RefreshKeysDialog.tsx index 95bc73aa..07d4350d 100644 --- a/src/components/Dialog/RefreshKeysDialog/RefreshKeysDialog.tsx +++ b/src/components/Dialog/RefreshKeysDialog/RefreshKeysDialog.tsx @@ -9,6 +9,7 @@ import { Button } from "@components/UI/Button.tsx"; import { LockKeyholeOpenIcon } from "lucide-react"; import { useRefreshKeysDialog } from "./useRefreshKeysDialog.ts"; import { useDevice } from "@core/stores/deviceStore.ts"; +import { useTranslation } from "react-i18next"; import { useMessageStore } from "../../../core/stores/messageStore/index.ts"; export interface RefreshKeysDialogProps { @@ -19,6 +20,7 @@ export interface RefreshKeysDialogProps { export const RefreshKeysDialog = ( { open, onOpenChange }: RefreshKeysDialogProps, ) => { + const { t } = useTranslation("dialog"); const { activeChat } = useMessageStore(); const { nodeErrors, getNode } = useDevice(); const { handleCloseDialog, handleNodeRemove } = useRefreshKeysDialog(); @@ -32,13 +34,16 @@ export const RefreshKeysDialog = ( const nodeWithError = getNode(nodeErrorNum.node); const text = { - title: `Keys Mismatch - ${nodeWithError?.user?.longName ?? ""}`, - description: `Your node is unable to send a direct message to node: ${ + title: t("refreshKeys.title", { + identifier: nodeWithError?.user?.longName ?? "", + }), + description: `${t("refreshKeys.description.unableToSendDmPrefix")}${ nodeWithError?.user?.longName ?? "" - } (${ - nodeWithError?.user?.shortName ?? "" - }). This is due to the remote node's current public key does not match the previously stored key for this node.`, + } (${nodeWithError?.user?.shortName ?? ""})${ + t("refreshKeys.description.keyMismatchReasonSuffix") + }`, }; + return (
-

Accept New Keys

+

+ {t("refreshKeys.label.acceptNewKeys")} +

- This will remove the node from device and request new keys. + {t("refreshKeys.description.acceptNewKeys")}

diff --git a/src/components/Dialog/RemoveNodeDialog.tsx b/src/components/Dialog/RemoveNodeDialog.tsx index 66c42dc6..a3ec7451 100644 --- a/src/components/Dialog/RemoveNodeDialog.tsx +++ b/src/components/Dialog/RemoveNodeDialog.tsx @@ -11,6 +11,7 @@ import { DialogTitle, } from "@components/UI/Dialog.tsx"; import { Label } from "@components/UI/Label.tsx"; +import { useTranslation } from "react-i18next"; export interface RemoveNodeDialogProps { open: boolean; @@ -21,6 +22,7 @@ export const RemoveNodeDialog = ({ open, onOpenChange, }: RemoveNodeDialogProps) => { + const { t } = useTranslation("dialog"); const { connection, getNode, removeNode } = useDevice(); const { nodeNumToBeRemoved } = useAppStore(); @@ -35,9 +37,9 @@ export const RemoveNodeDialog = ({ - Remove Node? + {t("removeNode.title")} - Are you sure you want to remove this Node? + {t("removeNode.description")}
@@ -46,8 +48,12 @@ export const RemoveNodeDialog = ({
-
diff --git a/src/components/Dialog/ShutdownDialog.tsx b/src/components/Dialog/ShutdownDialog.tsx index ddc50edb..712b2b62 100644 --- a/src/components/Dialog/ShutdownDialog.tsx +++ b/src/components/Dialog/ShutdownDialog.tsx @@ -10,6 +10,7 @@ import { import { Input } from "@components/UI/Input.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { ClockIcon, PowerIcon } from "lucide-react"; +import { useTranslation } from "react-i18next"; import { useState } from "react"; export interface ShutdownDialogProps { @@ -21,6 +22,7 @@ export const ShutdownDialog = ({ open, onOpenChange, }: ShutdownDialogProps) => { + const { t } = useTranslation("dialog"); const { connection } = useDevice(); const [time, setTime] = useState(5); @@ -30,9 +32,11 @@ export const ShutdownDialog = ({ - Schedule Shutdown + + {t("shutdown.title")} + - Turn off the connected node after x minutes. + {t("shutdown.description")} @@ -41,7 +45,7 @@ export const ShutdownDialog = ({ type="number" value={time} onChange={(e) => setTime(Number.parseInt(e.target.value))} - suffix="Minutes" + suffix={t("unit.minute.plural")} />
diff --git a/src/components/Dialog/TracerouteResponseDialog.tsx b/src/components/Dialog/TracerouteResponseDialog.tsx index 7895c326..650b9bfe 100644 --- a/src/components/Dialog/TracerouteResponseDialog.tsx +++ b/src/components/Dialog/TracerouteResponseDialog.tsx @@ -11,6 +11,7 @@ import type { Protobuf, Types } from "@meshtastic/core"; import { numberToHexUnpadded } from "@noble/curves/abstract/utils"; import { TraceRoute } from "../PageComponents/Messages/TraceRoute.tsx"; +import { useTranslation } from "react-i18next"; export interface TracerouteResponseDialogProps { traceroute: Types.PacketMetadata | undefined; @@ -23,6 +24,7 @@ export const TracerouteResponseDialog = ({ open, onOpenChange, }: TracerouteResponseDialogProps) => { + const { t } = useTranslation("dialog"); const { getNode } = useDevice(); const route: number[] = traceroute?.data.route ?? []; const routeBack: number[] = traceroute?.data.routeBack ?? []; @@ -30,16 +32,22 @@ export const TracerouteResponseDialog = ({ const snrBack = (traceroute?.data.snrBack ?? []).map((snr) => snr / 4); const from = getNode(traceroute?.from ?? 0); const longName = from?.user?.longName ?? - (from ? `!${numberToHexUnpadded(from?.num)}` : "Unknown"); + (from ? `!${numberToHexUnpadded(from?.num)}` : t("unknown.shortName")); const shortName = from?.user?.shortName ?? - (from ? `${numberToHexUnpadded(from?.num).substring(0, 4)}` : "UNK"); + (from + ? `${numberToHexUnpadded(from?.num).substring(0, 4)}` + : t("unknown.shortName")); const to = getNode(traceroute?.to ?? 0); return ( - {`Traceroute: ${longName} (${shortName})`} + + {t("tracerouteResponse.title", { + identifier: `${longName} (${shortName})`, + })} + { + const { t } = useTranslation("dialog"); const [confirmState, setConfirmState] = useState(false); const { setDialogOpen } = useDevice(); @@ -41,26 +43,27 @@ export const UnsafeRolesDialog = ( handleCloseDialog("dismiss")} /> - Are you sure? + {t("unsafeRoles.title")} - I have read the{" "} + {t("unsafeRoles.preamble")} - Device Role Documentation - {" "} - and the blog post about{" "} + {t("unsafeRoles.deviceRoleDocumentation")} + + {t("unsafeRoles.conjunction")} - Choosing The Right Device Role - {" "} - and understand the implications of changing the role. + {t("unsafeRoles.choosingRightDeviceRole")} + + {t("unsafeRoles.postamble")}
setConfirmState(!confirmState)} + name="confirmUnderstanding" > - Yes, I know what I'm doing + {t("unsafeRoles.confirmUnderstanding")}
@@ -69,7 +72,7 @@ export const UnsafeRolesDialog = ( name="dismiss" onClick={() => handleCloseDialog("dismiss")} > - Dismiss + {t("button.dismiss")}
diff --git a/src/components/Dialog/UnsafeRolesDialog/useUnsafeRolesDialog.ts b/src/components/Dialog/UnsafeRolesDialog/useUnsafeRolesDialog.ts index cbce3bb7..6e11da00 100644 --- a/src/components/Dialog/UnsafeRolesDialog/useUnsafeRolesDialog.ts +++ b/src/components/Dialog/UnsafeRolesDialog/useUnsafeRolesDialog.ts @@ -2,7 +2,7 @@ import { useCallback } from "react"; import { eventBus } from "@core/utils/eventBus.ts"; import { useDevice } from "@core/stores/deviceStore.ts"; -export const UNSAFE_ROLES = ["ROUTER", "REPEATER"]; +export const UNSAFE_ROLES = ["ROUTER", "ROUTER_LATE", "REPEATER"]; export type UnsafeRole = typeof UNSAFE_ROLES[number]; export const useUnsafeRolesDialog = () => { diff --git a/src/components/Form/FormMultiSelect.tsx b/src/components/Form/FormMultiSelect.tsx index 6eb444eb..cea9a511 100644 --- a/src/components/Form/FormMultiSelect.tsx +++ b/src/components/Form/FormMultiSelect.tsx @@ -3,6 +3,8 @@ import type { GenericFormElementProps, } from "@components/Form/DynamicForm.tsx"; import type { FieldValues } from "react-hook-form"; +import { useTranslation } from "react-i18next"; +import type { FLAGS_CONFIG } from "@core/hooks/usePositionFlags.ts"; import { MultiSelect, MultiSelectItem } from "../UI/MultiSelect.tsx"; export interface MultiSelectFieldProps extends BaseFormBuilderProps { @@ -12,53 +14,54 @@ export interface MultiSelectFieldProps extends BaseFormBuilderProps { isChecked: (name: string) => boolean; value: string[]; properties: BaseFormBuilderProps["properties"] & { - enumValue: { - [s: string]: string | number; - }; + enumValue: + | { [s: string]: string | number } + | typeof FLAGS_CONFIG; formatEnumName?: boolean; }; } -const formatEnumDisplay = (name: string): string => { - return name - .replace(/_/g, " ") - .toLowerCase() - .split(" ") - .map((s) => s.charAt(0).toUpperCase() + s.substring(1)) - .join(" "); -}; - export function MultiSelectInput({ field, }: GenericFormElementProps>) { - const { enumValue, formatEnumName, ...remainingProperties } = - field.properties; + const { t } = useTranslation("deviceConfig"); + const { enumValue, ...remainingProperties } = field.properties; - const valueToKeyMap: Record = {}; - const optionsEnumValues: [string, number][] = []; + const isNewConfigStructure = + typeof Object.values(enumValue)[0] === "object" && + Object.values(enumValue)[0] !== null && + "i18nKey" in Object.values(enumValue)[0]; - if (enumValue) { - Object.entries(enumValue).forEach(([key, val]) => { - if (typeof val === "number" && key !== "UNSET") { - valueToKeyMap[val.toString()] = key; - optionsEnumValues.push([key, val as number]); + const optionsToRender = Object.entries(enumValue).map( + ([key, configOrValue]) => { + if (isNewConfigStructure) { + const config = + configOrValue as typeof FLAGS_CONFIG[keyof typeof FLAGS_CONFIG]; + return { + key, + display: t(config.i18nKey), + value: config.value, + }; } - }); - } + return { key, display: key, value: configOrValue as number }; + }, + ); return ( - {optionsEnumValues.map(([name, value]) => ( - field.onValueChange(name)} - > - {formatEnumName ? formatEnumDisplay(name) : name} - - ))} + {optionsToRender.map((option) => { + return ( + field.onValueChange(option.key)} + > + {option.display} + + ); + })} ); } diff --git a/src/components/KeyBackupReminder.tsx b/src/components/KeyBackupReminder.tsx index 80894cba..aefe60ec 100644 --- a/src/components/KeyBackupReminder.tsx +++ b/src/components/KeyBackupReminder.tsx @@ -1,12 +1,13 @@ import { useBackupReminder } from "@core/hooks/useKeyBackupReminder.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; +import { useTranslation } from "react-i18next"; export const KeyBackupReminder = () => { const { setDialogOpen } = useDevice(); + const { t } = useTranslation("dialog"); useBackupReminder({ - message: - "We recommend backing up your key data regularly. Would you like to back up now?", + message: t("pkiBackup.description"), onAccept: () => setDialogOpen("pkiBackup", true), enabled: true, }); diff --git a/src/components/LanguageSwitcher.tsx b/src/components/LanguageSwitcher.tsx new file mode 100644 index 00000000..03db9d9c --- /dev/null +++ b/src/components/LanguageSwitcher.tsx @@ -0,0 +1,91 @@ +import { Check, Languages } from "lucide-react"; +import { useTranslation } from "react-i18next"; +import { LangCode, supportedLanguages } from "../i18n/config.ts"; +import useLang from "@core/hooks/useLang.ts"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "./UI/DropdownMenu.tsx"; +import { Subtle } from "./UI/Typography/Subtle.tsx"; +import { cn } from "@core/utils/cn.ts"; +import { Button } from "./UI/Button.tsx"; + +interface LanguageSwitcherProps { + disableHover?: boolean; +} + +export default function LanguageSwitcher( + { disableHover = false }: LanguageSwitcherProps, +) { + const { i18n } = useTranslation("ui"); + const { set: setLanguage } = useLang(); + + const currentLanguage = + supportedLanguages.find((lang) => lang.code === i18n.language) || + supportedLanguages[0]; + + const handleLanguageChange = async (languageCode: LangCode) => { + await setLanguage(languageCode, true); + }; + + return ( + + + + + + {supportedLanguages.map((language) => ( + handleLanguageChange(language.code as LangCode)} + className="flex items-center justify-between cursor-pointer" + > +
+ {language.flag} + {language.name} +
+ {i18n.language === language.code && ( + + )} +
+ ))} +
+
+ ); +} diff --git a/src/components/PageComponents/Channel.tsx b/src/components/PageComponents/Channel.tsx index 9968bf02..cc46b8d0 100644 --- a/src/components/PageComponents/Channel.tsx +++ b/src/components/PageComponents/Channel.tsx @@ -7,6 +7,7 @@ import { Protobuf } from "@meshtastic/core"; import { fromByteArray, toByteArray } from "base64-js"; import cryptoRandomString from "crypto-random-string"; import { useState } from "react"; +import { useTranslation } from "react-i18next"; import { PkiRegenerateDialog } from "../Dialog/PkiRegenerateDialog.tsx"; export interface SettingsPanelProps { @@ -15,6 +16,7 @@ export interface SettingsPanelProps { export const Channel = ({ channel }: SettingsPanelProps) => { const { config, connection, addChannel } = useDevice(); + const { t } = useTranslation(["channels", "ui", "dialog"]); const { toast } = useToast(); const [pass, setPass] = useState( @@ -42,7 +44,10 @@ export const Channel = ({ channel }: SettingsPanelProps) => { }); connection?.setChannel(channel).then(() => { toast({ - title: `Saved Channel: ${channel.settings?.name}`, + title: t("toast.savedChannel", { + ns: "ui", + channelName: channel.settings?.name, + }), }); addChannel(channel); }); @@ -67,7 +72,9 @@ export const Channel = ({ channel }: SettingsPanelProps) => { const validatePass = (input: string, count: number) => { if (input.length % 4 !== 0 || toByteArray(input).length !== count) { - setValidationText(`Please enter a valid ${count * 8} bit PSK.`); + setValidationText( + t("validation.pskInvalid", { bits: count * 8 }), + ); } else { setValidationText(undefined); } @@ -110,36 +117,37 @@ export const Channel = ({ channel }: SettingsPanelProps) => { }} fieldGroups={[ { - label: "Channel Settings", - description: "Crypto, MQTT & misc settings", + label: t("settings.label"), + description: t("settings.description"), fields: [ { type: "select", name: "role", - label: "Role", + label: t("role.label"), disabled: channel.index === 0, - description: - "Device telemetry is sent over PRIMARY. Only one PRIMARY allowed", + description: t("role.description"), properties: { enumValue: channel.index === 0 - ? { PRIMARY: 1 } - : { DISABLED: 0, SECONDARY: 2 }, + ? { [t("role.options.primary")]: 1 } + : { + [t("role.options.disabled")]: 0, + [t("role.options.secondary")]: 2, + }, }, }, { type: "passwordGenerator", name: "settings.psk", id: "channel-psk", - label: "Pre-Shared Key", - description: - "Supported PSK lengths: 256-bit, 128-bit, 8-bit, Empty (0-bit)", + label: t("psk.label"), + description: t("psk.description"), validationText: validationText, devicePSKBitCount: bitCount ?? 0, inputChange: inputChangeEvent, selectChange: selectChangeEvent, actionButtons: [ { - text: "Generate", + text: t("psk.generate"), variant: "success", onClick: preSharedClickEvent, }, @@ -154,57 +162,99 @@ export const Channel = ({ channel }: SettingsPanelProps) => { { type: "text", name: "settings.name", - label: "Name", - description: - "A unique name for the channel <12 bytes, leave blank for default", + label: t("name.label"), + description: t("name.description"), }, { type: "toggle", name: "settings.uplinkEnabled", - label: "Uplink Enabled", - description: "Send messages from the local mesh to MQTT", + label: t("uplinkEnabled.label"), + description: t("uplinkEnabled.description"), }, { type: "toggle", name: "settings.downlinkEnabled", - label: "Downlink Enabled", - description: "Send messages from MQTT to the local mesh", + label: t("downlinkEnabled.label"), + description: t("downlinkEnabled.description"), }, { type: "select", name: "settings.moduleSettings.positionPrecision", - label: "Location", - description: - "The precision of the location to share with the channel. Can be disabled.", + label: t("positionPrecision.label"), + description: t("positionPrecision.description"), properties: { enumValue: config.display?.units === 0 ? { - "Do not share location": 0, - "Within 23 kilometers": 10, - "Within 12 kilometers": 11, - "Within 5.8 kilometers": 12, - "Within 2.9 kilometers": 13, - "Within 1.5 kilometers": 14, - "Within 700 meters": 15, - "Within 350 meters": 16, - "Within 200 meters": 17, - "Within 90 meters": 18, - "Within 50 meters": 19, - "Precise Location": 32, + [t("positionPrecision.options.none")]: 0, + [ + t("positionPrecision.options.metric_km23") + ]: 10, + [ + t("positionPrecision.options.metric_km12") + ]: 11, + [ + t("positionPrecision.options.metric_km5_8") + ]: 12, + [ + t("positionPrecision.options.metric_km2_9") + ]: 13, + [ + t("positionPrecision.options.metric_km1_5") + ]: 14, + [ + t("positionPrecision.options.metric_m700") + ]: 15, + [ + t("positionPrecision.options.metric_m350") + ]: 16, + [ + t("positionPrecision.options.metric_m200") + ]: 17, + [ + t("positionPrecision.options.metric_m90") + ]: 18, + [ + t("positionPrecision.options.metric_m50") + ]: 19, + [ + t("positionPrecision.options.precise") + ]: 32, } : { - "Do not share location": 0, - "Within 15 miles": 10, - "Within 7.3 miles": 11, - "Within 3.6 miles": 12, - "Within 1.8 miles": 13, - "Within 0.9 miles": 14, - "Within 0.5 miles": 15, - "Within 0.2 miles": 16, - "Within 600 feet": 17, - "Within 300 feet": 18, - "Within 150 feet": 19, - "Precise Location": 32, + [t("positionPrecision.options.none")]: 0, + [ + t("positionPrecision.options.imperial_mi15") + ]: 10, + [ + t("positionPrecision.options.imperial_mi7_3") + ]: 11, + [ + t("positionPrecision.options.imperial_mi3_6") + ]: 12, + [ + t("positionPrecision.options.imperial_mi1_8") + ]: 13, + [ + t("positionPrecision.options.imperial_mi0_9") + ]: 14, + [ + t("positionPrecision.options.imperial_mi0_5") + ]: 15, + [ + t("positionPrecision.options.imperial_mi0_2") + ]: 16, + [ + t("positionPrecision.options.imperial_ft600") + ]: 17, + [ + t("positionPrecision.options.imperial_ft300") + ]: 18, + [ + t("positionPrecision.options.imperial_ft150") + ]: 19, + [ + t("positionPrecision.options.precise") + ]: 32, }, }, }, @@ -214,10 +264,9 @@ export const Channel = ({ channel }: SettingsPanelProps) => { /> setPreSharedDialogOpen(false)} diff --git a/src/components/PageComponents/Config/Bluetooth.tsx b/src/components/PageComponents/Config/Bluetooth.tsx index a20155fd..96ef1765 100644 --- a/src/components/PageComponents/Config/Bluetooth.tsx +++ b/src/components/PageComponents/Config/Bluetooth.tsx @@ -5,6 +5,7 @@ import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; import { useState } from "react"; +import { useTranslation } from "react-i18next"; export const Bluetooth = () => { const { config, setWorkingConfig } = useDevice(); @@ -16,6 +17,7 @@ export const Bluetooth = () => { removeError, clearErrors, } = useAppStore(); + const { t } = useTranslation("deviceConfig"); const [bluetoothPin, setBluetoothPin] = useState( config?.bluetooth?.fixedPin.toString() ?? "", @@ -24,7 +26,7 @@ export const Bluetooth = () => { const validateBluetoothPin = (pin: string) => { // if empty show error they need a pin set if (pin === "") { - return addError("fixedPin", "Bluetooth Pin is required"); + return addError("fixedPin", t("bluetooth.validation.pinRequired")); } // clear any existing errors @@ -32,11 +34,14 @@ export const Bluetooth = () => { // if it starts with 0 show error if (pin[0] === "0") { - return addError("fixedPin", "Bluetooth Pin cannot start with 0"); + return addError( + "fixedPin", + t("bluetooth.validation.pinCannotStartWithZero"), + ); } // if it's not 6 digits show error if (pin.length < 6) { - return addError("fixedPin", "Pin must be 6 digits"); + return addError("fixedPin", t("bluetooth.validation.pinMustBeSixDigits")); } removeError("fixedPin"); @@ -69,22 +74,21 @@ export const Bluetooth = () => { defaultValues={config.bluetooth} fieldGroups={[ { - label: "Bluetooth Settings", - description: "Settings for the Bluetooth module ", - notes: - "Note: Some devices (ESP32) cannot use both Bluetooth and WiFi at the same time.", + label: t("bluetooth.title"), + description: t("bluetooth.description"), + notes: t("bluetooth.note"), fields: [ { type: "toggle", name: "enabled", - label: "Enabled", - description: "Enable or disable Bluetooth", + label: t("bluetooth.enabled.label"), + description: t("bluetooth.enabled.description"), }, { type: "select", name: "mode", - label: "Pairing mode", - description: "Pin selection behaviour.", + label: t("bluetooth.pairingMode.label"), + description: t("bluetooth.pairingMode.description"), selectChange: (e) => { if (e !== "1") { setBluetoothPin(""); @@ -104,8 +108,8 @@ export const Bluetooth = () => { { type: "number", name: "fixedPin", - label: "Pin", - description: "Pin to use when pairing", + label: t("bluetooth.pin.label"), + description: t("bluetooth.pin.description"), validationText: hasFieldError("fixedPin") ? getErrorMessage("fixedPin") : "", diff --git a/src/components/PageComponents/Config/Device/index.tsx b/src/components/PageComponents/Config/Device/index.tsx index a04f4c19..2b53495e 100644 --- a/src/components/PageComponents/Config/Device/index.tsx +++ b/src/components/PageComponents/Config/Device/index.tsx @@ -4,9 +4,11 @@ import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; import { useUnsafeRolesDialog } from "@components/Dialog/UnsafeRolesDialog/useUnsafeRolesDialog.ts"; +import { useTranslation } from "react-i18next"; export const Device = () => { const { config, setWorkingConfig } = useDevice(); + const { t } = useTranslation("deviceConfig"); const { validateRoleSelection } = useUnsafeRolesDialog(); const onSubmit = (data: DeviceValidation) => { @@ -25,14 +27,14 @@ export const Device = () => { defaultValues={config.device} fieldGroups={[ { - label: "Device Settings", - description: "Settings for the device", + label: t("device.title"), + description: t("device.description"), fields: [ { type: "select", name: "role", - label: "Role", - description: "What role the device performs on the mesh", + label: t("device.role.label"), + description: t("device.role.description"), validate: validateRoleSelection, properties: { enumValue: Protobuf.Config.Config_DeviceConfig_Role, @@ -42,20 +44,20 @@ export const Device = () => { { type: "number", name: "buttonGpio", - label: "Button Pin", - description: "Button pin override", + label: t("device.buttonPin.label"), + description: t("device.buttonPin.description"), }, { type: "number", name: "buzzerGpio", - label: "Buzzer Pin", - description: "Buzzer pin override", + label: t("device.buzzerPin.label"), + description: t("device.buzzerPin.description"), }, { type: "select", name: "rebroadcastMode", - label: "Rebroadcast Mode", - description: "How to handle rebroadcasting", + label: t("device.rebroadcastMode.label"), + description: t("device.rebroadcastMode.description"), properties: { enumValue: Protobuf.Config.Config_DeviceConfig_RebroadcastMode, formatEnumName: true, @@ -64,29 +66,29 @@ export const Device = () => { { type: "number", name: "nodeInfoBroadcastSecs", - label: "Node Info Broadcast Interval", - description: "How often to broadcast node info", + label: t("device.nodeInfoBroadcastInterval.label"), + description: t("device.nodeInfoBroadcastInterval.description"), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, }, { type: "toggle", name: "doubleTapAsButtonPress", - label: "Double Tap as Button Press", - description: "Treat double tap as button press", + label: t("device.doubleTapAsButtonPress.label"), + description: t("device.doubleTapAsButtonPress.description"), }, { type: "toggle", name: "disableTripleClick", - label: "Disable Triple Click", - description: "Disable triple click", + label: t("device.disableTripleClick.label"), + description: t("device.disableTripleClick.description"), }, { type: "text", name: "tzdef", - label: "POSIX Timezone", - description: "The POSIX timezone string for the device", + label: t("device.posixTimezone.label"), + description: t("device.posixTimezone.description"), properties: { fieldLength: { max: 64, @@ -98,8 +100,8 @@ export const Device = () => { { type: "toggle", name: "ledHeartbeatDisabled", - label: "LED Heartbeat Disabled", - description: "Disable default blinking LED", + label: t("device.ledHeartbeatDisabled.label"), + description: t("device.ledHeartbeatDisabled.description"), }, ], }, diff --git a/src/components/PageComponents/Config/Display.tsx b/src/components/PageComponents/Config/Display.tsx index af82e4fd..478aec32 100644 --- a/src/components/PageComponents/Config/Display.tsx +++ b/src/components/PageComponents/Config/Display.tsx @@ -1,11 +1,13 @@ -import type { DisplayValidation } from "@app/validation/config/display.tsx"; +import type { DisplayValidation } from "@app/validation/config/display.ts"; import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; +import { useTranslation } from "react-i18next"; export const Display = () => { const { config, setWorkingConfig } = useDevice(); + const { t } = useTranslation("deviceConfig"); const onSubmit = (data: DisplayValidation) => { setWorkingConfig( @@ -24,23 +26,23 @@ export const Display = () => { defaultValues={config.display} fieldGroups={[ { - label: "Display Settings", - description: "Settings for the device display", + label: t("display.title"), + description: t("display.description"), fields: [ { type: "number", name: "screenOnSecs", - label: "Screen Timeout", - description: "Turn off the display after this long", + label: t("display.screenTimeout.label"), + description: t("display.screenTimeout.description"), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, }, { type: "select", name: "gpsFormat", - label: "GPS Display Units", - description: "Coordinate display format", + label: t("display.gpsDisplayUnits.label"), + description: t("display.gpsDisplayUnits.description"), properties: { enumValue: Protobuf.Config.Config_DisplayConfig_GpsCoordinateFormat, @@ -49,35 +51,35 @@ export const Display = () => { { type: "number", name: "autoScreenCarouselSecs", - label: "Carousel Delay", - description: "How fast to cycle through windows", + label: t("display.carouselDelay.label"), + description: t("display.carouselDelay.description"), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, }, { type: "toggle", name: "compassNorthTop", - label: "Compass North Top", - description: "Fix north to the top of compass", + label: t("display.compassNorthTop.label"), + description: t("display.compassNorthTop.description"), }, { type: "toggle", name: "use12hClock", - label: "12-Hour Clock", - description: "Use 12-hour clock format", + label: t("display.twelveHourClock.label"), + description: t("display.twelveHourClock.description"), }, { type: "toggle", name: "flipScreen", - label: "Flip Screen", - description: "Flip display 180 degrees", + label: t("display.flipScreen.label"), + description: t("display.flipScreen.description"), }, { type: "select", name: "units", - label: "Display Units", - description: "Display metric or imperial units", + label: t("display.displayUnits.label"), + description: t("display.displayUnits.description"), properties: { enumValue: Protobuf.Config.Config_DisplayConfig_DisplayUnits, formatEnumName: true, @@ -86,17 +88,17 @@ export const Display = () => { { type: "select", name: "oled", - label: "OLED Type", - description: "Type of OLED screen attached to the device", + label: t("display.oledType.label"), + description: t("display.oledType.description"), properties: { - enumValue: Protobuf.Config.Config_DisplayConfig_OledType, + enumValue: Protobuf.Config.Config_Displayjonfig_OledType, }, }, { type: "select", name: "displaymode", - label: "Display Mode", - description: "Screen layout variant", + label: t("display.displayMode.label"), + description: t("display.displayMode.description"), properties: { enumValue: Protobuf.Config.Config_DisplayConfig_DisplayMode, formatEnumName: true, @@ -105,14 +107,14 @@ export const Display = () => { { type: "toggle", name: "headingBold", - label: "Bold Heading", - description: "Bolden the heading text", + label: t("display.headingBold.label"), + description: t("display.headingBold.description"), }, { type: "toggle", name: "wakeOnTapOrMotion", - label: "Wake on Tap or Motion", - description: "Wake the device on tap or motion", + label: t("display.wakeOnTapOrMotion.label"), + description: t("display.wakeOnTapOrMotion.description"), }, ], }, diff --git a/src/components/PageComponents/Config/LoRa.tsx b/src/components/PageComponents/Config/LoRa.tsx index 671af617..d8e3b7f7 100644 --- a/src/components/PageComponents/Config/LoRa.tsx +++ b/src/components/PageComponents/Config/LoRa.tsx @@ -1,11 +1,13 @@ -import type { LoRaValidation } from "@app/validation/config/lora.tsx"; +import type { LoRaValidation } from "@app/validation/config/lora.ts"; import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; +import { useTranslation } from "react-i18next"; export const LoRa = () => { const { config, setWorkingConfig } = useDevice(); + const { t } = useTranslation("deviceConfig"); const onSubmit = (data: LoRaValidation) => { setWorkingConfig( @@ -24,14 +26,14 @@ export const LoRa = () => { defaultValues={config.lora} fieldGroups={[ { - label: "Mesh Settings", - description: "Settings for the LoRa mesh", + label: t("lora.title"), + description: t("lora.description"), fields: [ { type: "select", name: "region", - label: "Region", - description: "Sets the region for your node", + label: t("lora.region.label"), + description: t("lora.region.description"), properties: { enumValue: Protobuf.Config.Config_LoRaConfig_RegionCode, }, @@ -39,8 +41,8 @@ export const LoRa = () => { { type: "select", name: "hopLimit", - label: "Hop Limit", - description: "Maximum number of hops", + label: t("lora.hopLimit.label"), + description: t("lora.hopLimit.description"), properties: { enumValue: { 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7 }, }, @@ -48,39 +50,38 @@ export const LoRa = () => { { type: "number", name: "channelNum", - label: "Frequency Slot", - description: "LoRa frequency channel number", + label: t("lora.frequencySlot.label"), + description: t("lora.frequencySlot.description"), }, { type: "toggle", name: "ignoreMqtt", - label: "Ignore MQTT", - description: "Don't forward MQTT messages over the mesh", + label: t("lora.ignoreMqtt.label"), + description: t("lora.ignoreMqtt.description"), }, { type: "toggle", name: "configOkToMqtt", - label: "OK to MQTT", - description: - "When set to true, this configuration indicates that the user approves the packet to be uploaded to MQTT. If set to false, remote nodes are requested not to forward packets to MQTT", + label: t("lora.okToMqtt.label"), + description: t("lora.okToMqtt.description"), }, ], }, { - label: "Waveform Settings", - description: "Settings for the LoRa waveform", + label: t("lora.waveformSettings.label"), + description: t("lora.waveformSettings.description"), fields: [ { type: "toggle", name: "usePreset", - label: "Use Preset", - description: "Use one of the predefined modem presets", + label: t("lora.usePreset.label"), + description: t("lora.usePreset.description"), }, { type: "select", name: "modemPreset", - label: "Modem Preset", - description: "Modem preset to use", + label: t("lora.modemPreset.label"), + description: t("lora.modemPreset.description"), disabledBy: [ { fieldName: "usePreset", @@ -94,8 +95,8 @@ export const LoRa = () => { { type: "number", name: "bandwidth", - label: "Bandwidth", - description: "Channel bandwidth in MHz", + label: t("lora.bandwidth.label"), + description: t("lora.bandwidth.description"), disabledBy: [ { fieldName: "usePreset", @@ -103,14 +104,14 @@ export const LoRa = () => { }, ], properties: { - suffix: "MHz", + suffix: t("unit.megahertz"), }, }, { type: "number", name: "spreadFactor", - label: "Spreading Factor", - description: "Indicates the number of chirps per symbol", + label: t("lora.spreadingFactor.label"), + description: t("lora.spreadingFactor.description"), disabledBy: [ { @@ -119,14 +120,14 @@ export const LoRa = () => { }, ], properties: { - suffix: "CPS", + suffix: t("unit.cps"), }, }, { type: "number", name: "codingRate", - label: "Coding Rate", - description: "The denominator of the coding rate", + label: t("lora.codingRate.label"), + description: t("lora.codingRate.description"), disabledBy: [ { fieldName: "usePreset", @@ -137,53 +138,52 @@ export const LoRa = () => { ], }, { - label: "Radio Settings", - description: "Settings for the LoRa radio", + label: t("lora.radioSettings.label"), + description: t("lora.radioSettings.description"), fields: [ { type: "toggle", name: "txEnabled", - label: "Transmit Enabled", - description: "Enable/Disable transmit (TX) from the LoRa radio", + label: t("lora.transmitEnabled.label"), + description: t("lora.transmitEnabled.description"), }, { type: "number", name: "txPower", - label: "Transmit Power", - description: "Max transmit power", + label: t("lora.transmitPower.label"), + description: t("lora.transmitPower.description"), properties: { - suffix: "dBm", + suffix: t("unit.dbm"), }, }, { type: "toggle", name: "overrideDutyCycle", - label: "Override Duty Cycle", - description: "Override Duty Cycle", + label: t("lora.overrideDutyCycle.label"), + description: t("lora.overrideDutyCycle.description"), }, { type: "number", name: "frequencyOffset", - label: "Frequency Offset", - description: - "Frequency offset to correct for crystal calibration errors", + label: t("lora.frequencyOffset.label"), + description: t("lora.frequencyOffset.description"), properties: { - suffix: "Hz", + suffix: t("unit.hertz"), }, }, { type: "toggle", name: "sx126xRxBoostedGain", - label: "Boosted RX Gain", - description: "Boosted RX gain", + label: t("lora.boostedRxGain.label"), + description: t("lora.boostedRxGain.description"), }, { type: "number", name: "overrideFrequency", - label: "Override Frequency", - description: "Override frequency", + label: t("lora.overrideFrequency.label"), + description: t("lora.overrideFrequency.description"), properties: { - suffix: "MHz", + suffix: t("unit.megahertz"), step: 0.001, }, }, diff --git a/src/components/PageComponents/Config/Network/index.tsx b/src/components/PageComponents/Config/Network/index.tsx index defbba97..9bfb2f54 100644 --- a/src/components/PageComponents/Config/Network/index.tsx +++ b/src/components/PageComponents/Config/Network/index.tsx @@ -11,9 +11,11 @@ import { } from "@core/utils/ip.ts"; import { Protobuf } from "@meshtastic/core"; import { validateSchema } from "@app/validation/validate.ts"; +import { useTranslation } from "react-i18next"; export const Network = () => { const { config, setWorkingConfig } = useDevice(); + const { t } = useTranslation("deviceConfig"); const onSubmit = (data: NetworkValidation) => { const result = validateSchema(NetworkValidationSchema, data); @@ -63,22 +65,21 @@ export const Network = () => { }} fieldGroups={[ { - label: "WiFi Config", - description: "WiFi radio configuration", - notes: - "Note: Some devices (ESP32) cannot use both Bluetooth and WiFi at the same time.", + label: t("network.title"), + description: t("network.description"), + notes: t("network.note"), fields: [ { type: "toggle", name: "wifiEnabled", - label: "Enabled", - description: "Enable or disable the WiFi radio", + label: t("network.wifiEnabled.label"), + description: t("network.wifiEnabled.description"), }, { type: "text", name: "wifiSsid", - label: "SSID", - description: "Network name", + label: t("network.ssid.label"), + description: t("network.ssid.label"), disabledBy: [ { fieldName: "wifiEnabled", @@ -88,8 +89,8 @@ export const Network = () => { { type: "password", name: "wifiPsk", - label: "PSK", - description: "Network password", + label: t("network.psk.label"), + description: t("network.psk.description"), disabledBy: [ { fieldName: "wifiEnabled", @@ -99,26 +100,26 @@ export const Network = () => { ], }, { - label: "Ethernet Config", - description: "Ethernet port configuration", + label: t("network.ethernetConfigSettings.label"), + description: t("network.ethernetConfigSettings.description"), fields: [ { type: "toggle", name: "ethEnabled", - label: "Enabled", - description: "Enable or disable the Ethernet port", + label: t("network.ethernetEnabled.label"), + description: t("network.ethernetEnabled.description"), }, ], }, { - label: "IP Config", - description: "IP configuration", + label: t("network.ipConfigSettings.label"), + description: t("network.ipConfigSettings.description"), fields: [ { type: "select", name: "addressMode", - label: "Address Mode", - description: "Address assignment selection", + label: t("network.addressMode.label"), + description: t("network.addressMode.description"), properties: { enumValue: Protobuf.Config.Config_NetworkConfig_AddressMode, }, @@ -126,8 +127,8 @@ export const Network = () => { { type: "text", name: "ipv4Config.ip", - label: "IP", - description: "IP Address", + label: t("network.ip.label"), + description: t("network.ip.description"), disabledBy: [ { fieldName: "addressMode", @@ -139,8 +140,8 @@ export const Network = () => { { type: "text", name: "ipv4Config.gateway", - label: "Gateway", - description: "Default Gateway", + label: t("network.gateway.label"), + description: t("network.gateway.description"), disabledBy: [ { fieldName: "addressMode", @@ -152,8 +153,8 @@ export const Network = () => { { type: "text", name: "ipv4Config.subnet", - label: "Subnet", - description: "Subnet Mask", + label: t("network.subnet.label"), + description: t("network.subnet.description"), disabledBy: [ { fieldName: "addressMode", @@ -165,8 +166,8 @@ export const Network = () => { { type: "text", name: "ipv4Config.dns", - label: "DNS", - description: "DNS Server", + label: t("network.dns.label"), + description: t("network.dns.description"), disabledBy: [ { fieldName: "addressMode", @@ -178,13 +179,13 @@ export const Network = () => { ], }, { - label: "UDP Config", - description: "UDP over Mesh configuration", + label: t("network.udpConfigSettings.label"), + description: t("network.udpConfigSettings.description"), fields: [ { type: "select", name: "enabledProtocols", - label: "Mesh via UDP", + label: t("network.meshViaUdp.label"), properties: { enumValue: Protobuf.Config.Config_NetworkConfig_ProtocolFlags, formatEnumName: true, @@ -193,24 +194,24 @@ export const Network = () => { ], }, { - label: "NTP Config", - description: "NTP configuration", + label: t("network.ntpConfigSettings.label"), + description: t("network.ntpConfigSettings.description"), fields: [ { type: "text", name: "ntpServer", - label: "NTP Server", + label: t("network.ntpServer.label"), }, ], }, { - label: "Rsyslog Config", - description: "Rsyslog configuration", + label: t("network.rsyslogConfigSettings.label"), + description: t("network.rsyslogConfigSettings.description"), fields: [ { type: "text", name: "rsyslogServer", - label: "Rsyslog Server", + label: t("network.rsyslogServer.label"), }, ], }, diff --git a/src/components/PageComponents/Config/Position.tsx b/src/components/PageComponents/Config/Position.tsx index 3792b9e8..78841477 100644 --- a/src/components/PageComponents/Config/Position.tsx +++ b/src/components/PageComponents/Config/Position.tsx @@ -8,12 +8,14 @@ import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; import { useCallback } from "react"; +import { useTranslation } from "react-i18next"; export const Position = () => { const { config, setWorkingConfig } = useDevice(); const { flagsValue, activeFlags, toggleFlag, getAllFlags } = usePositionFlags( config?.position?.positionFlags ?? 0, ); + const { t } = useTranslation("deviceConfig"); const onSubmit = (data: PositionValidation) => { return setWorkingConfig( @@ -42,22 +44,20 @@ export const Position = () => { defaultValues={config.position} fieldGroups={[ { - label: "Position Settings", - description: "Settings for the position module", + label: t("position.title"), + description: t("position.description"), fields: [ { type: "toggle", name: "positionBroadcastSmartEnabled", - label: "Enable Smart Position", - description: - "Only send position when there has been a meaningful change in location", + label: t("position.smartPositionEnabled.label"), + description: t("position.smartPositionEnabled.description"), }, { type: "select", name: "gpsMode", - label: "GPS Mode", - description: - "Configure whether device GPS is Enabled, Disabled, or Not Present", + label: t("position.gpsMode.label"), + description: t("position.gpsMode.description"), properties: { enumValue: Protobuf.Config.Config_PositionConfig_GpsMode, }, @@ -65,9 +65,8 @@ export const Position = () => { { type: "toggle", name: "fixedPosition", - label: "Fixed Position", - description: - "Don't report GPS position, but a manually-specified one", + label: t("position.fixedPosition.label"), + description: t("position.fixedPosition.description"), }, { type: "multiSelect", @@ -76,10 +75,9 @@ export const Position = () => { isChecked: (name: string) => activeFlags?.includes(name as FlagName) ?? false, onValueChange: onPositonFlagChange, - label: "Position Flags", - placeholder: "Select position flags...", - description: - "Optional fields to include when assembling position messages. The more fields are selected, the larger the message will be leading to longer airtime usage and a higher risk of packet loss.", + label: t("position.positionFlags.label"), + placeholder: t("position.flags.placeholder"), + description: t("position.positionFlags.description"), properties: { enumValue: getAllFlags(), }, @@ -87,51 +85,50 @@ export const Position = () => { { type: "number", name: "rxGpio", - label: "Receive Pin", - description: "GPS module RX pin override", + label: t("position.receivePin.label"), + description: t("position.receivePin.description"), }, { type: "number", name: "txGpio", - label: "Transmit Pin", - description: "GPS module TX pin override", + label: t("position.transmitPin.label"), + description: t("position.transmitPin.description"), }, { type: "number", name: "gpsEnGpio", - label: "Enable Pin", - description: "GPS module enable pin override", + label: t("position.enablePin.label"), + description: t("position.enablePin.description"), }, ], }, { - label: "Intervals", - description: "How often to send position updates", + label: t("position.intervalsSettings.label"), + description: t("position.intervalsSettings.description"), fields: [ { type: "number", name: "positionBroadcastSecs", - label: "Broadcast Interval", - description: "How often your position is sent out over the mesh", + label: t("position.broadcastInterval.label"), + description: t("position.broadcastInterval.description"), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, }, { type: "number", name: "gpsUpdateInterval", - label: "GPS Update Interval", - description: "How often a GPS fix should be acquired", + label: t("position.gpsUpdateInterval.label"), + description: t("position.gpsUpdateInterval.description"), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, }, { type: "number", name: "broadcastSmartMinimumDistance", - label: "Smart Position Minimum Distance", - description: - "Minimum distance (in meters) that must be traveled before a position update is sent", + label: t("position.smartPositionMinDistance.label"), + description: t("position.smartPositionMinDistance.description"), disabledBy: [ { fieldName: "positionBroadcastSmartEnabled", @@ -141,9 +138,8 @@ export const Position = () => { { type: "number", name: "broadcastSmartMinimumIntervalSecs", - label: "Smart Position Minimum Interval", - description: - "Minimum interval (in seconds) that must pass before a position update is sent", + label: t("position.smartPositionMinInterval.label"), + description: t("position.smartPositionMinInterval.description"), disabledBy: [ { fieldName: "positionBroadcastSmartEnabled", diff --git a/src/components/PageComponents/Config/Power.tsx b/src/components/PageComponents/Config/Power.tsx index cd88eafb..5044278e 100644 --- a/src/components/PageComponents/Config/Power.tsx +++ b/src/components/PageComponents/Config/Power.tsx @@ -1,11 +1,13 @@ -import type { PowerValidation } from "@app/validation/config/power.tsx"; +import type { PowerValidation } from "@app/validation/config/power.ts"; import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; +import { useTranslation } from "react-i18next"; export const Power = () => { const { config, setWorkingConfig } = useDevice(); + const { t } = useTranslation("deviceConfig"); const onSubmit = (data: PowerValidation) => { setWorkingConfig( @@ -24,31 +26,29 @@ export const Power = () => { defaultValues={config.power} fieldGroups={[ { - label: "Power Config", - description: "Settings for the power module", + label: t("power.powerConfigSettings.label"), + description: t("power.powerConfigSettings.description"), fields: [ { type: "toggle", name: "isPowerSaving", - label: "Enable power saving mode", - description: - "Select if powered from a low-current source (i.e. solar), to minimize power consumption as much as possible.", + label: t("power.powerSavingEnabled.label"), + description: t("power.powerSavingEnabled.description"), }, { type: "number", name: "onBatteryShutdownAfterSecs", - label: "Shutdown on battery delay", - description: - "Automatically shutdown node after this long when on battery, 0 for indefinite", + label: t("power.shutdownOnBatteryDelay.label"), + description: t("power.shutdownOnBatteryDelay.description"), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, }, { type: "number", name: "adcMultiplierOverride", - label: "ADC Multiplier Override ratio", - description: "Used for tweaking battery voltage reading", + label: t("power.adcMultiplierOverride.label"), + description: t("power.adcMultiplierOverride.description"), properties: { step: 0.0001, }, @@ -56,52 +56,49 @@ export const Power = () => { { type: "number", name: "waitBluetoothSecs", - label: "No Connection Bluetooth Disabled", - description: - "If the device does not receive a Bluetooth connection, the BLE radio will be disabled after this long", + label: t("power.noConnectionBluetoothDisabled.label"), + description: t("power.noConnectionBluetoothDisabled.description"), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, }, { type: "number", name: "deviceBatteryInaAddress", - label: "INA219 Address", - description: "Address of the INA219 battery monitor", + label: t("power.ina219Address.label"), + description: t("power.ina219Address.description"), }, ], }, { - label: "Sleep Settings", - description: "Sleep settings for the power module", + label: t("power.sleepSettings.label"), + description: t("power.sleepSettings.description"), fields: [ { type: "number", name: "sdsSecs", - label: "Super Deep Sleep Duration", - description: - "How long the device will be in super deep sleep for", + label: t("power.superDeepSleepDuration.label"), + description: t("power.superDeepSleepDuration.description"), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, }, { type: "number", name: "lsSecs", - label: "Light Sleep Duration", - description: "How long the device will be in light sleep for", + label: t("power.lightSleepDuration.label"), + description: t("power.lightSleepDuration.description"), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, }, { type: "number", name: "minWakeSecs", - label: "Minimum Wake Time", - description: - "Minimum amount of time the device will stay awake for after receiving a packet", + label: t("power.minimumWakeTime.label"), + description: t("power.minimumWakeTime.description"), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, }, ], diff --git a/src/components/PageComponents/Config/Security/Security.tsx b/src/components/PageComponents/Config/Security/Security.tsx index 263da557..533e0d84 100644 --- a/src/components/PageComponents/Config/Security/Security.tsx +++ b/src/components/PageComponents/Config/Security/Security.tsx @@ -10,6 +10,7 @@ import { fromByteArray, toByteArray } from "base64-js"; import { useReducer } from "react"; import { securityReducer } from "@components/PageComponents/Config/Security/securityReducer.tsx"; import type { SecurityConfigInit } from "./types.ts"; +import { useTranslation } from "react-i18next"; export const Security = () => { const { config, setWorkingConfig, setDialogOpen } = useDevice(); @@ -21,6 +22,7 @@ export const Security = () => { removeError, clearErrors, } = useAppStore(); + const { t } = useTranslation("deviceConfig"); const [state, dispatch] = useReducer(securityReducer, { privateKey: fromByteArray(config.security?.privateKey ?? new Uint8Array(0)), @@ -50,20 +52,18 @@ export const Security = () => { try { removeError(fieldNameKey); if (fieldName === "privateKey" && input === "") { - addError(fieldNameKey, "Private Key is required"); + addError(fieldNameKey, t("security.validation.privateKeyRequired")); return; } if (fieldName === "adminKey" && input === "") { if ( - state.isManaged && state.adminKey - .map((v, i) => i === fieldIndex ? input : v) + state.isManaged && + state.adminKey + .map((v, i) => (i === fieldIndex ? input : v)) .every((s) => s === "") ) { - addError( - "adminKey0", - "At least one admin key is requred if the node is managed.", - ); + addError("adminKey0", t("security.")); } return; @@ -72,32 +72,35 @@ export const Security = () => { if (input.length % 4 !== 0) { addError( fieldNameKey, - `${ - fieldName === "privateKey" ? "Private" : "Admin" - } Key is required to be a 256 bit pre-shared key (PSK)`, + fieldName === "privateKey" + ? t("security.validation.privateKeyMustBe256BitPsk") + : t("security.validation.adminKeyMustBe256BitPsk"), ); return; } const decoded = toByteArray(input); if (decoded.length !== count) { - addError(fieldNameKey, `Please enter a valid ${count * 8} bit PSK`); + addError( + fieldNameKey, + t("security.validation.enterValid256BitPsk", { + bits: count * 8, + }), + ); return; } } catch (e) { console.error(e); addError( fieldNameKey, - `Invalid ${ - fieldName === "privateKey" ? "Private" : "Admin" - } Key format`, + fieldName === "privateKey" + ? t("security.validation.invalidPrivateKeyFormat") + : t("security.validation.invalidAdminKeyFormat"), ); } }; - function setSecurityPayload( - overrides: SecurityConfigInit, - ) { + function setSecurityPayload(overrides: SecurityConfigInit) { const base: SecurityConfigInit = { isManaged: state.isManaged, adminChannelEnabled: state.adminChannelEnabled, @@ -204,13 +207,12 @@ export const Security = () => { ) => { dispatch({ type: "SET_TOGGLE", field, payload: next }); - if ( - field === "isManaged" && state.adminKey.every((s) => s === "") - ) { + if (field === "isManaged" && state.adminKey.every((s) => s === "")) { if (next) { + // If enabling 'managed' and no admin keys are set addError( "adminKey0", - "At least one admin key is requred if the node is managed.", + t("security.validation.adminKeyRequiredWhenManaged"), ); } else { removeError("adminKey0"); @@ -252,16 +254,22 @@ export const Security = () => { }} fieldGroups={[ { - label: "Security Settings", - description: "Settings for the Security configuration", + label: t("security.title"), + description: t("security.description"), fields: [ { type: "passwordGenerator", id: "pskInput", name: "privateKey", - label: "Private Key", - description: "Used to create a shared key with a remote device", - bits: [{ text: "256 bit", value: "32", key: "bit256" }], + label: t("security.privateKey.label"), + description: t("security.privateKey.description"), + bits: [ + { + text: t("security.256bit"), + value: "32", + key: "bit256", + }, + ], validationText: hasFieldError("privateKey") ? getErrorMessage("privateKey") : "", @@ -271,7 +279,7 @@ export const Security = () => { hide: !state.privateKeyVisible, actionButtons: [ { - text: "Generate", + text: t("button.generate"), onClick: () => dispatch({ type: "SHOW_PRIVATE_KEY_DIALOG", @@ -280,7 +288,7 @@ export const Security = () => { variant: "success", }, { - text: "Backup Key", + text: t("button.backupKey"), onClick: () => setDialogOpen("pkiBackup", true), variant: "subtle", }, @@ -294,10 +302,9 @@ export const Security = () => { { type: "text", name: "publicKey", - label: "Public Key", + label: t("security.publicKey.label"), disabled: true, - description: - "Sent out to other nodes on the mesh to allow them to compute a shared secret key", + description: t("security.publicKey.description"), properties: { value: state.publicKey, showCopyButton: true, @@ -306,22 +313,27 @@ export const Security = () => { ], }, { - label: "Admin Settings", - description: "Settings for Admin", + label: t("security.adminSettings.label"), + description: t("security.adminSettings.description"), fields: [ { type: "passwordGenerator", name: "adminKey.0", id: "adminKey0Input", - label: "Primary Admin Key", - description: - "The primary public key authorized to send admin messages to this node", + label: t("security.primaryAdminKey.label"), + description: t("security.primaryAdminKey.description"), validationText: hasFieldError("adminKey0") ? getErrorMessage("adminKey0") : "", inputChange: (e) => adminKeyInputChangeEvent(e, 0), selectChange: () => {}, - bits: [{ text: "256 bit", value: "32", key: "bit256" }], + bits: [ + { + text: t("security.256bit"), + value: "32", + key: "bit256", + }, + ], devicePSKBitCount: state.privateKeyBitCount, hide: !state.adminKeyVisible[0], actionButtons: [], @@ -338,15 +350,20 @@ export const Security = () => { type: "passwordGenerator", name: "adminKey.1", id: "adminKey1Input", - label: "Secondary Admin Key", - description: - "The secondary public key authorized to send admin messages to this node", + label: t("security.secondaryAdminKey.label"), + description: t("security.secondaryAdminKey.description"), validationText: hasFieldError("adminKey1") ? getErrorMessage("adminKey1") : "", inputChange: (e) => adminKeyInputChangeEvent(e, 1), selectChange: () => {}, - bits: [{ text: "256 bit", value: "32", key: "bit256" }], + bits: [ + { + text: t("security.256bit"), + value: "32", + key: "bit256", + }, + ], devicePSKBitCount: state.privateKeyBitCount, hide: !state.adminKeyVisible[1], actionButtons: [], @@ -363,15 +380,20 @@ export const Security = () => { type: "passwordGenerator", name: "adminKey.2", id: "adminKey2Input", - label: "Tertiary Admin Key", - description: - "The tertiary public key authorized to send admin messages to this node", + label: t("security.tertiaryAdminKey.label"), + description: t("security.tertiaryAdminKey.description"), validationText: hasFieldError("adminKey2") ? getErrorMessage("adminKey2") : "", inputChange: (e) => adminKeyInputChangeEvent(e, 2), selectChange: () => {}, - bits: [{ text: "256 bit", value: "32", key: "bit256" }], + bits: [ + { + text: t("security.256bit"), + value: "32", + key: "bit256", + }, + ], devicePSKBitCount: state.privateKeyBitCount, hide: !state.adminKeyVisible[2], actionButtons: [], @@ -387,26 +409,22 @@ export const Security = () => { { type: "toggle", name: "isManaged", - label: "Managed", - description: - "If enabled, device configuration options are only able to be changed remotely by a Remote Admin node via admin messages. Do not enable this option unless at least one suitable Remote Admin node has been setup, and the public key is stored in one of the fields above.", + label: t("security.managed.label"), + description: t("security.managed.description"), inputChange: (e: boolean) => onToggleChange("isManaged", e), properties: { checked: state.isManaged, }, - disabled: ( - (hasFieldError("adminKey0") || - hasFieldError("adminKey1") || - hasFieldError("adminKey2")) && - !state.adminKey.every((s) => s === "") - ), + disabled: (hasFieldError("adminKey0") || + hasFieldError("adminKey1") || + hasFieldError("adminKey2")) && + !state.adminKey.every((s) => s === ""), }, { type: "toggle", name: "adminChannelEnabled", - label: "Allow Legacy Admin", - description: - "Allow incoming device control over the insecure legacy admin channel", + label: t("security.adminChannelEnabled.label"), + description: t("security.adminChannelEnabled.description"), inputChange: (e: boolean) => onToggleChange("adminChannelEnabled", e), properties: { @@ -416,15 +434,14 @@ export const Security = () => { ], }, { - label: "Logging Settings", - description: "Settings for Logging", + label: t("security.loggingSettings.label"), + description: t("security.loggingSettings.description"), fields: [ { type: "toggle", name: "debugLogApiEnabled", - label: "Enable Debug Log API", - description: - "Output live debug logging over serial, view and export position-redacted device logs over Bluetooth", + label: t("security.enableDebugLogApi.label"), + description: t("security.enableDebugLogApi.description"), inputChange: (e: boolean) => onToggleChange("debugLogApiEnabled", e), properties: { @@ -434,8 +451,8 @@ export const Security = () => { { type: "toggle", name: "serialEnabled", - label: "Serial Output Enabled", - description: "Serial Console over the Stream API", + label: t("security.serialOutputEnabled.label"), + description: t("security.serialOutputEnabled.description"), inputChange: (e: boolean) => onToggleChange("serialEnabled", e), properties: { checked: state.serialEnabled, @@ -447,9 +464,9 @@ export const Security = () => { /> diff --git a/src/components/PageComponents/Connect/BLE.tsx b/src/components/PageComponents/Connect/BLE.tsx index 5abd907d..44aa508b 100644 --- a/src/components/PageComponents/Connect/BLE.tsx +++ b/src/components/PageComponents/Connect/BLE.tsx @@ -8,6 +8,7 @@ import { randId } from "@core/utils/randId.ts"; import { BleConnection, ServiceUuid } from "@meshtastic/js"; import { useCallback, useEffect, useState } from "react"; import { useMessageStore } from "../../../core/stores/messageStore/index.ts"; +import { useTranslation } from "react-i18next"; export const BLE = ( { closeDialog }: TabElementProps, @@ -17,6 +18,7 @@ export const BLE = ( const { addDevice } = useDeviceStore(); const messageStore = useMessageStore(); const { setSelectedDevice } = useAppStore(); + const { t } = useTranslation(); const updateBleDeviceList = useCallback(async (): Promise => { setBleDevices(await navigator.bluetooth.getDevices()); @@ -59,7 +61,9 @@ export const BLE = ( ))} {bleDevices.length === 0 && ( - No devices paired yet. + + {t("newDeviceDialog.bluetoothConnection.noDevicesPaired")} + )}
); diff --git a/src/components/PageComponents/Connect/HTTP.tsx b/src/components/PageComponents/Connect/HTTP.tsx index 2988a866..e1bca177 100644 --- a/src/components/PageComponents/Connect/HTTP.tsx +++ b/src/components/PageComponents/Connect/HTTP.tsx @@ -13,7 +13,8 @@ import { TransportHTTP } from "@meshtastic/transport-http"; import { useState } from "react"; import { useController, useForm } from "react-hook-form"; import { AlertTriangle } from "lucide-react"; -import { useMessageStore } from "../../../core/stores/messageStore/index.ts"; +import { useMessageStore } from "@core/stores/messageStore/index.ts"; +import { useTranslation } from "react-i18next"; interface FormData { ip: string; @@ -23,6 +24,7 @@ interface FormData { export const HTTP = ( { closeDialog }: TabElementProps, ) => { + const { t } = useTranslation("dialog"); const [connectionInProgress, setConnectionInProgress] = useState(false); const isURLHTTPS = location.protocol === "https:"; @@ -79,22 +81,24 @@ export const HTTP = ( disabled={connectionInProgress} >
- +
-
+
- +
{connectionError && ( @@ -106,30 +110,38 @@ export const HTTP = ( />

- Connection Failed + {t("newDeviceDialog.connectionFailedAlert.title")}

- Could not connect to the device. {connectionError.secure && - "If using HTTPS, you may need to accept a self-signed certificate first. "} - Please open{" "} + {t("newDeviceDialog.connectionFailedAlert.descriptionPrefix")} + {connectionError.secure && + t("newDeviceDialog.connectionFailedAlert.httpsHint")} + {t("newDeviceDialog.connectionFailedAlert.openLinkPrefix")} {`${ - connectionError.secure ? "https" : "http" + connectionError.secure + ? t("newDeviceDialog.https") + : t("newDeviceDialog.http") }://${connectionError.host}`} {" "} - in a new tab{connectionError.secure - ? ", accept any TLS warnings if prompted, then try again" + {t("newDeviceDialog.connectionFailedAlert.openLinkSuffix")} + {connectionError.secure + ? t( + "newDeviceDialog.connectionFailedAlert.acceptTlsWarningSuffix", + ) : ""}.{" "} - Learn more + {t("newDeviceDialog.connectionFailedAlert.learnMoreLink")}

@@ -141,7 +153,11 @@ export const HTTP = ( type="submit" variant="default" > - {connectionInProgress ? "Connecting..." : "Connect"} + + {connectionInProgress + ? t("newDeviceDialog.connecting") + : t("newDeviceDialog.connect")} + ); diff --git a/src/components/PageComponents/Connect/Serial.tsx b/src/components/PageComponents/Connect/Serial.tsx index f388870a..ff92c1e1 100644 --- a/src/components/PageComponents/Connect/Serial.tsx +++ b/src/components/PageComponents/Connect/Serial.tsx @@ -8,6 +8,7 @@ import { randId } from "@core/utils/randId.ts"; import { MeshDevice } from "@meshtastic/core"; import { TransportWebSerial } from "@meshtastic/transport-web-serial"; import { useCallback, useEffect, useState } from "react"; +import { useTranslation } from "react-i18next"; import { useMessageStore } from "../../../core/stores/messageStore/index.ts"; export const Serial = ( @@ -18,6 +19,7 @@ export const Serial = ( const { addDevice } = useDeviceStore(); const messageStore = useMessageStore(); const { setSelectedDevice } = useAppStore(); + const { t } = useTranslation(); const updateSerialPortList = useCallback(async () => { setSerialPorts(await navigator?.serial.getPorts()); @@ -54,24 +56,31 @@ export const Serial = (
{serialPorts.map((port, index) => { const { usbProductId, usbVendorId } = port.getInfo(); + const vendor = usbVendorId ?? t("unknown.shortName"); + const product = usbProductId ?? t("unknown.shortName"); return ( ); })} {serialPorts.length === 0 && ( - No devices paired yet. + + {t("newDeviceDialog.serialConnection.noDevicesPaired")} + )}
); diff --git a/src/components/PageComponents/Map/NodeDetail.tsx b/src/components/PageComponents/Map/NodeDetail.tsx index 91efd128..12dbe987 100644 --- a/src/components/PageComponents/Map/NodeDetail.tsx +++ b/src/components/PageComponents/Map/NodeDetail.tsx @@ -26,8 +26,9 @@ import { useDevice } from "@core/stores/deviceStore.ts"; import { MessageType, useMessageStore, -} from "../../../core/stores/messageStore/index.ts"; +} from "@core/stores/messageStore/index.ts"; import BatteryStatus from "@components/BatteryStatus.tsx"; +import { useTranslation } from "react-i18next"; export interface NodeDetailProps { node: ProtobufType.Mesh.NodeInfo; @@ -35,13 +36,19 @@ export interface NodeDetailProps { export const NodeDetail = ({ node }: NodeDetailProps) => { const { setChatType, setActiveChat } = useMessageStore(); + const { t } = useTranslation("nodes"); const { setActivePage } = useDevice(); - const name = node.user?.longName ?? `UNK`; - const shortName = node.user?.shortName ?? "UNK"; + const name = node.user?.longName ?? t("unknown.shortName"); + const shortName = node.user?.shortName ?? t("unknown.shortName"); const hwModel = node.user?.hwModel ?? 0; - const hardwareType = - Protobuf.Mesh.HardwareModel[hwModel]?.replaceAll("_", " ") ?? `${hwModel}`; - + const rawHardwareType = Protobuf.Mesh.HardwareModel[hwModel] as + | keyof typeof Protobuf.Mesh.HardwareModel + | undefined; + const hardwareType = rawHardwareType + ? rawHardwareType === "UNSET" + ? t("unset") + : rawHardwareType.replaceAll("_", " ") + : `${hwModel}`; function handleDirectMessage() { setChatType(MessageType.Direct); setActiveChat(node.num); @@ -66,7 +73,7 @@ export const NodeDetail = ({ node }: NodeDetailProps) => { className="text-green-600 mb-1.5" size={12} strokeWidth={3} - aria-label="Public Key Enabled" + aria-label={t("node_detail_public_key_enabled_aria_label")} /> ) : ( @@ -74,7 +81,7 @@ export const NodeDetail = ({ node }: NodeDetailProps) => { className="text-yellow-500 mb-1.5" size={12} strokeWidth={3} - aria-label="No Public Key" + aria-label={t("node_detail_no_public_key_aria_label")} /> )} @@ -94,7 +101,9 @@ export const NodeDetail = ({ node }: NodeDetailProps) => { align="center" sideOffset={5} > - Direct Message {shortName} + {t("nodeDetail.directMessage.label", { + shortName, + })} @@ -103,15 +112,16 @@ export const NodeDetail = ({ node }: NodeDetailProps) => {
{name} - - {hardwareType !== "UNSET" && {hardwareType}} + {hardwareType !== t("unset") && {hardwareType}} {!!node.deviceMetrics?.batteryLevel && ( @@ -131,13 +141,14 @@ export const NodeDetail = ({ node }: NodeDetailProps) => {
{node.lastHeard > 0 && (
- Heard + {t("nodeDetail.status.heard")}{" "} +
)}
{node.viaMqtt && (
- MQTT + {t("nodeDetail.status.mqtt")}
)}
@@ -149,21 +160,25 @@ export const NodeDetail = ({ node }: NodeDetailProps) => {
- {Number.isNaN(node.hopsAway) ? "?" : node.hopsAway} + {Number.isNaN(node.hopsAway) + ? t("unit.hopsAway.unknown") + : node.hopsAway} +
+
+ {node.hopsAway === 1 ? t("unit.hops.one") : t("unit.hop.plural")}
-
{node.hopsAway === 1 ? "Hop" : "Hops"}
{node.position?.altitude && (
{formatQuantity(node.position?.altitude, { - one: "meter", - other: "meters", + one: t("unit.meter.one"), + other: t("unit.meter.plural"), })}
@@ -173,7 +188,7 @@ export const NodeDetail = ({ node }: NodeDetailProps) => {
{!!node.deviceMetrics?.channelUtilization && (
-
Channel Util
+
{t("nodeDetail.channelUtilization")}
{node.deviceMetrics?.channelUtilization.toPrecision(3)}% @@ -181,7 +196,7 @@ export const NodeDetail = ({ node }: NodeDetailProps) => { )} {!!node.deviceMetrics?.airUtilTx && (
-
Airtime Util
+
{t("nodeDetail.airTxUtilization")}
{node.deviceMetrics?.airUtilTx.toPrecision(3)}% @@ -191,13 +206,15 @@ export const NodeDetail = ({ node }: NodeDetailProps) => { {node.snr !== 0 && (
-
SNR
+
{t("unit.snr")}
- {node.snr}db + {node.snr} + {t("unit.dbm")} {Math.min(Math.max((node.snr + 10) * 5, 0), 100)}% - {(node.snr + 10) * 5}raw + {(node.snr + 10) * 5} + {t("unit.raw")}
)} diff --git a/src/components/PageComponents/Messages/ChannelChat.tsx b/src/components/PageComponents/Messages/ChannelChat.tsx index a929e166..2a326259 100644 --- a/src/components/PageComponents/Messages/ChannelChat.tsx +++ b/src/components/PageComponents/Messages/ChannelChat.tsx @@ -1,17 +1,21 @@ import { MessageItem } from "@components/PageComponents/Messages/MessageItem.tsx"; import { InboxIcon } from "lucide-react"; import { Message } from "@core/stores/messageStore/types.ts"; +import { useTranslation } from "react-i18next"; export interface ChannelChatProps { messages?: Message[]; } -const EmptyState = () => ( -
- - No Messages -
-); +const EmptyState = () => { + const { t } = useTranslation("messages"); + return ( +
+ + {t("emptyState.text")} +
+ ); +}; export const ChannelChat = ({ messages = [] }: ChannelChatProps) => { if (!messages?.length) { diff --git a/src/components/PageComponents/Messages/MessageActionsMenu.tsx b/src/components/PageComponents/Messages/MessageActionsMenu.tsx index 777128aa..35e1cdf2 100644 --- a/src/components/PageComponents/Messages/MessageActionsMenu.tsx +++ b/src/components/PageComponents/Messages/MessageActionsMenu.tsx @@ -7,6 +7,7 @@ import { } from "@components/UI/Tooltip.tsx"; import { cn } from "@core/utils/cn.ts"; import { Reply, SmilePlus } from "lucide-react"; +import { useTranslation } from "react-i18next"; interface MessageActionsMenuProps { onAddReaction?: () => void; @@ -17,6 +18,7 @@ export const MessageActionsMenu = ({ onAddReaction, onReply, }: MessageActionsMenuProps) => { + const { t } = useTranslation(); const hoverIconBarClass = cn( "absolute top-2 right-2", "flex items-center gap-x-1", @@ -48,7 +50,7 @@ export const MessageActionsMenu = ({ - Add Reaction + {t("messages_actionsMenu_addReactionLabel")} @@ -70,7 +72,7 @@ export const MessageActionsMenu = ({ - Reply + {t("messages_actionsMenu_replyLabel")} diff --git a/src/components/PageComponents/Messages/MessageItem.tsx b/src/components/PageComponents/Messages/MessageItem.tsx index 1892c057..e431522f 100644 --- a/src/components/PageComponents/Messages/MessageItem.tsx +++ b/src/components/PageComponents/Messages/MessageItem.tsx @@ -17,6 +17,7 @@ import { } from "@core/stores/messageStore/index.ts"; import { Protobuf, Types } from "@meshtastic/js"; import { Message } from "@core/stores/messageStore/types.ts"; +import { useTranslation } from "react-i18next"; // import { MessageActionsMenu } from "@components/PageComponents/Messages/MessageActionsMenu.tsx"; // Uncomment if needed later interface MessageStatusInfo { @@ -26,37 +27,6 @@ interface MessageStatusInfo { iconClassName?: string; } -const MESSAGE_STATUS_MAP: Record = { - [MessageState.Ack]: { - displayText: "Message delivered", - icon: CheckCircle2, - ariaLabel: "Message delivered", - iconClassName: "text-green-500", - }, - [MessageState.Waiting]: { - displayText: "Waiting for delivery", - icon: CircleEllipsis, - ariaLabel: "Sending message", - iconClassName: "text-slate-400", - }, - [MessageState.Failed]: { - displayText: "Delivery failed", - icon: AlertCircle, - ariaLabel: "Message delivery failed", - iconClassName: "text-red-500 dark:text-red-400", - }, -}; - -const UNKNOWN_STATUS: MessageStatusInfo = { - displayText: "Unknown state", - icon: AlertCircle, - ariaLabel: "Message status unknown", - iconClassName: "text-red-500 dark:text-red-400", -}; - -const getMessageStatusInfo = (state: MessageState): MessageStatusInfo => - MESSAGE_STATUS_MAP[state] ?? UNKNOWN_STATUS; - const StatusTooltip = ( { statusInfo, children }: { statusInfo: MessageStatusInfo; @@ -81,16 +51,55 @@ interface MessageItemProps { export const MessageItem = ({ message }: MessageItemProps) => { const { getNode } = useDevice(); const { getMyNodeNum } = useMessageStore(); + const { t, i18n } = useTranslation(); + + const MESSAGE_STATUS_MAP = useMemo( + (): Record => ({ + [MessageState.Ack]: { + displayText: t("message_item_status_delivered_displayText"), + icon: CheckCircle2, + ariaLabel: t("message_item_status_delivered_ariaLabel"), + iconClassName: "text-green-500", + }, + [MessageState.Waiting]: { + displayText: t("message_item_status_waiting_displayText"), + icon: CircleEllipsis, + ariaLabel: t("message_item_status_waiting_ariaLabel"), + iconClassName: "text-slate-400", + }, + [MessageState.Failed]: { + displayText: t("message_item_status_failed_displayText"), + icon: AlertCircle, + ariaLabel: t("message_item_status_failed_ariaLabel"), + iconClassName: "text-red-500 dark:text-red-400", + }, + }), + [t], + ); + + const UNKNOWN_STATUS = useMemo((): MessageStatusInfo => ({ + displayText: t("message_item_status_unknown_displayText"), + icon: AlertCircle, + ariaLabel: t("message_item_status_unknown_ariaLabel"), + iconClassName: "text-red-500 dark:text-red-400", + }), [t]); + + const getMessageStatusInfo = useMemo( + () => (state: MessageState): MessageStatusInfo => + MESSAGE_STATUS_MAP[state] ?? UNKNOWN_STATUS, + [MESSAGE_STATUS_MAP, UNKNOWN_STATUS], + ); const messageUser: Protobuf.Mesh.NodeInfo | null | undefined = useMemo(() => { return message.from != null ? getNode(message.from) : null; }, [getNode, message.from]); const myNodeNum = useMemo(() => getMyNodeNum(), [getMyNodeNum]); + const { displayName, shortName, isFavorite } = useMemo(() => { const userIdHex = message.from.toString(16).toUpperCase().padStart(2, "0"); const last4 = userIdHex.slice(-4); - const fallbackName = `Meshtastic ${last4}`; + const fallbackName = t("message_item_fallbackName_withLastFour", { last4 }); const longName = messageUser?.user?.longName; const derivedShortName = messageUser?.user?.shortName || fallbackName; const derivedDisplayName = longName || derivedShortName; @@ -101,7 +110,7 @@ export const MessageItem = ({ message }: MessageItemProps) => { shortName: derivedShortName, isFavorite: isFavorite, }; - }, [messageUser, message.from]); + }, [messageUser, message.from, t, myNodeNum]); const messageStatusInfo = getMessageStatusInfo(message.state); const StatusIconComponent = messageStatusInfo.icon; @@ -110,7 +119,7 @@ export const MessageItem = ({ message }: MessageItemProps) => { () => message.date ? new Date(message.date) : null, [message.date], ); - const locale = "en-US"; // TODO: Make dynamic via props or context + const locale = i18n.language; const formattedTime = useMemo( () => diff --git a/src/components/PageComponents/Messages/TraceRoute.test.tsx b/src/components/PageComponents/Messages/TraceRoute.test.tsx index c3b8591c..cfd9dc6a 100644 --- a/src/components/PageComponents/Messages/TraceRoute.test.tsx +++ b/src/components/PageComponents/Messages/TraceRoute.test.tsx @@ -48,9 +48,9 @@ describe("TraceRoute", () => { expect(screen.getByText("Node B")).toBeInTheDocument(); expect(screen.getAllByText(/↓/)).toHaveLength(3); - expect(screen.getByText("↓ 10dB")).toBeInTheDocument(); - expect(screen.getByText("↓ 20dB")).toBeInTheDocument(); - expect(screen.getByText("↓ 30dB")).toBeInTheDocument(); + expect(screen.getByText("↓ 10dBm")).toBeInTheDocument(); + expect(screen.getByText("↓ 20dBm")).toBeInTheDocument(); + expect(screen.getByText("↓ 30dBm")).toBeInTheDocument(); }); it("renders the route back when provided", () => { @@ -74,11 +74,11 @@ describe("TraceRoute", () => { expect(screen.getByText("Node C")).toBeInTheDocument(); expect(screen.getByText("Node A")).toBeInTheDocument(); - expect(screen.getByText("↓ 35dB")).toBeInTheDocument(); - expect(screen.getByText("↓ 45dB")).toBeInTheDocument(); + expect(screen.getByText("↓ 35dBm")).toBeInTheDocument(); + expect(screen.getByText("↓ 45dBm")).toBeInTheDocument(); - expect(screen.getByText("↓ 15dB")).toBeInTheDocument(); - expect(screen.getByText("↓ 25dB")).toBeInTheDocument(); + expect(screen.getByText("↓ 15dBm")).toBeInTheDocument(); + expect(screen.getByText("↓ 25dBm")).toBeInTheDocument(); }); it("renders '??' for missing SNR values", () => { @@ -91,7 +91,7 @@ describe("TraceRoute", () => { ); expect(screen.getByText("Node A")).toBeInTheDocument(); - expect(screen.getAllByText("↓ ??dB")).toHaveLength(2); + expect(screen.getAllByText("↓ ??dBm")).toHaveLength(2); }); it("renders hop hex if node is not found", () => { @@ -104,8 +104,7 @@ describe("TraceRoute", () => { />, ); - expect(screen.getByText(/^!63$/)).toBeInTheDocument(); - expect(screen.getByText("↓ 5dB")).toBeInTheDocument(); - expect(screen.getByText("↓ 15dB")).toBeInTheDocument(); + expect(screen.getByText("↓ 5dBm")).toBeInTheDocument(); + expect(screen.getByText("↓ 15dBm")).toBeInTheDocument(); }); }); diff --git a/src/components/PageComponents/Messages/TraceRoute.tsx b/src/components/PageComponents/Messages/TraceRoute.tsx index e7578247..6ad25952 100644 --- a/src/components/PageComponents/Messages/TraceRoute.tsx +++ b/src/components/PageComponents/Messages/TraceRoute.tsx @@ -1,6 +1,7 @@ import { useDevice } from "@core/stores/deviceStore.ts"; import type { Protobuf } from "@meshtastic/core"; import { numberToHexUnpadded } from "@noble/curves/abstract/utils"; +import { useTranslation } from "react-i18next"; export interface TraceRouteProps { from?: Protobuf.Mesh.NodeInfo; @@ -23,6 +24,7 @@ const RoutePath = ( { title, startNode, endNode, path, snr }: RoutePathProps, ) => { const { getNode } = useDevice(); + const { t } = useTranslation(); return (

{title}

{startNode?.user?.longName}

-

↓ {snr?.[0] ?? "??"}dB

+

+ ↓ {snr?.[0] ?? t("unknown.num")} + {t("unit.dbm")} +

{path.map((hop, i) => (

- {getNode(hop)?.user?.longName ?? `!${numberToHexUnpadded(hop)}`} + {getNode(hop)?.user?.longName ?? + `${t("traceRoute.nodeUnknownPrefix")}${numberToHexUnpadded(hop)}`} +

+

+ ↓ {snr?.[i + 1] ?? t("unknown.num")} + {t("unit.dbm")}

-

↓ {snr?.[i + 1] ?? "??"}dB

))}

{endNode?.user?.longName}

@@ -53,18 +62,19 @@ export const TraceRoute = ({ snrTowards, snrBack, }: TraceRouteProps) => { + const { t } = useTranslation("dialog"); return (
- {routeBack && ( + {routeBack && routeBack.length > 0 && ( { const { moduleConfig, setWorkingModuleConfig } = useDevice(); + const { t } = useTranslation("moduleConfig"); const onSubmit = (data: AmbientLightingValidation) => { setWorkingModuleConfig( @@ -24,38 +26,38 @@ export const AmbientLighting = () => { defaultValues={moduleConfig.ambientLighting} fieldGroups={[ { - label: "Ambient Lighting Settings", - description: "Settings for the Ambient Lighting module", + label: t("ambientLighting.title"), + description: t("ambientLighting.description"), fields: [ { type: "toggle", name: "ledState", - label: "LED State", - description: "Sets LED to on or off", + label: t("ambientLighting.ledState.label"), + description: t("ambientLighting.ledState.description"), }, { type: "number", name: "current", - label: "Current", - description: "Sets the current for the LED output. Default is 10", + label: t("ambientLighting.current.label"), + description: t("ambientLighting.current.description"), }, { type: "number", name: "red", - label: "Red", - description: "Sets the red LED level. Values are 0-255", + label: t("ambientLighting.red.label"), + description: t("ambientLighting.red.description"), }, { type: "number", name: "green", - label: "Green", - description: "Sets the green LED level. Values are 0-255", + label: t("ambientLighting.green.label"), + description: t("ambientLighting.green.description"), }, { type: "number", name: "blue", - label: "Blue", - description: "Sets the blue LED level. Values are 0-255", + label: t("ambientLighting.blue.label"), + description: t("ambientLighting.blue.description"), }, ], }, diff --git a/src/components/PageComponents/ModuleConfig/Audio.tsx b/src/components/PageComponents/ModuleConfig/Audio.tsx index 4297f09f..a87361e9 100644 --- a/src/components/PageComponents/ModuleConfig/Audio.tsx +++ b/src/components/PageComponents/ModuleConfig/Audio.tsx @@ -1,11 +1,13 @@ -import type { AudioValidation } from "@app/validation/moduleConfig/audio.tsx"; +import type { AudioValidation } from "@app/validation/moduleConfig/audio.ts"; import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; +import { useTranslation } from "react-i18next"; export const Audio = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); + const { t } = useTranslation("moduleConfig"); const onSubmit = (data: AudioValidation) => { setWorkingModuleConfig( @@ -24,26 +26,26 @@ export const Audio = () => { defaultValues={moduleConfig.audio} fieldGroups={[ { - label: "Audio Settings", - description: "Settings for the Audio module", + label: t("audio.title"), + description: t("audio.description"), fields: [ { type: "toggle", name: "codec2Enabled", - label: "Codec 2 Enabled", - description: "Enable Codec 2 audio encoding", + label: t("audio.codec2Enabled.label"), + description: t("audio.codec2Enabled.description"), }, { type: "number", name: "pttPin", - label: "PTT Pin", - description: "GPIO pin to use for PTT", + label: t("audio.pttPin.label"), + description: t("audio.pttPin.description"), }, { type: "select", name: "bitrate", - label: "Bitrate", - description: "Bitrate to use for audio encoding", + label: t("audio.bitrate.label"), + description: t("audio.bitrate.description"), properties: { enumValue: Protobuf.ModuleConfig.ModuleConfig_AudioConfig_Audio_Baud, @@ -52,26 +54,26 @@ export const Audio = () => { { type: "number", name: "i2sWs", - label: "i2S WS", - description: "GPIO pin to use for i2S WS", + label: t("audio.i2sWs.label"), + description: t("audio.i2sWs.description"), }, { type: "number", name: "i2sSd", - label: "i2S SD", - description: "GPIO pin to use for i2S SD", + label: t("audio.i2sSd.label"), + description: t("audio.i2sSd.description"), }, { type: "number", name: "i2sDin", - label: "i2S DIN", - description: "GPIO pin to use for i2S DIN", + label: t("audio.i2sDin.label"), + description: t("audio.i2sDin.description"), }, { type: "number", name: "i2sSck", - label: "i2S SCK", - description: "GPIO pin to use for i2S SCK", + label: t("audio.i2sSck.label"), + description: t("audio.i2sSck.description"), }, ], }, diff --git a/src/components/PageComponents/ModuleConfig/CannedMessage.tsx b/src/components/PageComponents/ModuleConfig/CannedMessage.tsx index 661a9f01..f26f8c51 100644 --- a/src/components/PageComponents/ModuleConfig/CannedMessage.tsx +++ b/src/components/PageComponents/ModuleConfig/CannedMessage.tsx @@ -1,11 +1,13 @@ -import type { CannedMessageValidation } from "@app/validation/moduleConfig/cannedMessage.tsx"; +import type { CannedMessageValidation } from "@app/validation/moduleConfig/cannedMessage.ts"; import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; +import { useTranslation } from "react-i18next"; export const CannedMessage = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); + const { t } = useTranslation("moduleConfig"); const onSubmit = (data: CannedMessageValidation) => { setWorkingModuleConfig( @@ -24,44 +26,44 @@ export const CannedMessage = () => { defaultValues={moduleConfig.cannedMessage} fieldGroups={[ { - label: "Canned Message Settings", - description: "Settings for the Canned Message module", + label: t("cannedMessage.title"), + description: t("cannedMessage.description"), fields: [ { type: "toggle", name: "enabled", - label: "Module Enabled", - description: "Enable Canned Message", + label: t("cannedMessage.moduleEnabled.label"), + description: t("cannedMessage.moduleEnabled.description"), }, { type: "toggle", name: "rotary1Enabled", - label: "Rotary Encoder #1 Enabled", - description: "Enable the rotary encoder", + label: t("cannedMessage.rotary1Enabled.label"), + description: t("cannedMessage.rotary1Enabled.description"), }, { type: "number", name: "inputbrokerPinA", - label: "Encoder Pin A", - description: "GPIO Pin Value (1-39) For encoder port A", + label: t("cannedMessage.inputbrokerPinA.label"), + description: t("cannedMessage.inputbrokerPinA.description"), }, { type: "number", name: "inputbrokerPinB", - label: "Encoder Pin B", - description: "GPIO Pin Value (1-39) For encoder port B", + label: t("cannedMessage.inputbrokerPinB.label"), + description: t("cannedMessage.inputbrokerPinB.description"), }, { type: "number", name: "inputbrokerPinPress", - label: "Encoder Pin Press", - description: "GPIO Pin Value (1-39) For encoder Press", + label: t("cannedMessage.inputbrokerPinPress.label"), + description: t("cannedMessage.inputbrokerPinPress.description"), }, { type: "select", name: "inputbrokerEventCw", - label: "Clockwise event", - description: "Select input event.", + label: t("cannedMessage.inputbrokerEventCw.label"), + description: t("cannedMessage.inputbrokerEventCw.description"), properties: { enumValue: Protobuf.ModuleConfig .ModuleConfig_CannedMessageConfig_InputEventChar, @@ -70,8 +72,8 @@ export const CannedMessage = () => { { type: "select", name: "inputbrokerEventCcw", - label: "Counter Clockwise event", - description: "Select input event.", + label: t("cannedMessage.inputbrokerEventCcw.label"), + description: t("cannedMessage.inputbrokerEventCcw.description"), properties: { enumValue: Protobuf.ModuleConfig .ModuleConfig_CannedMessageConfig_InputEventChar, @@ -80,8 +82,8 @@ export const CannedMessage = () => { { type: "select", name: "inputbrokerEventPress", - label: "Press event", - description: "Select input event", + label: t("cannedMessage.inputbrokerEventPress.label"), + description: t("cannedMessage.inputbrokerEventPress.description"), properties: { enumValue: Protobuf.ModuleConfig .ModuleConfig_CannedMessageConfig_InputEventChar, @@ -90,21 +92,20 @@ export const CannedMessage = () => { { type: "toggle", name: "updown1Enabled", - label: "Up Down enabled", - description: "Enable the up / down encoder", + label: t("cannedMessage.updown1Enabled.label"), + description: t("cannedMessage.updown1Enabled.description"), }, { type: "text", name: "allowInputSource", - label: "Allow Input Source", - description: - "Select from: '_any', 'rotEnc1', 'upDownEnc1', 'cardkb'", + label: t("cannedMessage.allowInputSource.label"), + description: t("cannedMessage.allowInputSource.description"), }, { type: "toggle", name: "sendBell", - label: "Send Bell", - description: "Sends a bell character with each message", + label: t("cannedMessage.sendBell.label"), + description: t("cannedMessage.sendBell.description"), }, ], }, diff --git a/src/components/PageComponents/ModuleConfig/DetectionSensor.tsx b/src/components/PageComponents/ModuleConfig/DetectionSensor.tsx index 00d7def9..138e6cdc 100644 --- a/src/components/PageComponents/ModuleConfig/DetectionSensor.tsx +++ b/src/components/PageComponents/ModuleConfig/DetectionSensor.tsx @@ -1,11 +1,13 @@ import { useDevice } from "@core/stores/deviceStore.ts"; -import type { DetectionSensorValidation } from "@app/validation/moduleConfig/detectionSensor.tsx"; +import type { DetectionSensorValidation } from "@app/validation/moduleConfig/detectionSensor.ts"; import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { Protobuf } from "@meshtastic/core"; +import { useTranslation } from "react-i18next"; export const DetectionSensor = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); + const { t } = useTranslation("moduleConfig"); const onSubmit = (data: DetectionSensorValidation) => { setWorkingModuleConfig( @@ -24,23 +26,24 @@ export const DetectionSensor = () => { defaultValues={moduleConfig.detectionSensor} fieldGroups={[ { - label: "Detection Sensor Settings", - description: "Settings for the Detection Sensor module", + label: t("detectionSensor.title"), + description: t("detectionSensor.description"), fields: [ { type: "toggle", name: "enabled", - label: "Enabled", - description: "Enable or disable Detection Sensor Module", + label: t("detectionSensor.enabled.label"), + description: t("detectionSensor.enabled.description"), }, { type: "number", name: "minimumBroadcastSecs", - label: "Minimum Broadcast Seconds", - description: - "The interval in seconds of how often we can send a message to the mesh when a state change is detected", + label: t("detectionSensor.minimumBroadcastSecs.label"), + description: t( + "detectionSensor.minimumBroadcastSecs.description", + ), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, disabledBy: [ { @@ -51,9 +54,8 @@ export const DetectionSensor = () => { { type: "number", name: "stateBroadcastSecs", - label: "State Broadcast Seconds", - description: - "The interval in seconds of how often we should send a message to the mesh with the current state regardless of changes", + label: t("detectionSensor.stateBroadcastSecs.label"), + description: t("detectionSensor.stateBroadcastSecs.description"), disabledBy: [ { fieldName: "enabled", @@ -63,8 +65,8 @@ export const DetectionSensor = () => { { type: "toggle", name: "sendBell", - label: "Send Bell", - description: "Send ASCII bell with alert message", + label: t("detectionSensor.sendBell.label"), + description: t("detectionSensor.sendBell.description"), disabledBy: [ { fieldName: "enabled", @@ -74,9 +76,8 @@ export const DetectionSensor = () => { { type: "text", name: "name", - label: "Friendly Name", - description: - "Used to format the message sent to mesh, max 20 Characters", + label: t("detectionSensor.name.label"), + description: t("detectionSensor.name.description"), disabledBy: [ { fieldName: "enabled", @@ -86,8 +87,8 @@ export const DetectionSensor = () => { { type: "number", name: "monitorPin", - label: "Monitor Pin", - description: "The GPIO pin to monitor for state changes", + label: t("detectionSensor.monitorPin.label"), + description: t("detectionSensor.monitorPin.description"), disabledBy: [ { fieldName: "enabled", @@ -97,9 +98,10 @@ export const DetectionSensor = () => { { type: "toggle", name: "detectionTriggeredHigh", - label: "Detection Triggered High", - description: - "Whether or not the GPIO pin state detection is triggered on HIGH (1), otherwise LOW (0)", + label: t("detectionSensor.detectionTriggeredHigh.label"), + description: t( + "detectionSensor.detectionTriggeredHigh.description", + ), disabledBy: [ { fieldName: "enabled", @@ -109,8 +111,8 @@ export const DetectionSensor = () => { { type: "toggle", name: "usePullup", - label: "Use Pullup", - description: "Whether or not use INPUT_PULLUP mode for GPIO pin", + label: t("detectionSensor.usePullup.label"), + description: t("detectionSensor.usePullup.description"), disabledBy: [ { fieldName: "enabled", diff --git a/src/components/PageComponents/ModuleConfig/ExternalNotification.tsx b/src/components/PageComponents/ModuleConfig/ExternalNotification.tsx index ecaa8cbf..470ab5ea 100644 --- a/src/components/PageComponents/ModuleConfig/ExternalNotification.tsx +++ b/src/components/PageComponents/ModuleConfig/ExternalNotification.tsx @@ -1,11 +1,13 @@ -import type { ExternalNotificationValidation } from "@app/validation/moduleConfig/externalNotification.tsx"; +import type { ExternalNotificationValidation } from "@app/validation/moduleConfig/externalNotification.ts"; import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; +import { useTranslation } from "react-i18next"; export const ExternalNotification = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); + const { t } = useTranslation("moduleConfig"); const onSubmit = (data: ExternalNotificationValidation) => { setWorkingModuleConfig( @@ -24,20 +26,20 @@ export const ExternalNotification = () => { defaultValues={moduleConfig.externalNotification} fieldGroups={[ { - label: "External Notification Settings", - description: "Configure the external notification module", + label: t("externalNotification.title"), + description: t("externalNotification.description"), fields: [ { type: "toggle", name: "enabled", - label: "Module Enabled", - description: "Enable External Notification", + label: t("externalNotification.enabled.label"), + description: t("externalNotification.enabled.description"), }, { type: "number", name: "outputMs", - label: "Output MS", - description: "Output MS", + label: t("externalNotification.outputMs.label"), + description: t("externalNotification.outputMs.description"), disabledBy: [ { @@ -45,14 +47,14 @@ export const ExternalNotification = () => { }, ], properties: { - suffix: "ms", + suffix: t("unit.millisecond.suffix"), }, }, { type: "number", name: "output", - label: "Output", - description: "Output", + label: t("externalNotification.output.label"), + description: t("externalNotification.output.description"), disabledBy: [ { fieldName: "enabled", @@ -62,8 +64,8 @@ export const ExternalNotification = () => { { type: "number", name: "outputVibra", - label: "Output Vibrate", - description: "Output Vibrate", + label: t("externalNotification.outputVibra.label"), + description: t("externalNotification.outputVibra.description"), disabledBy: [ { fieldName: "enabled", @@ -73,8 +75,8 @@ export const ExternalNotification = () => { { type: "number", name: "outputBuzzer", - label: "Output Buzzer", - description: "Output Buzzer", + label: t("externalNotification.outputBuzzer.label"), + description: t("externalNotification.outputBuzzer.description"), disabledBy: [ { fieldName: "enabled", @@ -84,8 +86,8 @@ export const ExternalNotification = () => { { type: "toggle", name: "active", - label: "Active", - description: "Active", + label: t("externalNotification.active.label"), + description: t("externalNotification.active.description"), disabledBy: [ { fieldName: "enabled", @@ -95,8 +97,8 @@ export const ExternalNotification = () => { { type: "toggle", name: "alertMessage", - label: "Alert Message", - description: "Alert Message", + label: t("externalNotification.alertMessage.label"), + description: t("externalNotification.alertMessage.description"), disabledBy: [ { fieldName: "enabled", @@ -106,8 +108,10 @@ export const ExternalNotification = () => { { type: "toggle", name: "alertMessageVibra", - label: "Alert Message Vibrate", - description: "Alert Message Vibrate", + label: t("externalNotification.alertMessageVibra.label"), + description: t( + "externalNotification.alertMessageVibra.description", + ), disabledBy: [ { fieldName: "enabled", @@ -117,8 +121,10 @@ export const ExternalNotification = () => { { type: "toggle", name: "alertMessageBuzzer", - label: "Alert Message Buzzer", - description: "Alert Message Buzzer", + label: t("externalNotification.alertMessageBuzzer.label"), + description: t( + "externalNotification.alertMessageBuzzer.description", + ), disabledBy: [ { fieldName: "enabled", @@ -128,9 +134,8 @@ export const ExternalNotification = () => { { type: "toggle", name: "alertBell", - label: "Alert Bell", - description: - "Should an alert be triggered when receiving an incoming bell?", + label: t("externalNotification.alertBell.label"), + description: t("externalNotification.alertBell.description"), disabledBy: [ { fieldName: "enabled", @@ -140,8 +145,8 @@ export const ExternalNotification = () => { { type: "toggle", name: "alertBellVibra", - label: "Alert Bell Vibrate", - description: "Alert Bell Vibrate", + label: t("externalNotification.alertBellVibra.label"), + description: t("externalNotification.alertBellVibra.description"), disabledBy: [ { fieldName: "enabled", @@ -151,8 +156,10 @@ export const ExternalNotification = () => { { type: "toggle", name: "alertBellBuzzer", - label: "Alert Bell Buzzer", - description: "Alert Bell Buzzer", + label: t("externalNotification.alertBellBuzzer.label"), + description: t( + "externalNotification.alertBellBuzzer.description", + ), disabledBy: [ { fieldName: "enabled", @@ -162,8 +169,8 @@ export const ExternalNotification = () => { { type: "toggle", name: "usePwm", - label: "Use PWM", - description: "Use PWM", + label: t("externalNotification.usePwm.label"), + description: t("externalNotification.usePwm.description"), disabledBy: [ { fieldName: "enabled", @@ -173,8 +180,8 @@ export const ExternalNotification = () => { { type: "number", name: "nagTimeout", - label: "Nag Timeout", - description: "Nag Timeout", + label: t("externalNotification.nagTimeout.label"), + description: t("externalNotification.nagTimeout.description"), disabledBy: [ { fieldName: "enabled", @@ -184,8 +191,8 @@ export const ExternalNotification = () => { { type: "toggle", name: "useI2sAsBuzzer", - label: "Use I²S Pin as Buzzer", - description: "Designate I²S Pin as Buzzer Output", + label: t("externalNotification.useI2sAsBuzzer.label"), + description: t("externalNotification.useI2sAsBuzzer.description"), disabledBy: [ { fieldName: "enabled", diff --git a/src/components/PageComponents/ModuleConfig/MQTT.tsx b/src/components/PageComponents/ModuleConfig/MQTT.tsx index e317aa53..51007f97 100644 --- a/src/components/PageComponents/ModuleConfig/MQTT.tsx +++ b/src/components/PageComponents/ModuleConfig/MQTT.tsx @@ -1,11 +1,13 @@ import { useDevice } from "@core/stores/deviceStore.ts"; -import type { MqttValidation } from "@app/validation/moduleConfig/mqtt.tsx"; +import type { MqttValidation } from "@app/validation/moduleConfig/mqtt.ts"; import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { Protobuf } from "@meshtastic/core"; +import { useTranslation } from "react-i18next"; export const MQTT = () => { const { config, moduleConfig, setWorkingModuleConfig } = useDevice(); + const { t } = useTranslation("moduleConfig"); const onSubmit = (data: MqttValidation) => { setWorkingModuleConfig( @@ -30,21 +32,20 @@ export const MQTT = () => { defaultValues={moduleConfig.mqtt} fieldGroups={[ { - label: "MQTT Settings", - description: "Settings for the MQTT module", + label: t("mqtt.title"), + description: t("mqtt.description"), fields: [ { type: "toggle", name: "enabled", - label: "Enabled", - description: "Enable or disable MQTT", + label: t("mqtt.enabled.label"), + description: t("mqtt.enabled.description"), }, { type: "text", name: "address", - label: "MQTT Server Address", - description: - "MQTT server address to use for default/custom servers", + label: t("mqtt.address.label"), + description: t("mqtt.address.description"), disabledBy: [ { fieldName: "enabled", @@ -54,8 +55,8 @@ export const MQTT = () => { { type: "text", name: "username", - label: "MQTT Username", - description: "MQTT username to use for default/custom servers", + label: t("mqtt.username.label"), + description: t("mqtt.username.description"), disabledBy: [ { fieldName: "enabled", @@ -65,8 +66,8 @@ export const MQTT = () => { { type: "password", name: "password", - label: "MQTT Password", - description: "MQTT password to use for default/custom servers", + label: t("mqtt.password.label"), + description: t("mqtt.password.description"), disabledBy: [ { fieldName: "enabled", @@ -76,9 +77,8 @@ export const MQTT = () => { { type: "toggle", name: "encryptionEnabled", - label: "Encryption Enabled", - description: - "Enable or disable MQTT encryption. Note: All messages are sent to the MQTT broker unencrypted if this option is not enabled, even when your uplink channels have encryption keys set. This includes position data.", + label: t("mqtt.encryptionEnabled.label"), + description: t("mqtt.encryptionEnabled.description"), disabledBy: [ { fieldName: "enabled", @@ -88,8 +88,8 @@ export const MQTT = () => { { type: "toggle", name: "jsonEnabled", - label: "JSON Enabled", - description: "Whether to send/consume JSON packets on MQTT", + label: t("mqtt.jsonEnabled.label"), + description: t("mqtt.jsonEnabled.description"), disabledBy: [ { fieldName: "enabled", @@ -99,8 +99,8 @@ export const MQTT = () => { { type: "toggle", name: "tlsEnabled", - label: "TLS Enabled", - description: "Enable or disable TLS", + label: t("mqtt.tlsEnabled.label"), + description: t("mqtt.tlsEnabled.description"), disabledBy: [ { fieldName: "enabled", @@ -110,8 +110,8 @@ export const MQTT = () => { { type: "text", name: "root", - label: "Root topic", - description: "MQTT root topic to use for default/custom servers", + label: t("mqtt.root.label"), + description: t("mqtt.root.description"), disabledBy: [ { fieldName: "enabled", @@ -121,9 +121,8 @@ export const MQTT = () => { { type: "toggle", name: "proxyToClientEnabled", - label: "Proxy to Client Enabled", - description: - "Use the client's internet connection for MQTT (feature only active in mobile apps)", + label: t("mqtt.proxyToClientEnabled.label"), + description: t("mqtt.proxyToClientEnabled.description"), disabledBy: [ { fieldName: "enabled", @@ -133,8 +132,8 @@ export const MQTT = () => { { type: "toggle", name: "mapReportingEnabled", - label: "Map Reporting Enabled", - description: "Enable or disable map reporting", + label: t("mqtt.mapReportingEnabled.label"), + description: t("mqtt.mapReportingEnabled.description"), disabledBy: [ { fieldName: "enabled", @@ -144,10 +143,12 @@ export const MQTT = () => { { type: "number", name: "mapReportSettings.publishIntervalSecs", - label: "Map Report Publish Interval (s)", - description: "Interval in seconds to publish map reports", + label: t("mqtt.mapReportSettings.publishIntervalSecs.label"), + description: t( + "mqtt.mapReportSettings.publishIntervalSecs.description", + ), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, disabledBy: [ { @@ -161,34 +162,77 @@ export const MQTT = () => { { type: "select", name: "mapReportSettings.positionPrecision", - label: "Approximate Location", - description: - "Position shared will be accurate within this distance", + label: t( + "mqtt.mapReportSettings.positionPrecision.label", + ), + description: t( + "mqtt.mapReportSettings.positionPrecision.description", + ), properties: { enumValue: config.display?.units === 0 ? { - "Within 23 km": 10, - "Within 12 km": 11, - "Within 5.8 km": 12, - "Within 2.9 km": 13, - "Within 1.5 km": 14, - "Within 700 m": 15, - "Within 350 m": 16, - "Within 200 m": 17, - "Within 90 m": 18, - "Within 50 m": 19, + [ + t("mqtt.mapReportSettings.positionPrecision.options.metric_km23") + ]: 10, + [ + t("mqtt.mapReportSettings.positionPrecision.options.metric_km12") + ]: 11, + [ + t("mqtt.mapReportSettings.positionPrecision.options.metric_km5_8") + ]: 12, + [ + t("mqtt.mapReportSettings.positionPrecision.options.metric_km2_9") + ]: 13, + [ + t("mqtt.mapReportSettings.positionPrecision.options.metric_km1_5") + ]: 14, + [ + t("mqtt.mapReportSettings.positionPrecision.options.metric_m700") + ]: 15, + [ + t("mqtt.mapReportSettings.positionPrecision.options.metric_m350") + ]: 16, + [ + t("mqtt.mapReportSettings.positionPrecision.options.metric_m200") + ]: 17, + [ + t("mqtt.mapReportSettings.positionPrecision.options.metric_m90") + ]: 18, + [ + t("mqtt.mapReportSettings.positionPrecision.options.metric_m50") + ]: 19, } : { - "Within 15 miles": 10, - "Within 7.3 miles": 11, - "Within 3.6 miles": 12, - "Within 1.8 miles": 13, - "Within 0.9 miles": 14, - "Within 0.5 miles": 15, - "Within 0.2 miles": 16, - "Within 600 feet": 17, - "Within 300 feet": 18, - "Within 150 feet": 19, + [ + t("mqtt.mapReportSettings.positionPrecision.options.imperial_mi15") + ]: 10, + [ + t("mqtt.mapReportSettings.positionPrecision.options.imperial_mi7_3") + ]: 11, + [ + t("mqtt.mapReportSettings.positionPrecision.options.imperial_mi3_6") + ]: 12, + [ + t("mqtt.mapReportSettings.positionPrecision.options.imperial_mi1_8") + ]: 13, + [ + t("mqtt.mapReportSettings.positionPrecision.options.imperial_mi0_9") + ]: 14, + [ + t("mqtt.mapReportSettings.positionPrecision.options.imperial_mi0_5") + ]: 15, + [ + t("mqtt.mapReportSettings.positionPrecision.options.imperial_mi0_2") + ]: 16, + [ + t("mqtt.mapReportSettings.positionPrecision.options.imperial_ft600") + ]: 17, + [ + t("mqtt.mapReportSettings.positionPrecision.options.imperial_ft300") + ]: 18, + [ + t("mqtt.mapReportSettings.positionPrecision.options.imperial_ft150") + ]: 19, }, }, disabledBy: [ diff --git a/src/components/PageComponents/ModuleConfig/NeighborInfo.tsx b/src/components/PageComponents/ModuleConfig/NeighborInfo.tsx index 79a8d140..9e8c75a8 100644 --- a/src/components/PageComponents/ModuleConfig/NeighborInfo.tsx +++ b/src/components/PageComponents/ModuleConfig/NeighborInfo.tsx @@ -1,11 +1,13 @@ import { useDevice } from "@core/stores/deviceStore.ts"; -import type { NeighborInfoValidation } from "@app/validation/moduleConfig/neighborInfo.tsx"; +import type { NeighborInfoValidation } from "@app/validation/moduleConfig/neighborInfo.ts"; import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { Protobuf } from "@meshtastic/core"; +import { useTranslation } from "react-i18next"; export const NeighborInfo = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); + const { t } = useTranslation("moduleConfig"); const onSubmit = (data: NeighborInfoValidation) => { setWorkingModuleConfig( @@ -24,23 +26,22 @@ export const NeighborInfo = () => { defaultValues={moduleConfig.neighborInfo} fieldGroups={[ { - label: "Neighbor Info Settings", - description: "Settings for the Neighbor Info module", + label: t("neighborInfo.title"), + description: t("neighborInfo.description"), fields: [ { type: "toggle", name: "enabled", - label: "Enabled", - description: "Enable or disable Neighbor Info Module", + label: t("neighborInfo.enabled.label"), + description: t("neighborInfo.enabled.description"), }, { type: "number", name: "updateInterval", - label: "Update Interval", - description: - "Interval in seconds of how often we should try to send our Neighbor Info to the mesh", + label: t("neighborInfo.updateInterval.label"), + description: t("neighborInfo.updateInterval.description"), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, disabledBy: [ { diff --git a/src/components/PageComponents/ModuleConfig/Paxcounter.tsx b/src/components/PageComponents/ModuleConfig/Paxcounter.tsx index a05f2093..d19e398f 100644 --- a/src/components/PageComponents/ModuleConfig/Paxcounter.tsx +++ b/src/components/PageComponents/ModuleConfig/Paxcounter.tsx @@ -3,9 +3,11 @@ import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; +import { useTranslation } from "react-i18next"; export const Paxcounter = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); + const { t } = useTranslation("moduleConfig"); const onSubmit = (data: PaxcounterValidation) => { setWorkingModuleConfig( @@ -24,23 +26,22 @@ export const Paxcounter = () => { defaultValues={moduleConfig.paxcounter} fieldGroups={[ { - label: "Paxcounter Settings", - description: "Settings for the Paxcounter module", + label: t("paxcounter.title"), + description: t("paxcounter.description"), fields: [ { type: "toggle", name: "enabled", - label: "Module Enabled", - description: "Enable Paxcounter", + label: t("paxcounter.enabled.label"), + description: t("paxcounter.enabled.description"), }, { type: "number", name: "paxcounterUpdateInterval", - label: "Update Interval (seconds)", - description: - "How long to wait between sending paxcounter packets", + label: t("paxcounter.paxcounterUpdateInterval.label"), + description: t("paxcounter.paxcounterUpdateInterval.description"), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, disabledBy: [ { @@ -51,9 +52,8 @@ export const Paxcounter = () => { { type: "number", name: "wifiThreshold", - label: "WiFi RSSI Threshold", - description: - "At what WiFi RSSI level should the counter increase. Defaults to -80.", + label: t("paxcounter.wifiThreshold.label"), + description: t("paxcounter.wifiThreshold.description"), disabledBy: [ { fieldName: "enabled", @@ -63,9 +63,8 @@ export const Paxcounter = () => { { type: "number", name: "bleThreshold", - label: "BLE RSSI Threshold", - description: - "At what BLE RSSI level should the counter increase. Defaults to -80.", + label: t("paxcounter.bleThreshold.label"), + description: t("paxcounter.bleThreshold.description"), disabledBy: [ { fieldName: "enabled", diff --git a/src/components/PageComponents/ModuleConfig/RangeTest.tsx b/src/components/PageComponents/ModuleConfig/RangeTest.tsx index 5949385f..96787e6e 100644 --- a/src/components/PageComponents/ModuleConfig/RangeTest.tsx +++ b/src/components/PageComponents/ModuleConfig/RangeTest.tsx @@ -1,11 +1,13 @@ -import type { RangeTestValidation } from "@app/validation/moduleConfig/rangeTest.tsx"; +import type { RangeTestValidation } from "@app/validation/moduleConfig/rangeTest.ts"; import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; +import { useTranslation } from "react-i18next"; export const RangeTest = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); + const { t } = useTranslation("moduleConfig"); const onSubmit = (data: RangeTestValidation) => { setWorkingModuleConfig( @@ -24,22 +26,22 @@ export const RangeTest = () => { defaultValues={moduleConfig.rangeTest} fieldGroups={[ { - label: "Range Test Settings", - description: "Settings for the Range Test module", + label: t("rangeTest.title"), + description: t("rangeTest.description"), fields: [ { type: "toggle", name: "enabled", - label: "Module Enabled", - description: "Enable Range Test", + label: t("rangeTest.enabled.label"), + description: t("rangeTest.enabled.description"), }, { type: "number", name: "sender", - label: "Message Interval", - description: "How long to wait between sending test packets", + label: t("rangeTest.sender.label"), + description: t("rangeTest.sender.description"), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, disabledBy: [ { @@ -50,8 +52,8 @@ export const RangeTest = () => { { type: "toggle", name: "save", - label: "Save CSV to storage", - description: "ESP32 Only", + label: t("rangeTest.save.label"), + description: t("rangeTest.save.description"), disabledBy: [ { fieldName: "enabled", diff --git a/src/components/PageComponents/ModuleConfig/Serial.tsx b/src/components/PageComponents/ModuleConfig/Serial.tsx index eb9b53c9..f633418b 100644 --- a/src/components/PageComponents/ModuleConfig/Serial.tsx +++ b/src/components/PageComponents/ModuleConfig/Serial.tsx @@ -1,11 +1,13 @@ -import type { SerialValidation } from "@app/validation/moduleConfig/serial.tsx"; +import type { SerialValidation } from "@app/validation/moduleConfig/serial.ts"; import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; +import { useTranslation } from "react-i18next"; export const Serial = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); + const { t } = useTranslation("moduleConfig"); const onSubmit = (data: SerialValidation) => { setWorkingModuleConfig( @@ -24,21 +26,20 @@ export const Serial = () => { defaultValues={moduleConfig.serial} fieldGroups={[ { - label: "Serial Settings", - description: "Settings for the Serial module", + label: t("serial.title"), + description: t("serial.description"), fields: [ { type: "toggle", name: "enabled", - label: "Module Enabled", - description: "Enable Serial output", + label: t("serial.enabled.label"), + description: t("serial.enabled.description"), }, { type: "toggle", name: "echo", - label: "Echo", - description: - "Any packets you send will be echoed back to your device", + label: t("serial.echo.label"), + description: t("serial.echo.description"), disabledBy: [ { fieldName: "enabled", @@ -48,8 +49,8 @@ export const Serial = () => { { type: "number", name: "rxd", - label: "Receive Pin", - description: "Set the GPIO pin to the RXD pin you have set up.", + label: t("serial.rxd.label"), + description: t("serial.rxd.description"), disabledBy: [ { fieldName: "enabled", @@ -59,8 +60,8 @@ export const Serial = () => { { type: "number", name: "txd", - label: "Transmit Pin", - description: "Set the GPIO pin to the TXD pin you have set up.", + label: t("serial.txd.label"), + description: t("serial.txd.description"), disabledBy: [ { fieldName: "enabled", @@ -70,8 +71,8 @@ export const Serial = () => { { type: "select", name: "baud", - label: "Baud Rate", - description: "The serial baud rate", + label: t("serial.baud.label"), + description: t("serial.baud.description"), disabledBy: [ { @@ -86,24 +87,22 @@ export const Serial = () => { { type: "number", name: "timeout", - label: "Timeout", - - description: - "Seconds to wait before we consider your packet as 'done'", + label: t("serial.timeout.label"), + description: t("serial.timeout.description"), disabledBy: [ { fieldName: "enabled", }, ], properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, }, { type: "select", name: "mode", - label: "Mode", - description: "Select Mode", + label: t("serial.mode.label"), + description: t("serial.mode.description"), disabledBy: [ { @@ -119,9 +118,8 @@ export const Serial = () => { { type: "toggle", name: "overrideConsoleSerialPort", - label: "Override Console Serial Port", - description: - "If you have a serial port connected to the console, this will override it.", + label: t("serial.overrideConsoleSerialPort.label"), + description: t("serial.overrideConsoleSerialPort.description"), }, ], }, diff --git a/src/components/PageComponents/ModuleConfig/StoreForward.tsx b/src/components/PageComponents/ModuleConfig/StoreForward.tsx index f091f586..6118dad7 100644 --- a/src/components/PageComponents/ModuleConfig/StoreForward.tsx +++ b/src/components/PageComponents/ModuleConfig/StoreForward.tsx @@ -3,9 +3,11 @@ import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; +import { useTranslation } from "react-i18next"; export const StoreForward = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); + const { t } = useTranslation("moduleConfig"); const onSubmit = (data: StoreForwardValidation) => { setWorkingModuleConfig( @@ -24,20 +26,20 @@ export const StoreForward = () => { defaultValues={moduleConfig.storeForward} fieldGroups={[ { - label: "Store & Forward Settings", - description: "Settings for the Store & Forward module", + label: t("storeForward.title"), + description: t("storeForward.description"), fields: [ { type: "toggle", name: "enabled", - label: "Module Enabled", - description: "Enable Store & Forward", + label: t("storeForward.enabled.label"), + description: t("storeForward.enabled.description"), }, { type: "toggle", name: "heartbeat", - label: "Heartbeat Enabled", - description: "Enable Store & Forward heartbeat", + label: t("storeForward.heartbeat.label"), + description: t("storeForward.heartbeat.description"), disabledBy: [ { fieldName: "enabled", @@ -47,23 +49,22 @@ export const StoreForward = () => { { type: "number", name: "records", - label: "Number of records", - description: "Number of records to store", - + label: t("storeForward.records.label"), + description: t("storeForward.records.description"), disabledBy: [ { fieldName: "enabled", }, ], properties: { - suffix: "Records", + suffix: t("unit.record.plural"), }, }, { type: "number", name: "historyReturnMax", - label: "History return max", - description: "Max number of records to return", + label: t("storeForward.historyReturnMax.label"), + description: t("storeForward.historyReturnMax.description"), disabledBy: [ { fieldName: "enabled", @@ -73,8 +74,8 @@ export const StoreForward = () => { { type: "number", name: "historyReturnWindow", - label: "History return window", - description: "Max number of records to return", + label: t("storeForward.historyReturnWindow.label"), + description: t("storeForward.historyReturnWindow.description"), disabledBy: [ { fieldName: "enabled", diff --git a/src/components/PageComponents/ModuleConfig/Telemetry.tsx b/src/components/PageComponents/ModuleConfig/Telemetry.tsx index 3fc89c62..5515a8d3 100644 --- a/src/components/PageComponents/ModuleConfig/Telemetry.tsx +++ b/src/components/PageComponents/ModuleConfig/Telemetry.tsx @@ -3,9 +3,11 @@ import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; +import { useTranslation } from "react-i18next"; export const Telemetry = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); + const { t } = useTranslation("moduleConfig"); const onSubmit = (data: TelemetryValidation) => { setWorkingModuleConfig( @@ -24,74 +26,78 @@ export const Telemetry = () => { defaultValues={moduleConfig.telemetry} fieldGroups={[ { - label: "Telemetry Settings", - description: "Settings for the Telemetry module", + label: t("telemetry.title"), + description: t("telemetry.description"), fields: [ { type: "number", name: "deviceUpdateInterval", - label: "Device Metrics", - description: "Device metrics update interval (seconds)", + label: t("telemetry.deviceUpdateInterval.label"), + description: t("telemetry.deviceUpdateInterval.description"), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, }, { type: "number", name: "environmentUpdateInterval", - label: "Environment metrics update interval (seconds)", - description: "", + label: t("telemetry.environmentUpdateInterval.label"), + description: t("telemetry.environmentUpdateInterval.description"), properties: { - suffix: "Seconds", + suffix: t("unit.second.plural"), }, }, { type: "toggle", name: "environmentMeasurementEnabled", - label: "Module Enabled", - description: "Enable the Environment Telemetry", + label: t("telemetry.environmentMeasurementEnabled.label"), + description: t( + "telemetry.environmentMeasurementEnabled.description", + ), }, { type: "toggle", name: "environmentScreenEnabled", - label: "Displayed on Screen", - description: "Show the Telemetry Module on the OLED", + label: t("telemetry.environmentScreenEnabled.label"), + description: t("telemetry.environmentScreenEnabled.description"), }, { type: "toggle", name: "environmentDisplayFahrenheit", - label: "Display Fahrenheit", - description: "Display temp in Fahrenheit", + label: t("telemetry.environmentDisplayFahrenheit.label"), + description: t( + "telemetry.environmentDisplayFahrenheit.description", + ), }, { type: "toggle", name: "airQualityEnabled", - label: "Air Quality Enabled", - description: "Enable the Air Quality Telemetry", + label: t("telemetry.airQualityEnabled.label"), + description: t("telemetry.airQualityEnabled.description"), }, { type: "number", name: "airQualityInterval", - label: "Air Quality Update Interval", - description: "How often to send Air Quality data over the mesh", + label: t("telemetry.airQualityInterval.label"), + description: t("telemetry.airQualityInterval.description"), }, { type: "toggle", name: "powerMeasurementEnabled", - label: "Power Measurement Enabled", - description: "Enable the Power Measurement Telemetry", + label: t("telemetry.powerMeasurementEnabled.label"), + description: t("telemetry.powerMeasurementEnabled.description"), }, { type: "number", name: "powerUpdateInterval", - label: "Power Update Interval", - description: "How often to send Power data over the mesh", + label: t("telemetry.powerUpdateInterval.label"), + description: t("telemetry.powerUpdateInterval.description"), }, { type: "toggle", name: "powerScreenEnabled", - label: "Power Screen Enabled", - description: "Enable the Power Telemetry Screen", + label: t("telemetry.powerScreenEnabled.label"), + description: t("telemetry.powerScreenEnabled.description"), }, ], }, diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index 305b591f..6dd50f23 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -1,30 +1,25 @@ -import React from "react"; +import React, { useEffect, useState, useTransition } from "react"; import { SidebarSection } from "@components/UI/Sidebar/SidebarSection.tsx"; import { Subtle } from "@components/UI/Typography/Subtle.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import type { Page } from "@core/stores/deviceStore.ts"; import { Spinner } from "@components/UI/Spinner.tsx"; -import { Avatar } from "@components/UI/Avatar.tsx"; import { CircleChevronLeft, - CpuIcon, LayersIcon, type LucideIcon, MapIcon, MessageSquareIcon, - PenLine, - SearchIcon, SettingsIcon, UsersIcon, - ZapIcon, } from "lucide-react"; import { cn } from "@core/utils/cn.ts"; import { useSidebar } from "@core/stores/sidebarStore.tsx"; -import ThemeSwitcher from "@components/ThemeSwitcher.tsx"; import { useAppStore } from "@core/stores/appStore.ts"; -import BatteryStatus from "@components/BatteryStatus.tsx"; import { SidebarButton } from "@components/UI/Sidebar/SidebarButton.tsx"; +import { useTranslation } from "react-i18next"; +import { DeviceInfoPanel } from "./DeviceInfoPanel.tsx"; export interface SidebarProps { children?: React.ReactNode; @@ -39,7 +34,10 @@ interface NavLink { const CollapseToggleButton = () => { const { isCollapsed, toggleSidebar } = useSidebar(); - const buttonLabel = isCollapsed ? "Open sidebar" : "Close sidebar"; + const { t } = useTranslation("ui"); + const buttonLabel = isCollapsed + ? t("sidebar.collapseToggle.button.open") + : t("sidebar.collapseToggle.button.close"); return (
- + {pages.map((link) => ( { isCollapsed ? "opacity-0 invisible" : "opacity-100 visible", )} > - Loading... + {t("loading")}
) : ( - <> -
- -

- {myNode.user?.longName} -

-
- -
-
- -
-
- - - {myNode.deviceMetrics?.voltage?.toPrecision(3) ?? "UNK"} - {" "} - volts - -
-
- - v{myMetadata?.firmwareVersion ?? "UNK"} -
-
-
- - - -
- + setCommandPaletteOpen(true)} + setDialogOpen={() => setDialogOpen("deviceName", true)} + user={{ + longName: myNode?.user?.longName ?? t("unknown.longName"), + shortName: myNode?.user?.shortName ?? t("unknown.shortName"), + }} + firmwareVersion={myMetadata?.firmwareVersion ?? + t("unknown.firmwareVersion")} + deviceMetrics={{ + batteryLevel: myNode.deviceMetrics?.batteryLevel, + voltage: myNode.deviceMetrics?.voltage, + }} + /> )}
diff --git a/src/components/ThemeSwitcher.tsx b/src/components/ThemeSwitcher.tsx index 251ed2b3..ab147ce2 100644 --- a/src/components/ThemeSwitcher.tsx +++ b/src/components/ThemeSwitcher.tsx @@ -1,20 +1,35 @@ -import { useTheme } from "../core/hooks/useTheme.ts"; -import { cn } from "../core/utils/cn.ts"; +import { useTheme } from "@core/hooks/useTheme.ts"; +import { cn } from "@core/utils/cn.ts"; import { Monitor, Moon, Sun } from "lucide-react"; +import { useTranslation } from "react-i18next"; +import { Subtle } from "./UI/Typography/Subtle.tsx"; +import { Button } from "./UI/Button.tsx"; type ThemePreference = "light" | "dark" | "system"; -export default function ThemeSwitcher({ - className = "", -}: { +interface ThemeSwitcherProps { className?: string; -}) { + disableHover?: boolean; +} + +export default function ThemeSwitcher({ + className: passedClassName = "", + disableHover = false, +}: ThemeSwitcherProps) { const { preference, setPreference } = useTheme(); + const { t } = useTranslation("ui"); + + const iconBaseClass = + "size-4 flex-shrink-0 text-gray-500 dark:text-gray-400 transition-colors duration-150"; + const iconHoverClass = !disableHover + ? "group-hover:text-gray-700 dark:group-hover:text-gray-200" + : ""; + const combinedIconClass = cn(iconBaseClass, iconHoverClass); const themeIcons = { - light: , - dark: , - system: , + light: , + dark: , + system: , }; const toggleTheme = () => { @@ -24,26 +39,55 @@ export default function ThemeSwitcher({ setPreference(nextPreference); }; - const [firstCharOfPreference = "", ...restOfPreference] = preference; + const preferenceDisplayMap: Record = { + light: t("theme.light"), + dark: t("theme.dark"), + system: t("theme.system"), + }; + + const currentDisplayPreference = preferenceDisplayMap[preference]; return ( - + + {t("theme.changeTheme")} + + ); } diff --git a/src/components/UI/Avatar.tsx b/src/components/UI/Avatar.tsx index c60c0c2d..f9b0054d 100644 --- a/src/components/UI/Avatar.tsx +++ b/src/components/UI/Avatar.tsx @@ -7,6 +7,7 @@ import { TooltipProvider, TooltipTrigger, } from "@components/UI/Tooltip.tsx"; +import { useTranslation } from "react-i18next"; type RGBColor = { r: number; @@ -73,6 +74,8 @@ export const Avatar = ({ showFavorite = false, className, }: AvatarProps) => { + const { t } = useTranslation(); + const sizes = { sm: "size-10 text-xs font-light", lg: "size-16 text-lg", @@ -82,7 +85,7 @@ export const Avatar = ({ const bgColor = getColorFromText(safeText); const isLight = ColorUtils.isLight(bgColor); const textColor = isLight ? "#000000" : "#FFFFFF"; - const initials = safeText?.slice(0, 4) ?? "UNK"; + const initials = safeText?.slice(0, 4) ?? t("unknown.shortName"); return (
{ {...props} >

- - Powered by ▲ Vercel - {" "} - | Meshtastic® is a registered trademark of Meshtastic LLC. |{" "} - - Legal Information - + , + , + ]} + />

); diff --git a/src/components/UI/Input.tsx b/src/components/UI/Input.tsx index 5358d13a..81a072e7 100644 --- a/src/components/UI/Input.tsx +++ b/src/components/UI/Input.tsx @@ -4,6 +4,7 @@ import { cva, type VariantProps } from "class-variance-authority"; import { Check, Copy, Eye, EyeOff, type LucideIcon, X } from "lucide-react"; import { useCopyToClipboard } from "@core/hooks/useCopyToClipboard.ts"; import { usePasswordVisibilityToggle } from "@core/hooks/usePasswordVisibilityToggle.ts"; +import { useTranslation } from "react-i18next"; const inputVariants = cva( "flex h-10 w-full rounded-md border border-slate-300 bg-transparent py-2 px-3 text-sm placeholder:text-slate-400 focus:outline-none focus:ring-1 focus:ring-slate-400 disabled:cursor-not-allowed disabled:opacity-50 dark:border-slate-500 dark:bg-transparet dark:text-slate-100 dark:focus:ring-slate-400 dark:focus:ring-offset-slate-600", @@ -62,6 +63,7 @@ const Input = React.forwardRef( ) => { const { isVisible, toggleVisibility } = usePasswordVisibilityToggle(); const { copy, isCopied } = useCopyToClipboard({ timeout: 1500 }); + const { t } = useTranslation("ui"); const potentialActions: InputActionType[] = [ { @@ -80,8 +82,8 @@ const Input = React.forwardRef( ref.current.focus(); } }, - ariaLabel: "Clear input", - tooltip: "Clear input", + ariaLabel: t("clearInput.label"), + tooltip: t("clearInput.label"), condition: !!showClearButton && !!value, }, { @@ -91,8 +93,12 @@ const Input = React.forwardRef( e.stopPropagation(); toggleVisibility(); }, - ariaLabel: isVisible ? "Hide password" : "Show password", - tooltip: isVisible ? "Hide password" : "Show password", + ariaLabel: isVisible + ? t("notifications.hidePassword.label") + : t("notifications.showPassword.label"), + tooltip: isVisible + ? t("notifications.hidePassword.label") + : t("notifications.showPassword.label"), condition: !!showPasswordToggle && type === "password", }, { @@ -104,8 +110,12 @@ const Input = React.forwardRef( copy(String(value)); } }, - ariaLabel: isCopied ? "Copied!" : "Copy to clipboard", - tooltip: isCopied ? "Copied!" : "Copy to clipboard", + ariaLabel: isCopied + ? t("notifications.copied.label") + : t("notifications.copyToClipboard.label"), + tooltip: isCopied + ? t("notifications.copied.label") + : t("notifications.copyToClipboard.label"), condition: !!showCopyButton, }, ]; diff --git a/src/components/generic/Filter/FilterControl.tsx b/src/components/generic/Filter/FilterControl.tsx index 7e4f39aa..87ff3723 100644 --- a/src/components/generic/Filter/FilterControl.tsx +++ b/src/components/generic/Filter/FilterControl.tsx @@ -1,15 +1,19 @@ import { type ComponentProps, ReactNode, + useCallback, useEffect, useRef, useState, } from "react"; + import { Protobuf } from "@meshtastic/core"; +import { FunnelIcon } from "lucide-react"; +import { useTranslation } from "react-i18next"; +import type { TFunction } from "i18next"; + import { debounce } from "@core/utils/debounce.ts"; import { cn } from "@core/utils/cn.ts"; -import { TimeAgo } from "@components/generic/TimeAgo.tsx"; -import type { FilterState } from "@components/generic/Filter/useFilterNode.ts"; import { Popover, @@ -18,8 +22,8 @@ import { } from "@components/UI/Popover.tsx"; import { Input } from "@components/UI/Input.tsx"; import { Accordion } from "@components/UI/Accordion.tsx"; -import { FunnelIcon } from "lucide-react"; +import { TimeAgo } from "@components/generic/TimeAgo.tsx"; import { FilterAccordionItem, FilterMulti, @@ -27,6 +31,11 @@ import { FilterToggle, } from "@components/generic/Filter/FilterComponents.tsx"; +import type { FilterState } from "@components/generic/Filter/useFilterNode.ts"; + +const DEBOUNCE_DELAY_MS = 250; +const BATTERY_STATUS_PLUGGED_IN_VALUE = 101; + type PopoverContentProps = ComponentProps; interface FilterControlProps { @@ -40,10 +49,93 @@ interface FilterControlProps { popoverTriggerClassName?: string; showTextSearch?: boolean; }; - children?: ReactNode; } +interface HopsLabelProps { + hopsAway: number[]; + t: TFunction<"ui", undefined>; +} +function HopsLabelContent({ hopsAway, t }: HopsLabelProps) { + const startHops = hopsAway[0]; + const endHops = hopsAway[1]; + + return ( + <> + {t("hops.text", { + value: startHops === 0 ? t("hops.direct") : startHops, + })} + {startHops !== endHops ? ` — ${endHops}` : ""} + + ); +} + +interface LastHeardLabelProps { + lastHeardRange: number[]; + defaultMaxLastHeard: number; + formatTS: (ts: number) => ReactNode; + t: TFunction<"ui", undefined>; +} +function LastHeardLabelContent( + { lastHeardRange, defaultMaxLastHeard, formatTS, t }: LastHeardLabelProps, +) { + const [start, end] = lastHeardRange; + return ( + <> + {t("lastHeard.labelText", { value: "" })} +
+ {start === 0 + ? ( + t("lastHeard.nowLabel") + ) + : ( + <> + {start === defaultMaxLastHeard && ">"} + {formatTS(start)} + + )} + {start !== end && ( + <> + {" — "} + {end === defaultMaxLastHeard && ">"} + {formatTS(end)} + + )} + + ); +} + +interface BatteryLevelLabelProps { + batteryLevelRange: (number | undefined)[]; + t: TFunction<"ui", undefined>; +} +function BatteryLevelLabelContent( + { batteryLevelRange, t }: BatteryLevelLabelProps, +) { + const [start, end] = batteryLevelRange; + + const formatBatteryValue = (value: number | undefined) => { + if (value === undefined) return ""; + return value === BATTERY_STATUS_PLUGGED_IN_VALUE + ? t("batteryStatus.pluggedIn") + : `${value}%`; + }; + + return ( + <> + {t("batteryLevel.labelText", { + value: formatBatteryValue(start), + })} + {start !== end && typeof end !== "undefined" && ( + <> + {" – "} + {formatBatteryValue(end)} + + )} + + ); +} + export function FilterControl({ filterState, defaultFilterValues, @@ -52,69 +144,78 @@ export function FilterControl({ parameters, children, }: FilterControlProps) { - // Copy of the state that we only use for rendering sliders and their labels directly, rest is debounced + const { t } = useTranslation("ui"); const [localFilterState, setLocalFilterState] = useState(filterState); - const skipNextSync = useRef(false); + const skipNextFilterStateSync = useRef(false); + useEffect(() => { - if (skipNextSync.current) { - skipNextSync.current = false; + if (skipNextFilterStateSync.current) { + skipNextFilterStateSync.current = false; return; } setLocalFilterState(filterState); }, [filterState]); - const handleTextChange = + const handleTextChange = useCallback( (key: K) => (e: React.ChangeEvent) => { setFilterState((prev) => ({ ...prev, [key]: e.target.value, })); - }; - const handleRangeChange = + }, + [setFilterState], + ); + + const debouncedSetFilterState = useCallback( + debounce((key: K, value: number[]) => { + skipNextFilterStateSync.current = true; + setFilterState((prev) => ({ + ...prev, + [key]: value, + })); + }, DEBOUNCE_DELAY_MS), + [setFilterState], + ); + + const handleRangeChange = useCallback( (key: K) => (value: number[]) => { - // immediate slider update setLocalFilterState((prev) => ({ ...prev, [key]: value, })); + debouncedSetFilterState(key, value); + }, + [debouncedSetFilterState], + ); - // debounced write to filterState (table/map render) - debounce( - () => { - skipNextSync.current = true; - setFilterState((prev) => ({ - ...prev, - [key]: value, - })); - }, - 250, - )(); - }; - const handleBoolChange = ( - key: K, - value: string, - ) => { - const typedValue = value === "" - ? undefined - : JSON.parse(value.toLowerCase()); + const handleBoolChange = useCallback( + (key: K, value: string) => { + const typedValue = value === "" + ? undefined + : JSON.parse(value.toLowerCase()); - setFilterState((prev) => ({ - ...prev, - [key]: typedValue, - })); - }; + setFilterState((prev) => ({ + ...prev, + [key]: typedValue, + })); + }, + [setFilterState], + ); - const resetFilters = () => { + const resetFilters = useCallback(() => { setFilterState(defaultFilterValues); - }; + }, [defaultFilterValues, setFilterState]); - function formatTS(ts: number): ReactNode { - return ; - } - function formatEnumLabel(label: string): string { - return label.replace(/_/g, " "); - } + const formatTS = useCallback( + (ts: number): ReactNode => , + [], + ); + + const formatEnumLabel = useCallback( + (label: string): string => label.replace(/_/g, " "), + [], + ); return ( @@ -130,7 +231,7 @@ export function FilterControl({ : "", parameters?.popoverTriggerClassName, )} - aria-label="Filter" + aria-label={t("filter.label")} > {parameters?.triggerIcon ?? } @@ -145,135 +246,112 @@ export function FilterControl({
- + {(parameters?.showTextSearch ?? true) && (
)} - - Number of hops: {localFilterState.hopsAway[0] === 0 - ? "Direct" - : localFilterState.hopsAway[0]} - {localFilterState.hopsAway[0] !== - localFilterState.hopsAway[1] - ? " — " + localFilterState.hopsAway[1] - : ""} - + } /> - - Last heard:
- {localFilterState.lastHeard[0] === 0 ? "Now" : ( - <> - {localFilterState.lastHeard[0] === - defaultFilterValues.lastHeard[1] && ">"} - {formatTS(localFilterState.lastHeard[0])} - - )} - {localFilterState.lastHeard[0] !== - localFilterState.lastHeard[1] && ( - <> - {" — "} - {localFilterState.lastHeard[1] === - defaultFilterValues.lastHeard[1] && ">"} - {formatTS(localFilterState.lastHeard[1])} - - )} - + } />
- + - Battery level (%): {localFilterState.batteryLevel[0] === 101 - ? "Plugged in" - : localFilterState.batteryLevel[0]} - {localFilterState.batteryLevel[0] !== - localFilterState.batteryLevel[1] && ( - <> - {" – "} - {localFilterState.batteryLevel[1] === 101 - ? "Plugged in" - : localFilterState.batteryLevel[1]} - - )} - + } /> - + typeof v === "number", - )} + options={Object.values( + Protobuf.Config.Config_DeviceConfig_Role, + ).filter((v): v is number => typeof v === "number")} getLabel={(val) => formatEnumLabel( Protobuf.Config.Config_DeviceConfig_Role[val], )} /> - + + typeof v === "number", - )} + options={Object.values(Protobuf.Mesh.HardwareModel).filter( + (v): v is number => typeof v === "number", + )} getLabel={(val) => formatEnumLabel(Protobuf.Mesh.HardwareModel[val])} /> @@ -313,15 +390,11 @@ export function FilterControl({ - {children && ( -
- {children} -
- )} + {children &&
{children}
}
diff --git a/src/components/types.ts b/src/components/types.ts new file mode 100644 index 00000000..2fcf8d14 --- /dev/null +++ b/src/components/types.ts @@ -0,0 +1,4 @@ +export type DeviceMetrics = { + batteryLevel?: number | null; + voltage?: number | null; +}; diff --git a/src/core/hooks/useLang.ts b/src/core/hooks/useLang.ts new file mode 100644 index 00000000..62705bc3 --- /dev/null +++ b/src/core/hooks/useLang.ts @@ -0,0 +1,92 @@ +import { useCallback, useMemo } from "react"; +import { useTranslation } from "react-i18next"; +import { LangCode } from "@app/i18n/config.ts"; +import useLocalStorage from "./useLocalStorage.ts"; + +/** + * Hook to set the i18n language + * + * @returns The `set` function + */ +const STORAGE_KEY = "language"; + +type LanguageState = { + language: string; +}; +function useLang() { + const { i18n } = useTranslation(); + const [_, setLanguage] = useLocalStorage( + STORAGE_KEY, + null, + ); + + const regionNames = useMemo(() => { + return new Intl.DisplayNames(i18n.language, { + type: "region", + fallback: "none", + style: "long", + }); + }, [i18n.language]); + + const collator = useMemo(() => { + return new Intl.Collator(i18n.language, {}); + }, [i18n.language]); + + /** + * Sets the i18n language. + * + * @param lng - The language tag to set + */ + const set = useCallback( + async (lng: LangCode, persist = true) => { + if (i18n.language === lng) { + return; + } + console.info("set language:", lng); + if (persist) { + try { + setLanguage({ language: lng }); + } catch (e) { + console.warn(e); + } + await i18n.changeLanguage(lng); + } + }, + [i18n], + ); + + /** + * Get the localized country name + * + * @param code - Two-letter country code + */ + const getCountryName = useCallback( + (code: LangCode) => { + let name = null; + try { + name = regionNames.of(code); + } catch (e) { + console.warn(e); + } + return name; + }, + [regionNames], + ); + + /** + * Compare two strings according to the sort order of the current language + * + * @param a - The first string to compare + * @param b - The second string to compare + */ + const compare = useCallback( + (a: string, b: string) => { + return collator.compare(a, b); + }, + [collator], + ); + + return { compare, set, getCountryName }; +} + +export default useLang; diff --git a/src/core/hooks/usePositionFlags.ts b/src/core/hooks/usePositionFlags.ts index 95459372..cbc49822 100644 --- a/src/core/hooks/usePositionFlags.ts +++ b/src/core/hooks/usePositionFlags.ts @@ -1,27 +1,44 @@ import { useCallback, useMemo, useState } from "react"; -const FLAGS = { - UNSET: 0, - Altitude: 1, - "Altitude is Mean Sea Level": 2, - "Altitude Geoidal Seperation": 4, - "Dilution of precision (DOP) PDOP used by default": 8, - "If DOP is set, use HDOP / VDOP values instead of PDOP": 16, - "Number of satellites": 32, - "Sequence number": 64, - Timestamp: 128, - "Vehicle heading": 256, - "Vehicle speed": 512, +export const FLAGS_CONFIG = { + UNSET: { value: 0, i18nKey: "position.flags.unset" }, + ALTITUDE: { value: 1, i18nKey: "position.flags.altitude" }, + ALTITUDE_MSL: { value: 2, i18nKey: "position.flags.altitudeMsl" }, + ALTITUDE_GEOIDAL_SEPARATION: { + value: 4, + i18nKey: "position.flags.altitudeGeoidalSeparation", + }, + DOP: { + value: 8, + i18nKey: "position.flags.dop", + }, + HDOP_VDOP: { + value: 16, + i18nKey: "position.flags.hdopVdop", + }, + NUM_SATELLITES: { + value: 32, + i18nKey: "position.flags.numSatellites", + }, + SEQUENCE_NUMBER: { + value: 64, + i18nKey: "position.flags.sequenceNumber", + }, + TIMESTAMP: { value: 128, i18nKey: "position.flags.timestamp" }, + VEHICLE_HEADING: { + value: 256, + i18nKey: "position.flags.vehicleHeading", + }, + VEHICLE_SPEED: { value: 512, i18nKey: "position.flags.vehicleSpeed" }, } as const; -export type FlagName = keyof typeof FLAGS; -type FlagsObject = typeof FLAGS; +export type FlagName = keyof typeof FLAGS_CONFIG; type UsePositionFlagsProps = { decode: (value: number) => FlagName[]; encode: (flagNames: FlagName[]) => number; hasFlag: (value: number, flagName: FlagName) => boolean; - getAllFlags: () => FlagsObject; + getAllFlags: () => typeof FLAGS_CONFIG; isValidValue: (value: number) => boolean; flagsValue: number; activeFlags: FlagName[]; @@ -34,41 +51,52 @@ type UsePositionFlagsProps = { export const usePositionFlags = (initialValue = 0): UsePositionFlagsProps => { const [flagsValue, setFlagsValue] = useState(initialValue); + const FLAGS_BITMASKS = useMemo(() => { + return Object.fromEntries( + Object.entries(FLAGS_CONFIG).map(([key, conf]) => [key, conf.value]), + ) as { [K in FlagName]: typeof FLAGS_CONFIG[K]["value"] }; + }, []); + const utils = useMemo(() => { const decode = (value: number): FlagName[] => { - if (value === 0) return ["UNSET"]; + if (value === FLAGS_CONFIG.UNSET.value) return ["UNSET"]; const activeFlags: FlagName[] = []; - for (const [name, flagValue] of Object.entries(FLAGS)) { - if (flagValue !== 0 && (value & flagValue) === flagValue) { - activeFlags.push(name as FlagName); + for (const key in FLAGS_CONFIG) { + const flagName = key as FlagName; + const flagConfig = FLAGS_CONFIG[flagName]; + if ( + flagConfig.value !== 0 && + (value & flagConfig.value) === flagConfig.value + ) { + activeFlags.push(flagName); } } return activeFlags; }; const encode = (flagNames: FlagName[]): number => { - if (flagNames.includes("UNSET")) { - return 0; + if (flagNames.includes("UNSET") && flagNames.length === 1) { + return FLAGS_CONFIG.UNSET.value; } return flagNames.reduce((acc, name) => { - const value = FLAGS[name]; - return acc | value; + if (name === "UNSET") return acc; + return acc | FLAGS_CONFIG[name].value; }, 0); }; const hasFlag = (value: number, flagName: FlagName): boolean => { - const flagValue = FLAGS[flagName]; - return (value & flagValue) === flagValue; + return (value & FLAGS_CONFIG[flagName].value) === + FLAGS_CONFIG[flagName].value; }; - const getAllFlags = (): FlagsObject => { - return FLAGS; + const getAllFlags = (): typeof FLAGS_CONFIG => { + return FLAGS_CONFIG; }; const isValidValue = (value: number): boolean => { - const maxValue = Object.values(FLAGS) - .filter((val) => val !== 0) // Exclude UNSET (0) from the calculation + const maxValue = Object.values(FLAGS_BITMASKS) + .filter((val) => val !== 0) .reduce((acc, val) => acc | val, 0); return Number.isInteger(value) && value >= 0 && value <= maxValue; }; @@ -80,16 +108,17 @@ export const usePositionFlags = (initialValue = 0): UsePositionFlagsProps => { getAllFlags, isValidValue, }; - }, []); + }, [FLAGS_BITMASKS]); const toggleFlag = useCallback((flagName: FlagName) => { - const flagValue = FLAGS[flagName]; - setFlagsValue((prev) => prev ^ flagValue); + setFlagsValue((prev) => prev ^ FLAGS_CONFIG[flagName].value); }, []); const setFlag = useCallback((flagName: FlagName, enabled: boolean) => { - const flagValue = FLAGS[flagName]; - setFlagsValue((prev) => (enabled ? prev | flagValue : prev & ~flagValue)); + const currentFlagValue = FLAGS_CONFIG[flagName].value; + setFlagsValue((prev) => + enabled ? prev | currentFlagValue : prev & ~currentFlagValue + ); }, []); const setFlags = useCallback( @@ -103,7 +132,7 @@ export const usePositionFlags = (initialValue = 0): UsePositionFlagsProps => { ); const clearFlags = useCallback(() => { - setFlagsValue(0); + setFlagsValue(FLAGS_CONFIG.UNSET.value); }, []); const activeFlags = utils.decode(flagsValue); diff --git a/src/i18n/config.ts b/src/i18n/config.ts new file mode 100644 index 00000000..f530a4fe --- /dev/null +++ b/src/i18n/config.ts @@ -0,0 +1,52 @@ +import i18next from "i18next"; +import { initReactI18next } from "react-i18next"; +import Backend from "i18next-http-backend"; +import LanguageDetector from "i18next-browser-languagedetector"; + +export type Lang = { code: string; name: string; flag: string }; +export type LangCode = Lang["code"]; + +export const supportedLanguages: Lang[] = [ + // { code: "de", name: "Deutsch", flag: "🇩🇪" }, + { code: "en", name: "English", flag: "🇺🇸" }, + // { code: "es", name: "Español", flag: "🇪🇸" }, + // { code: "fr", name: "Français", flag: "🇫🇷" }, + // { code: "zh", name: "中文", flag: "🇨🇳" }, +]; + +i18next + .use(Backend) + .use(initReactI18next) + .use(LanguageDetector) + .init({ + backend: { + // this will lazy load resources from the i8n folder + loadPath: "/src/i18n/locales/{{lng}}/{{ns}}.json", + }, + react: { + useSuspense: true, + }, + detection: { + order: ["navigator", "localStorage"], + }, + fallbackLng: { + "en-US": ["en"], + "en-CA": ["en-US", "en"], + "default": ["en"], + }, + fallbackNS: ["common", "ui", "dialog"], + debug: import.meta.env.DEV, + supportedLngs: supportedLanguages?.map((lang) => lang.code), + ns: [ + "channels", + "commandPalette", + "common", + "deviceConfig", + "configModules", + "dashboard", + "dialog", + "messages", + "nodes", + "ui", + ], + }); diff --git a/src/i18n/locales/en/channels.json b/src/i18n/locales/en/channels.json new file mode 100644 index 00000000..535b8e6b --- /dev/null +++ b/src/i18n/locales/en/channels.json @@ -0,0 +1,69 @@ +{ + "page": { + "sectionLabel": "Channels", + "channelName": "Channel: {{channelName}}", + "broadcastLabel": "Primary", + "channelIndex": "Ch {{index}}" + }, + "validation": { + "pskInvalid": "Please enter a valid {{bits}} bit PSK." + }, + "settings": { + "label": "Channel Settings", + "description": "Crypto, MQTT & misc settings" + }, + "role": { + "label": "Role", + "description": "Device telemetry is sent over PRIMARY. Only one PRIMARY allowed", + "options": { + "primary": "PRIMARY", + "disabled": "DISABLED", + "secondary": "SECONDARY" + } + }, + "psk": { + "label": "Pre-Shared Key", + "description": "Supported PSK lengths: 256-bit, 128-bit, 8-bit, Empty (0-bit)", + "generate": "Generate" + }, + "name": { + "label": "Name", + "description": "A unique name for the channel <12 bytes, leave blank for default" + }, + "uplinkEnabled": { + "label": "Uplink Enabled", + "description": "Send messages from the local mesh to MQTT" + }, + "downlinkEnabled": { + "label": "Downlink Enabled", + "description": "Send messages from MQTT to the local mesh" + }, + "positionPrecision": { + "label": "Location", + "description": "The precision of the location to share with the channel. Can be disabled.", + "options": { + "none": "Do not share location", + "precise": "Precise Location", + "metric_km23": "Within 23 kilometers", + "metric_km12": "Within 12 kilometers", + "metric_km5_8": "Within 5.8 kilometers", + "metric_km2_9": "Within 2.9 kilometers", + "metric_km1_5": "Within 1.5 kilometers", + "metric_m700": "Within 700 meters", + "metric_m350": "Within 350 meters", + "metric_m200": "Within 200 meters", + "metric_m90": "Within 90 meters", + "metric_m50": "Within 50 meters", + "imperial_mi15": "Within 15 miles", + "imperial_mi7_3": "Within 7.3 miles", + "imperial_mi3_6": "Within 3.6 miles", + "imperial_mi1_8": "Within 1.8 miles", + "imperial_mi0_9": "Within 0.9 miles", + "imperial_mi0_5": "Within 0.5 miles", + "imperial_mi0_2": "Within 0.2 miles", + "imperial_ft600": "Within 600 feet", + "imperial_ft300": "Within 300 feet", + "imperial_ft150": "Within 150 feet" + } + } +} diff --git a/src/i18n/locales/en/commandPalette.json b/src/i18n/locales/en/commandPalette.json new file mode 100644 index 00000000..7b82e97b --- /dev/null +++ b/src/i18n/locales/en/commandPalette.json @@ -0,0 +1,50 @@ +{ + "emptyState": "No results found.", + "page": { + "title": "Command Palette" + }, + "pinGroup": { + "label": "Pin command group" + }, + "unpinGroup": { + "label": "Unpin command group" + }, + "goto": { + "label": "Goto", + "command": { + "messages": "Messages", + "map": "Map", + "config": "Config", + "channels": "Channels", + "nodes": "Nodes" + } + }, + "manage": { + "label": "Manage", + "command": { + "switchNode": "Switch Node", + "connectNewNode": "Connect New Node" + } + }, + "contextual": { + "label": "Contextual", + "command": { + "qrCode": "QR Code", + "qrGenerator": "Generator", + "qrImport": "Import", + "scheduleShutdown": "Schedule Shutdown", + "scheduleReboot": "Schedule Reboot", + "rebootToOtaMode": "Reboot To OTA Mode", + "resetNodeDb": "Reset Node DB", + "factoryResetDevice": "Factory Reset Device", + "factoryResetConfig": "Factory Reset Config" + } + }, + "debug": { + "label": "Debug", + "command": { + "reconfigure": "Reconfigure", + "clearAllStoredMessages": "Clear All Stored Message" + } + } +} diff --git a/src/i18n/locales/en/common.json b/src/i18n/locales/en/common.json new file mode 100644 index 00000000..b54b8f88 --- /dev/null +++ b/src/i18n/locales/en/common.json @@ -0,0 +1,73 @@ +{ + "button": { + "apply": "Apply", + "backupKey": "Backup Key", + "cancel": "Cancel", + "clearMessages": "Clear Messages", + "close": "Close", + "confirm": "Confirm", + "delete": "Delete", + "dismiss": "Dismiss", + "download": "Download", + "export": "Export", + "generate": "Generate", + "regenerate": "Regenerate", + "import": "Import", + "message": "Message", + "now": "Now", + "ok": "OK", + "print": "Print", + "rebootOtaNow": "Reboot to OTA Mode Now", + "remove": "Remove", + "requestNewKeys": "Request New Keys", + "requestPosition": "Request Position", + "reset": "Reset", + "save": "Save", + "scanQr": "Scan QR Code", + "traceRoute": "Trace Route" + }, + "app": { + "title": "Meshtastic", + "fullTitle": "Meshtastic Web Client" + }, + "loading": "Loading...", + "unit": { + "cps": "CPS", + "dbm": "dBm", + "hertz": "Hz", + "hop": { + "one": "Hop", + "plural": "Hops" + }, + "hopsAway": { + "one": "{{count}} hop away", + "plural": "{{count}} hops away", + "unknown": "Unknown hops away" + }, + "megahertz": "MHz", + "raw": "raw", + "meter": { "one": "Meter", "plural": "Meters", "suffix": "m" }, + "minute": { "one": "Minute", "plural": "Minutes" }, + "millisecond": { + "one": "Millisecond", + "plural": "Milliseconds", + "suffix": "ms" + }, + "second": { "one": "Second", "plural": "Seconds" }, + "snr": "SNR", + "volt": { "one": "Volt", "plural": "Volts", "suffix": "V" }, + "record": { "one": "Records", "plural": "Records" } + }, + "security": { + "256bit": "256 bit" + }, + "unknown": { + "longName": "Unknown", + "shortName": "UNK", + "notAvailable": "N/A", + "num": "??" + }, + "nodeUnknownPrefix": "!", + "unset": "UNSET", + "fallbackName": "Meshtastic {{last4}}" +} diff --git a/src/i18n/locales/en/dashboard.json b/src/i18n/locales/en/dashboard.json new file mode 100644 index 00000000..3a3cd869 --- /dev/null +++ b/src/i18n/locales/en/dashboard.json @@ -0,0 +1,12 @@ +{ + "dashboard": { + "title": "Connected Devices", + "description": "Manage your connected Meshtastic devices.", + "connectionType_ble": "BLE", + "connectionType_serial": "Serial", + "connectionType_network": "Network", + "noDevicesTitle": "No devices connected", + "noDevicesDescription": "Connect a new device to get started.", + "button_newConnection": "New Connection" + } +} diff --git a/src/i18n/locales/en/deviceConfig.json b/src/i18n/locales/en/deviceConfig.json new file mode 100644 index 00000000..0fc9314e --- /dev/null +++ b/src/i18n/locales/en/deviceConfig.json @@ -0,0 +1,442 @@ +{ + "page": { + "title": "Configuration", + "tabBluetooth": "Bluetooth", + "tabDevice": "Device", + "tabDisplay": "Display", + "tabLora": "LoRa", + "tabNetwork": "Network", + "tabPosition": "Position", + "tabPower": "Power", + "tabSecurity": "Security" + }, + "sidebar": { + "label": "Modules" + }, + "device": { + "title": "Device Settings", + "description": "Settings for the device", + "buttonPin": { + "description": "Button pin override", + "label": "Button Pin" + }, + "buzzerPin": { + "description": "Buzzer pin override", + "label": "Buzzer Pin" + }, + "disableTripleClick": { + "description": "Disable triple click", + "label": "Disable Triple Click" + }, + "doubleTapAsButtonPress": { + "description": "Treat double tap as button press", + "label": "Double Tap as Button Press" + }, + "ledHeartbeatDisabled": { + "description": "Disable default blinking LED", + "label": "LED Heartbeat Disabled" + }, + "nodeInfoBroadcastInterval": { + "description": "How often to broadcast node info", + "label": "Node Info Broadcast Interval" + }, + "posixTimezone": { + "description": "The POSIX timezone string for the device", + "label": "POSIX Timezone" + }, + "rebroadcastMode": { + "description": "How to handle rebroadcasting", + "label": "Rebroadcast Mode" + }, + "role": { + "description": "What role the device performs on the mesh", + "label": "Role" + } + }, + "bluetooth": { + "title": "Bluetooth Settings", + "description": "Settings for the Bluetooth module", + "note": "Note: Some devices (ESP32) cannot use both Bluetooth and WiFi at the same time.", + "enabled": { + "description": "Enable or disable Bluetooth", + "label": "Enabled" + }, + "pairingMode": { + "description": "Pin selection behaviour.", + "label": "Pairing mode" + }, + "pin": { + "description": "Pin to use when pairing", + "label": "Pin" + }, + "validation": { + "pinCannotStartWithZero": "Bluetooth Pin cannot start with 0", + "pinMustBeSixDigits": "Pin must be 6 digits", + "pinRequired": "Bluetooth Pin is required" + } + }, + "display": { + "description": "Settings for the device display", + "title": "Display Settings", + "headingBold": { + "description": "Bolden the heading text", + "label": "Bold Heading" + }, + "carouselDelay": { + "description": "How fast to cycle through windows", + "label": "Carousel Delay" + }, + "compassNorthTop": { + "description": "Fix north to the top of compass", + "label": "Compass North Top" + }, + "displayMode": { + "description": "Screen layout variant", + "label": "Display Mode" + }, + "displayUnits": { + "description": "Display metric or imperial units", + "label": "Display Units" + }, + "flipScreen": { + "description": "Flip display 180 degrees", + "label": "Flip Screen" + }, + "gpsDisplayUnits": { + "description": "Coordinate display format", + "label": "GPS Display Units" + }, + "oledType": { + "description": "Type of OLED screen attached to the device", + "label": "OLED Type" + }, + "screenTimeout": { + "description": "Turn off the display after this long", + "label": "Screen Timeout" + }, + "twelveHourClock": { + "description": "Use 12-hour clock format", + "label": "12-Hour Clock" + }, + "wakeOnTapOrMotion": { + "description": "Wake the device on tap or motion", + "label": "Wake on Tap or Motion" + } + }, + "lora": { + "title": "Mesh Settings", + "description": "Settings for the LoRa mesh", + "bandwidth": { + "description": "Channel bandwidth in MHz", + "label": "Bandwidth" + }, + "boostedRxGain": { + "description": "Boosted RX gain", + "label": "Boosted RX Gain" + }, + "codingRate": { + "description": "The denominator of the coding rate", + "label": "Coding Rate" + }, + "frequencyOffset": { + "description": "Frequency offset to correct for crystal calibration errors", + "label": "Frequency Offset" + }, + "frequencySlot": { + "description": "LoRa frequency channel number", + "label": "Frequency Slot" + }, + "hopLimit": { + "description": "Maximum number of hops", + "label": "Hop Limit" + }, + "ignoreMqtt": { + "description": "Don't forward MQTT messages over the mesh", + "label": "Ignore MQTT" + }, + "modemPreset": { + "description": "Modem preset to use", + "label": "Modem Preset" + }, + "okToMqtt": { + "description": "When set to true, this configuration indicates that the user approves the packet to be uploaded to MQTT. If set to false, remote nodes are requested not to forward packets to MQTT", + "label": "OK to MQTT" + }, + "overrideDutyCycle": { + "description": "Override Duty Cycle", + "label": "Override Duty Cycle" + }, + "overrideFrequency": { + "description": "Override frequency", + "label": "Override Frequency" + }, + "region": { + "description": "Sets the region for your node", + "label": "Region" + }, + "spreadingFactor": { + "description": "Indicates the number of chirps per symbol", + "label": "Spreading Factor" + }, + "transmitEnabled": { + "description": "Enable/Disable transmit (TX) from the LoRa radio", + "label": "Transmit Enabled" + }, + "transmitPower": { + "description": "Max transmit power", + "label": "Transmit Power" + }, + "usePreset": { + "description": "Use one of the predefined modem presets", + "label": "Use Preset" + }, + "meshSettings": { + "description": "Settings for the LoRa mesh", + "label": "Mesh Settings" + }, + "waveformSettings": { + "description": "Settings for the LoRa waveform", + "label": "Waveform Settings" + }, + "radioSettings": { + "label": "Radio Settings", + "description": "Settings for the LoRa radio" + } + }, + "network": { + "title": "WiFi Config", + "description": "WiFi radio configuration", + "note": "Note: Some devices (ESP32) cannot use both Bluetooth and WiFi at the same time.", + "addressMode": { + "description": "Address assignment selection", + "label": "Address Mode" + }, + "dns": { + "description": "DNS Server", + "label": "DNS" + }, + "ethernetEnabled": { + "description": "Enable or disable the Ethernet port", + "label": "Enabled" + }, + "gateway": { + "description": "Default Gateway", + "label": "Gateway" + }, + "ip": { + "description": "IP Address", + "label": "IP" + }, + "psk": { + "description": "Network password", + "label": "PSK" + }, + "ssid": { + "description": "Network name", + "label": "SSID" + }, + "subnet": { + "description": "Subnet Mask", + "label": "Subnet" + }, + "wifiEnabled": { + "description": "Enable or disable the WiFi radio", + "label": "Enabled" + }, + "meshViaUdp": { + "label": "Mesh via UDP" + }, + "ntpServer": { + "label": "NTP Server" + }, + "rsyslogServer": { + "label": "Rsyslog Server" + }, + "ethernetConfigSettings": { + "description": "Ethernet port configuration", + "label": "Ethernet Config" + }, + "ipConfigSettings": { + "description": "IP configuration", + "label": "IP Config" + }, + "ntpConfigSettings": { + "description": "NTP configuration", + "label": "NTP Config" + }, + "rsyslogConfigSettings": { + "description": "Rsyslog configuration", + "label": "Rsyslog Config" + }, + "udpConfigSettings": { + "description": "UDP over Mesh configuration", + "label": "UDP Config" + } + }, + "position": { + "title": "Position Settings", + "description": "Settings for the position module", + "broadcastInterval": { + "description": "How often your position is sent out over the mesh", + "label": "Broadcast Interval" + }, + "enablePin": { + "description": "GPS module enable pin override", + "label": "Enable Pin" + }, + "fixedPosition": { + "description": "Don't report GPS position, but a manually-specified one", + "label": "Fixed Position" + }, + "gpsMode": { + "description": "Configure whether device GPS is Enabled, Disabled, or Not Present", + "label": "GPS Mode" + }, + "gpsUpdateInterval": { + "description": "How often a GPS fix should be acquired", + "label": "GPS Update Interval" + }, + "positionFlags": { + "description": "Optional fields to include when assembling position messages. The more fields are selected, the larger the message will be leading to longer airtime usage and a higher risk of packet loss.", + "label": "Position Flags" + }, + "receivePin": { + "description": "GPS module RX pin override", + "label": "Receive Pin" + }, + "smartPositionEnabled": { + "description": "Only send position when there has been a meaningful change in location", + "label": "Enable Smart Position" + }, + "smartPositionMinDistance": { + "description": "Minimum distance (in meters) that must be traveled before a position update is sent", + "label": "Smart Position Minimum Distance" + }, + "smartPositionMinInterval": { + "description": "Minimum interval (in seconds) that must pass before a position update is sent", + "label": "Smart Position Minimum Interval" + }, + "transmitPin": { + "description": "GPS module TX pin override", + "label": "Transmit Pin" + }, + "intervalsSettings": { + "description": "How often to send position updates", + "label": "Intervals" + }, + "flags": { + "placeholder": "Select position flags...", + "altitude": "Altitude", + "altitudeGeoidalSeparation": "Altitude Geoidal Separation", + "altitudeMsl": "Altitude is Mean Sea Level", + "dop": "Dilution of precision (DOP) PDOP used by default", + "hdopVdop": "If DOP is set, use HDOP / VDOP values instead of PDOP", + "numSatellites": "Number of satellites", + "sequenceNumber": "Sequence number", + "timestamp": "Timestamp", + "unset": "Unset", + "vehicleHeading": "Vehicle heading", + "vehicleSpeed": "Vehicle speed" + } + }, + "power": { + "adcMultiplierOverride": { + "description": "Used for tweaking battery voltage reading", + "label": "ADC Multiplier Override ratio" + }, + "ina219Address": { + "description": "Address of the INA219 battery monitor", + "label": "INA219 Address" + }, + "lightSleepDuration": { + "description": "How long the device will be in light sleep for", + "label": "Light Sleep Duration" + }, + "minimumWakeTime": { + "description": "Minimum amount of time the device will stay awake for after receiving a packet", + "label": "Minimum Wake Time" + }, + "noConnectionBluetoothDisabled": { + "description": "If the device does not receive a Bluetooth connection, the BLE radio will be disabled after this long", + "label": "No Connection Bluetooth Disabled" + }, + "powerSavingEnabled": { + "description": "Select if powered from a low-current source (i.e. solar), to minimize power consumption as much as possible.", + "label": "Enable power saving mode" + }, + "shutdownOnBatteryDelay": { + "description": "Automatically shutdown node after this long when on battery, 0 for indefinite", + "label": "Shutdown on battery delay" + }, + "superDeepSleepDuration": { + "description": "How long the device will be in super deep sleep for", + "label": "Super Deep Sleep Duration" + }, + "powerConfigSettings": { + "description": "Settings for the power module", + "label": "Power Config" + }, + "sleepSettings": { + "description": "Sleep settings for the power module", + "label": "Sleep Settings" + } + }, + "security": { + "description": "Settings for the Security configuration", + "title": "Security Settings", + "button_backupKey": "Backup Key", + "adminChannelEnabled": { + "description": "Allow incoming device control over the insecure legacy admin channel", + "label": "Allow Legacy Admin" + }, + "enableDebugLogApi": { + "description": "Output live debug logging over serial, view and export position-redacted device logs over Bluetooth", + "label": "Enable Debug Log API" + }, + "managed": { + "description": "If enabled, device configuration options are only able to be changed remotely by a Remote Admin node via admin messages. Do not enable this option unless at least one suitable Remote Admin node has been setup, and the public key is stored in one of the fields above.", + "label": "Managed" + }, + "privateKey": { + "description": "Used to create a shared key with a remote device", + "label": "Private Key" + }, + "publicKey": { + "description": "Sent out to other nodes on the mesh to allow them to compute a shared secret key", + "label": "Public Key" + }, + "primaryAdminKey": { + "description": "The primary public key authorized to send admin messages to this node", + "label": "Primary Admin Key" + }, + "secondaryAdminKey": { + "description": "The secondary public key authorized to send admin messages to this node", + "label": "Secondary Admin Key" + }, + "serialOutputEnabled": { + "description": "Serial Console over the Stream API", + "label": "Serial Output Enabled" + }, + "tertiaryAdminKey": { + "description": "The tertiary public key authorized to send admin messages to this node", + "label": "Tertiary Admin Key" + }, + "adminSettings": { + "description": "Settings for Admin", + "label": "Admin Settings" + }, + "loggingSettings": { + "description": "Settings for Logging", + "label": "Logging Settings" + }, + "validation": { + "adminKeyMustBe256BitPsk": "Admin Key is required to be a 256 bit pre-shared key (PSK)", + "adminKeyRequiredWhenManaged": "At least one admin key is requred if the node is managed.", + "enterValid256BitPsk": "Please enter a valid 256 bit PSK", + "invalidAdminKeyFormat": "Invalid Admin Key format", + "invalidPrivateKeyFormat": "Invalid Private Key format", + "privateKeyMustBe256BitPsk": "Private Key is required to be a 256 bit pre-shared key (PSK)", + "privateKeyRequired": "Private Key is required" + } + } +} diff --git a/src/i18n/locales/en/dialog.json b/src/i18n/locales/en/dialog.json new file mode 100644 index 00000000..23393156 --- /dev/null +++ b/src/i18n/locales/en/dialog.json @@ -0,0 +1,160 @@ +{ + "deleteMessages": { + "description": "This action will clear all message history. This cannot be undone. Are you sure you want to continue?", + "title": "Clear All Messages" + }, + "deviceName": { + "description": "The Device will restart once the config is saved.", + "longName": "Long Name", + "shortName": "Short Name", + "title": "Change Device Name" + }, + "import": { + "description": "The current LoRa configuration will be overridden.", + "error": { + "invalidUrl": "Invalid Meshtastic URL" + }, + "channelPrefix": "Channel: ", + "channelSetUrl": "Channel Set/QR Code URL", + "channels": "Channels:", + "usePreset": "Use Preset?", + "title": "Import Channel Set" + }, + "locationResponse": { + "altitude": "Altitude: ", + "coordinates": "Coordinates: ", + "title": "Location: {{identifier}}" + }, + "pkiRegenerateDialog": { + "title": "Regenerate Pre-Shared Key?", + "description": "Are you sure you want to regenerate the pre-shared key?", + "regenerate": "Regenerate" + }, + "newDeviceDialog": { + "title": "Connect New Device", + "https": "https", + "http": "http", + "tabHttp": "HTTP", + "tabBluetooth": "Bluetooth", + "tabSerial": "Serial", + + "useHttps": "Use HTTPS", + "connecting": "Connecting...", + "connect": "Connect", + "connectionFailedAlert": { + "title": "Connection Failed", + "descriptionPrefix": "Could not connect to the device. ", + "httpsHint": "If using HTTPS, you may need to accept a self-signed certificate first. ", + "openLinkPrefix": "Please open ", + "openLinkSuffix": " in a new tab", + "acceptTlsWarningSuffix": ", accept any TLS warnings if prompted, then try again", + "learnMoreLink": "Learn more" + }, + "httpConnection": { + "label": "IP Address/Hostname", + "placeholder": "000.000.000.000 / meshtastic.local" + }, + "serialConnection": { + "noDevicesPaired": "No devices paired yet.", + "newDeviceButton": "New device", + "deviceIdentifier": "# {{index}} - {{vendorId}} - {{productId}}" + }, + "bluetoothConnection": { + "noDevicesPaired": "No devices paired yet.", + "newDeviceButton": "New device" + }, + "validation": { + "requiresFeatures": "This connection type requires <0>. Please use a supported browser, like Chrome or Edge.", + "requiresSecureContext": "This application requires a <0>secure context. Please connect using HTTPS or localhost.", + "additionallyRequiresSecureContext": "Additionally, it requires a <0>secure context. Please connect using HTTPS or localhost." + } + }, + "nodeDetails": { + "message": "Message", + "requestPosition": "Request Position", + "traceRoute": "Trace Route", + "airTxUtilization": "Air TX utilization", + "allRawMetrics": "All Raw Metrics:", + "batteryLevel": "Battery level", + "channelUtilization": "Channel utilization", + "details": "Details:", + "deviceMetrics": "Device Metrics:", + "hardware": "Hardware: ", + "lastHeard": "Last Heard: ", + "nodeHexPrefix": "Node Hex: !", + "nodeNumber": "Node Number: ", + "position": "Position:", + "role": "Role: ", + "uptime": "Uptime: ", + "voltage": "Voltage", + "title": "Node Details for {{identifier}}", + "ignoreNode": "Ignore node", + "removeNode": "Remove node", + "unignoreNode": "Unignore node" + }, + "pkiBackup": { + "description": "We recommend backing up your key data regularly. Would you like to back up now?", + "loseKeysWarning": "If you lose your keys, you will need to reset your device.", + "secureBackup": "Its important to backup your public and private keys and store your backup securely!", + "footer": "=== END OF KEYS ===", + "header": "=== MESHTASTIC KEYS FOR {{longName}} ({{shortName}}) ===", + "privateKey": "Private Key:", + "publicKey": "Public Key:", + "fileName": "meshtastic_keys_{{longName}}_{{shortName}}.txt", + "title": "Backup Keys" + }, + "pkiRegenerate": { + "description": "Are you sure you want to regenerate key pair?", + "title": "Regenerate Key Pair" + }, + "qr": { + "addChannels": "Add Channels", + "replaceChannels": "Replace Channels", + "description": "The current LoRa configuration will also be shared.", + "sharableUrl": "Sharable URL", + "title": "Generate QR Code" + }, + "rebootOta": { + "title": "Schedule Reboot", + "description": "Reboot the connected node after a delay into OTA (Over-the-Air) mode.", + "enterDelay": "Enter delay (sec)", + "scheduled": "Reboot has been scheduled" + }, + "reboot": { + "title": "Schedule Reboot", + "description": "Reboot the connected node after x minutes." + }, + "refreshKeys": { + "description": { + "acceptNewKeys": "This will remove the node from device and request new keys.", + "keyMismatchReasonSuffix": ". This is due to the remote node's current public key does not match the previously stored key for this node.", + "unableToSendDmPrefix": "Your node is unable to send a direct message to node: " + }, + "acceptNewKeys": "Accept New Keys", + "title": "Keys Mismatch - {{identifier}}" + }, + "removeNode": { + "description": "Are you sure you want to remove this Node?", + "title": "Remove Node?" + }, + "shutdown": { + "title": "Schedule Shutdown", + "description": "Turn off the connected node after x minutes." + }, + "traceRoute": { + "routeToDestination": "Route to destination:", + "routeBack": "Route back:" + }, + "tracerouteResponse": { + "title": "Traceroute: {{identifier}}" + }, + "unsafeRoles": { + "confirmUnderstanding": "Yes, I know what I'm doing", + "conjunction": " and the blog post about ", + "postamble": " and understand the implications of changing the role.", + "preamble": "I have read the ", + "choosingRightDeviceRole": "Choosing The Right Device Role", + "deviceRoleDocumentation": "Device Role Documentation", + "title": "Are you sure?" + } +} diff --git a/src/i18n/locales/en/messages.json b/src/i18n/locales/en/messages.json new file mode 100644 index 00000000..40ba3394 --- /dev/null +++ b/src/i18n/locales/en/messages.json @@ -0,0 +1,37 @@ +{ + "page": { + "title": "Messages: {{chatName}}" + }, + "emptyState": { + "title": "Select a Chat", + "text": "No messages yet." + }, + "selectChatPrompt": { + "text": "Select a channel or node to start messaging." + }, + "actionsMenu": { + "addReactionLabel": "Add Reaction", + "replyLabel": "Reply" + }, + + "item": { + "status": { + "delivered": { + "label": "Message delivered", + "displayText": "Message delivered" + }, + "failed": { + "label": "Message delivery failed", + "displayText": "Delivery failed" + }, + "unknown": { + "label": "Message status unknown", + "displayText": "Unknown state" + }, + "waiting": { + "ariaLabel": "Sending message", + "displayText": "Waiting for delivery" + } + } + } +} diff --git a/src/i18n/locales/en/moduleConfig.json b/src/i18n/locales/en/moduleConfig.json new file mode 100644 index 00000000..dedf5654 --- /dev/null +++ b/src/i18n/locales/en/moduleConfig.json @@ -0,0 +1,448 @@ +{ + "page": { + "tabAmbientLighting": "Ambient Lighting", + "tabAudio": "Audio", + "tabCannedMessage": "Canned", + "tabDetectionSensor": "Detection Sensor", + "tabExternalNotification": "Ext Notif", + "tabMqtt": "MQTT", + "tabNeighborInfo": "Neighbor Info", + "tabPaxcounter": "Paxcounter", + "tabRangeTest": "Range Test", + "tabSerial": "Serial", + "tabStoreAndForward": "S&F", + "tabTelemetry": "Telemetry" + }, + "ambientLighting": { + "title": "Ambient Lighting Settings", + "description": "Settings for the Ambient Lighting module", + "ledState": { + "label": "LED State", + "description": "Sets LED to on or off" + }, + "current": { + "label": "Current", + "description": "Sets the current for the LED output. Default is 10" + }, + "red": { + "label": "Red", + "description": "Sets the red LED level. Values are 0-255" + }, + "green": { + "label": "Green", + "description": "Sets the green LED level. Values are 0-255" + }, + "blue": { + "label": "Blue", + "description": "Sets the blue LED level. Values are 0-255" + } + }, + "audio": { + "title": "Audio Settings", + "description": "Settings for the Audio module", + "codec2Enabled": { + "label": "Codec 2 Enabled", + "description": "Enable Codec 2 audio encoding" + }, + "pttPin": { + "label": "PTT Pin", + "description": "GPIO pin to use for PTT" + }, + "bitrate": { + "label": "Bitrate", + "description": "Bitrate to use for audio encoding" + }, + "i2sWs": { + "label": "i2S WS", + "description": "GPIO pin to use for i2S WS" + }, + "i2sSd": { + "label": "i2S SD", + "description": "GPIO pin to use for i2S SD" + }, + "i2sDin": { + "label": "i2S DIN", + "description": "GPIO pin to use for i2S DIN" + }, + "i2sSck": { + "label": "i2S SCK", + "description": "GPIO pin to use for i2S SCK" + } + }, + "cannedMessage": { + "title": "Canned Message Settings", + "description": "Settings for the Canned Message module", + "moduleEnabled": { + "label": "Module Enabled", + "description": "Enable Canned Message" + }, + "rotary1Enabled": { + "label": "Rotary Encoder #1 Enabled", + "description": "Enable the rotary encoder" + }, + "inputbrokerPinA": { + "label": "Encoder Pin A", + "description": "GPIO Pin Value (1-39) For encoder port A" + }, + "inputbrokerPinB": { + "label": "Encoder Pin B", + "description": "GPIO Pin Value (1-39) For encoder port B" + }, + "inputbrokerPinPress": { + "label": "Encoder Pin Press", + "description": "GPIO Pin Value (1-39) For encoder Press" + }, + "inputbrokerEventCw": { + "label": "Clockwise event", + "description": "Select input event." + }, + "inputbrokerEventCcw": { + "label": "Counter Clockwise event", + "description": "Select input event." + }, + "inputbrokerEventPress": { + "label": "Press event", + "description": "Select input event" + }, + "updown1Enabled": { + "label": "Up Down enabled", + "description": "Enable the up / down encoder" + }, + "allowInputSource": { + "label": "Allow Input Source", + "description": "Select from: '_any', 'rotEnc1', 'upDownEnc1', 'cardkb'" + }, + "sendBell": { + "label": "Send Bell", + "description": "Sends a bell character with each message" + } + }, + "detectionSensor": { + "title": "Detection Sensor Settings", + "description": "Settings for the Detection Sensor module", + "enabled": { + "label": "Enabled", + "description": "Enable or disable Detection Sensor Module" + }, + "minimumBroadcastSecs": { + "label": "Minimum Broadcast Seconds", + "description": "The interval in seconds of how often we can send a message to the mesh when a state change is detected" + }, + "stateBroadcastSecs": { + "label": "State Broadcast Seconds", + "description": "The interval in seconds of how often we should send a message to the mesh with the current state regardless of changes" + }, + "sendBell": { + "label": "Send Bell", + "description": "Send ASCII bell with alert message" + }, + "name": { + "label": "Friendly Name", + "description": "Used to format the message sent to mesh, max 20 Characters" + }, + "monitorPin": { + "label": "Monitor Pin", + "description": "The GPIO pin to monitor for state changes" + }, + "detectionTriggeredHigh": { + "label": "Detection Triggered High", + "description": "Whether or not the GPIO pin state detection is triggered on HIGH (1), otherwise LOW (0)" + }, + "usePullup": { + "label": "Use Pullup", + "description": "Whether or not use INPUT_PULLUP mode for GPIO pin" + } + }, + "externalNotification": { + "title": "External Notification Settings", + "description": "Configure the external notification module", + "enabled": { + "label": "Module Enabled", + "description": "Enable External Notification" + }, + "outputMs": { + "label": "Output MS", + "description": "Output MS" + }, + "output": { + "label": "Output", + "description": "Output" + }, + "outputVibra": { + "label": "Output Vibrate", + "description": "Output Vibrate" + }, + "outputBuzzer": { + "label": "Output Buzzer", + "description": "Output Buzzer" + }, + "active": { + "label": "Active", + "description": "Active" + }, + "alertMessage": { + "label": "Alert Message", + "description": "Alert Message" + }, + "alertMessageVibra": { + "label": "Alert Message Vibrate", + "description": "Alert Message Vibrate" + }, + "alertMessageBuzzer": { + "label": "Alert Message Buzzer", + "description": "Alert Message Buzzer" + }, + "alertBell": { + "label": "Alert Bell", + "description": "Should an alert be triggered when receiving an incoming bell?" + }, + "alertBellVibra": { + "label": "Alert Bell Vibrate", + "description": "Alert Bell Vibrate" + }, + "alertBellBuzzer": { + "label": "Alert Bell Buzzer", + "description": "Alert Bell Buzzer" + }, + "usePwm": { + "label": "Use PWM", + "description": "Use PWM" + }, + "nagTimeout": { + "label": "Nag Timeout", + "description": "Nag Timeout" + }, + "useI2sAsBuzzer": { + "label": "Use I²S Pin as Buzzer", + "description": "Designate I²S Pin as Buzzer Output" + } + }, + "mqtt": { + "title": "MQTT Settings", + "description": "Settings for the MQTT module", + "enabled": { + "label": "Enabled", + "description": "Enable or disable MQTT" + }, + "address": { + "label": "MQTT Server Address", + "description": "MQTT server address to use for default/custom servers" + }, + "username": { + "label": "MQTT Username", + "description": "MQTT username to use for default/custom servers" + }, + "password": { + "label": "MQTT Password", + "description": "MQTT password to use for default/custom servers" + }, + "encryptionEnabled": { + "label": "Encryption Enabled", + "description": "Enable or disable MQTT encryption. Note: All messages are sent to the MQTT broker unencrypted if this option is not enabled, even when your uplink channels have encryption keys set. This includes position data." + }, + "jsonEnabled": { + "label": "JSON Enabled", + "description": "Whether to send/consume JSON packets on MQTT" + }, + "tlsEnabled": { + "label": "TLS Enabled", + "description": "Enable or disable TLS" + }, + "root": { + "label": "Root topic", + "description": "MQTT root topic to use for default/custom servers" + }, + "proxyToClientEnabled": { + "label": "Proxy to Client Enabled", + "description": "Use the client's internet connection for MQTT (feature only active in mobile apps)" + }, + "mapReportingEnabled": { + "label": "Map Reporting Enabled", + "description": "Enable or disable map reporting" + }, + "mapReportSettings": { + "publishIntervalSecs": { + "label": "Map Report Publish Interval (s)", + "description": "Interval in seconds to publish map reports" + }, + "positionPrecision": { + "label": "Approximate Location", + "description": "Position shared will be accurate within this distance", + "options": { + "metric_km23": "Within 23 km", + "metric_km12": "Within 12 km", + "metric_km5_8": "Within 5.8 km", + "metric_km2_9": "Within 2.9 km", + "metric_km1_5": "Within 1.5 km", + "metric_m700": "Within 700 m", + "metric_m350": "Within 350 m", + "metric_m200": "Within 200 m", + "metric_m90": "Within 90 m", + "metric_m50": "Within 50 m", + "imperial_mi15": "Within 15 miles", + "imperial_mi7_3": "Within 7.3 miles", + "imperial_mi3_6": "Within 3.6 miles", + "imperial_mi1_8": "Within 1.8 miles", + "imperial_mi0_9": "Within 0.9 miles", + "imperial_mi0_5": "Within 0.5 miles", + "imperial_mi0_2": "Within 0.2 miles", + "imperial_ft600": "Within 600 feet", + "imperial_ft300": "Within 300 feet", + "imperial_ft150": "Within 150 feet" + } + } + } + }, + "neighborInfo": { + "title": "Neighbor Info Settings", + "description": "Settings for the Neighbor Info module", + "enabled": { + "label": "Enabled", + "description": "Enable or disable Neighbor Info Module" + }, + "updateInterval": { + "label": "Update Interval", + "description": "Interval in seconds of how often we should try to send our Neighbor Info to the mesh" + } + }, + "paxcounter": { + "title": "Paxcounter Settings", + "description": "Settings for the Paxcounter module", + "enabled": { + "label": "Module Enabled", + "description": "Enable Paxcounter" + }, + "paxcounterUpdateInterval": { + "label": "Update Interval (seconds)", + "description": "How long to wait between sending paxcounter packets" + }, + "wifiThreshold": { + "label": "WiFi RSSI Threshold", + "description": "At what WiFi RSSI level should the counter increase. Defaults to -80." + }, + "bleThreshold": { + "label": "BLE RSSI Threshold", + "description": "At what BLE RSSI level should the counter increase. Defaults to -80." + } + }, + "rangeTest": { + "title": "Range Test Settings", + "description": "Settings for the Range Test module", + "enabled": { + "label": "Module Enabled", + "description": "Enable Range Test" + }, + "sender": { + "label": "Message Interval", + "description": "How long to wait between sending test packets" + }, + "save": { + "label": "Save CSV to storage", + "description": "ESP32 Only" + } + }, + "serial": { + "title": "Serial Settings", + "description": "Settings for the Serial module", + "enabled": { + "label": "Module Enabled", + "description": "Enable Serial output" + }, + "echo": { + "label": "Echo", + "description": "Any packets you send will be echoed back to your device" + }, + "rxd": { + "label": "Receive Pin", + "description": "Set the GPIO pin to the RXD pin you have set up." + }, + "txd": { + "label": "Transmit Pin", + "description": "Set the GPIO pin to the TXD pin you have set up." + }, + "baud": { + "label": "Baud Rate", + "description": "The serial baud rate" + }, + "timeout": { + "label": "Timeout", + "description": "Seconds to wait before we consider your packet as 'done'" + }, + "mode": { + "label": "Mode", + "description": "Select Mode" + }, + "overrideConsoleSerialPort": { + "label": "Override Console Serial Port", + "description": "If you have a serial port connected to the console, this will override it." + } + }, + "storeForward": { + "title": "Store & Forward Settings", + "description": "Settings for the Store & Forward module", + "enabled": { + "label": "Module Enabled", + "description": "Enable Store & Forward" + }, + "heartbeat": { + "label": "Heartbeat Enabled", + "description": "Enable Store & Forward heartbeat" + }, + "records": { + "label": "Number of records", + "description": "Number of records to store" + }, + "historyReturnMax": { + "label": "History return max", + "description": "Max number of records to return" + }, + "historyReturnWindow": { + "label": "History return window", + "description": "Max number of records to return" + } + }, + "telemetry": { + "title": "Telemetry Settings", + "description": "Settings for the Telemetry module", + "deviceUpdateInterval": { + "label": "Device Metrics", + "description": "Device metrics update interval (seconds)" + }, + "environmentUpdateInterval": { + "label": "Environment metrics update interval (seconds)", + "description": "" + }, + "environmentMeasurementEnabled": { + "label": "Module Enabled", + "description": "Enable the Environment Telemetry" + }, + "environmentScreenEnabled": { + "label": "Displayed on Screen", + "description": "Show the Telemetry Module on the OLED" + }, + "environmentDisplayFahrenheit": { + "label": "Display Fahrenheit", + "description": "Display temp in Fahrenheit" + }, + "airQualityEnabled": { + "label": "Air Quality Enabled", + "description": "Enable the Air Quality Telemetry" + }, + "airQualityInterval": { + "label": "Air Quality Update Interval", + "description": "How often to send Air Quality data over the mesh" + }, + "powerMeasurementEnabled": { + "label": "Power Measurement Enabled", + "description": "Enable the Power Measurement Telemetry" + }, + "powerUpdateInterval": { + "label": "Power Update Interval", + "description": "How often to send Power data over the mesh" + }, + "powerScreenEnabled": { + "label": "Power Screen Enabled", + "description": "Enable the Power Telemetry Screen" + } + } +} diff --git a/src/i18n/locales/en/nodes.json b/src/i18n/locales/en/nodes.json new file mode 100644 index 00000000..5202f039 --- /dev/null +++ b/src/i18n/locales/en/nodes.json @@ -0,0 +1,51 @@ +{ + "nodeDetail": { + "publicKeyEnabled": { + "label": "Public Key Enabled" + }, + "noPublicKey": { + "label": "No Public Key" + }, + "directMessage": { + "label": "Direct Message {{shortName}}" + }, + "favorite": { + "label": "Favorite" + }, + "notFavorite": { + "label": "Not a Favorite" + }, + "status": { + "heard": "Heard", + "mqtt": "MQTT" + }, + "elevation": { + "label": "Elevation" + }, + "channelUtil": { + "label": "Channel Util" + }, + "airtimeUtil": { + "label": "Airtime Util" + } + }, + "nodesTable": { + "headings": { + "longName": "Long Name", + "connection": "Connection", + "lastHeard": "Last Heard", + "encryption": "Encryption", + "model": "Model", + "macAddress": "MAC Address" + }, + "connectionStatus": { + "direct": "Direct", + "away": "away", + "unknown": "-", + "viaMqtt": ", via MQTT" + }, + "lastHeardStatus": { + "never": "Never" + } + } +} diff --git a/src/i18n/locales/en/ui.json b/src/i18n/locales/en/ui.json new file mode 100644 index 00000000..17bf2ca5 --- /dev/null +++ b/src/i18n/locales/en/ui.json @@ -0,0 +1,162 @@ +{ + "navigation": { + "title": "Navigation", + "messages": "Messages", + "map": "Map", + "config": "Config", + "radioConfig": "Radio Config", + "moduleConfig": "Module Config", + "channels": "Channels", + "nodes": "Nodes" + }, + "app": { + "title": "Meshtastic", + "logo": "Meshtastic Logo" + }, + "sidebar": { + "collapseToggle": { + "button": { + "open": "Open sidebar", + "close": "Close sidebar" + } + }, + "deviceInfo": { + "volts": "{{voltage}} volts", + "firmware": { + "title": "Firmware", + "version": "v{{version}}", + "buildDate": "Build date: {{date}}" + }, + "deviceName": { + "title": "Device Name", + "changeName": "Change Device Name", + "placeholder": "Enter device name" + }, + "editDeviceName": "Edit device name" + } + }, + "batteryStatus": { + "charging": "{{level}}% charging", + "pluggedIn": "Plugged in", + "title": "Battery" + }, + "search": { + "nodes": "Search nodes...", + "channels": "Search channels...", + "commandPalette": "Search commands..." + }, + "toast": { + "positionRequestSent": { "title": "Position request sent." }, + "requestingPosition": { "title": "Requesting position, please wait..." }, + "sendingTraceroute": { "title": "Sending Traceroute, please wait..." }, + "tracerouteSent": { "title": "Traceroute sent." }, + "savedChannel": { "title": "Saved Channel: {{channelName}}" }, + "messages": { + "pkiEncryption": { "title": "Chat is using PKI encryption." }, + "pskEncryption": { "title": "Chat is using PSK encryption." } + }, + "configSaveError": { + "title": "Error Saving Config", + "description": "An error occurred while saving the configuration." + }, + "validationError": { + "title": "Config Errors Exist", + "description": "Please fix the configuration errors before saving." + }, + "saveSuccess": { + "title": "Saving Config", + "description": "The configuration change {{case}} has been saved." + } + }, + "notifications": { + "copied": { + "label": "Copied!" + }, + "copyToClipboard": { + "label": "Copy to clipboard" + }, + "hidePassword": { + "label": "Hide password" + }, + "showPassword": { + "label": "Show password" + } + }, + "general": { + "label": "General" + }, + "hardware": { + "label": "Hardware" + }, + "metrics": { + "label": "Metrics" + }, + "role": { + "label": "Role" + }, + "filter": { + "label": "Filter" + }, + "clearInput": { + "label": "Clear input" + }, + "resetFilters": { + "label": "Reset Filters" + }, + "nodeName": { + "label": "Node name/number", + "placeholder": "Meshtastic 1234" + }, + "airtimeUtilization": { + "label": "Airtime Utilization (%)" + }, + "batteryLevel": { + "label": "Battery level (%)", + "labelText": "Battery level (%): {{value}}" + }, + "batteryVoltage": { + "label": "Battery voltage (V)", + "title": "Voltage" + }, + "channelUtilization": { + "label": "Channel Utilization (%)" + }, + "hops": { + "direct": "Direct", + "label": "Number of hops", + "text": "Number of hops: {{value}}" + }, + "lastHeard": { + "label": "Last heard", + "labelText": "Last heard: {{value}}", + "nowLabel": "Now" + }, + "snr": { + "label": "SNR (db)" + }, + "favorites": { + "label": "Favorites" + }, + "hide": { + "label": "Hide" + }, + "showOnly": { + "label": "Show Only" + }, + "viaMqtt": { + "label": "Connected via MQTT" + }, + "language": { + "label": "Language", + "changeLanguage": "Change Language" + }, + "theme": { + "dark": "Dark", + "light": "Light", + "system": "Automatic", + "changeTheme": "Change Color Scheme" + }, + "footer": { + "text": "Powered by <0>▲ Vercel | Meshtastic® is a registered trademark of Meshtastic LLC. | <1>Legal Information" + } +} diff --git a/src/index.tsx b/src/index.tsx index 33d79536..65f4ed87 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,10 +1,11 @@ import "@app/index.css"; import { enableMapSet } from "immer"; import "maplibre-gl/dist/maplibre-gl.css"; -import { StrictMode } from "react"; +import { StrictMode, Suspense } from "react"; import { createRoot } from "react-dom/client"; import { App } from "@app/App.tsx"; +import "./i18n/config.ts"; const container = document.getElementById("root") as HTMLElement; const root = createRoot(container); @@ -13,6 +14,8 @@ enableMapSet(); root.render( - + + + , , ); diff --git a/src/pages/Channels.tsx b/src/pages/Channels.tsx index 73fedb05..d078d8e9 100644 --- a/src/pages/Channels.tsx +++ b/src/pages/Channels.tsx @@ -10,17 +10,21 @@ import { Sidebar } from "@components/Sidebar.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Types } from "@meshtastic/core"; import type { Protobuf } from "@meshtastic/core"; -import { ImportIcon, QrCodeIcon } from "lucide-react"; +import i18next from "i18next"; +import { QrCodeIcon, UploadIcon } from "lucide-react"; import { useState } from "react"; +import { useTranslation } from "react-i18next"; -export const getChannelName = (channel: Protobuf.Channel.Channel) => - channel.settings?.name.length +export const getChannelName = (channel: Protobuf.Channel.Channel) => { + return channel.settings?.name.length ? channel.settings?.name : channel.index === 0 - ? "Primary" - : `Ch ${channel.index}`; + ? i18next.t("page.broadcastLabel") + : i18next.t("page.channelIndex", { ns: "channels", index: channel.index }); +}; const ChannelsPage = () => { + const { t } = useTranslation("channels"); const { channels, setDialogOpen } = useDevice(); const [activeChannel] = useState( Types.ChannelNumber.Primary, @@ -32,20 +36,21 @@ const ChannelsPage = () => { return ( <> } - label={`Channel: ${ - currentChannel ? getChannelName(currentChannel) : "Loading..." - }`} + label={currentChannel + ? getChannelName(currentChannel) + : t("loading", { ns: "common" })} actions={[ { - key: "search", - icon: ImportIcon, + key: "import", + icon: UploadIcon, onClick() { setDialogOpen("import", true); }, }, { - key: "import", + key: "qr", icon: QrCodeIcon, onClick() { setDialogOpen("QR", true); @@ -54,7 +59,7 @@ const ChannelsPage = () => { ]} > - + {allChannels.map((channel) => ( { + const { t } = useTranslation("deviceConfig"); const tabs = [ { - label: "Device", + label: t("page.tabDevice"), element: Device, count: 0, }, { - label: "Position", + label: t("page.tabPosition"), element: Position, }, { - label: "Power", + label: t("page.tabPower"), element: Power, }, { - label: "Network", + label: t("page.tabNetwork"), element: Network, }, { - label: "Display", + label: t("page.tabDisplay"), element: Display, }, { - label: "LoRa", + label: t("page.tabLora"), element: LoRa, }, { - label: "Bluetooth", + label: t("page.tabBluetooth"), element: Bluetooth, }, { - label: "Security", + label: t("page.tabSecurity"), element: Security, }, ]; return ( - + {tabs.map((tab) => ( { + const { t } = useTranslation("moduleConfig"); const tabs = [ { - label: "MQTT", + label: t("page.tabMqtt"), element: MQTT, }, { - label: "Serial", + label: t("page.tabSerial"), element: Serial, }, { - label: "Ext Notif", + label: t("page.tabExternalNotification"), element: ExternalNotification, }, { - label: "S&F", + label: t("page.tabStoreAndForward"), element: StoreForward, }, { - label: "Range Test", + label: t("page.tabRangeTest"), element: RangeTest, }, { - label: "Telemetry", + label: t("page.tabTelemetry"), element: Telemetry, }, { - label: "Canned", + label: t("page.tabCannedMessage"), element: CannedMessage, }, { - label: "Audio", + label: t("page.tabAudio"), element: Audio, }, { - label: "Neighbor Info", + label: t("page.tabNeighborInfo"), element: NeighborInfo, }, { - label: "Ambient Lighting", + label: t("page.tabAmbientLighting"), element: AmbientLighting, }, { - label: "Detection Sensor", + label: t("page.tabDetectionSensor"), element: DetectionSensor, }, { - label: "Paxcounter", + label: t("page.tabPaxcounter"), element: Paxcounter, }, ]; return ( - + {tabs.map((tab) => ( { const { workingConfig, workingModuleConfig, connection } = useDevice(); @@ -19,12 +20,13 @@ const ConfigPage = () => { const [isSaving, setIsSaving] = useState(false); const { toast } = useToast(); const isError = hasErrors(); + const { t } = useTranslation("deviceConfig"); const handleSave = async () => { if (hasErrors()) { return toast({ - title: "Config Errors Exist", - description: "Please fix the configuration errors before saving.", + title: t("toast.validationError.title"), + description: t("toast.validationError.description"), }); } @@ -35,9 +37,10 @@ const ConfigPage = () => { workingConfig.map((config) => connection?.setConfig(config).then(() => toast({ - title: "Saving Config", - description: - `The configuration change ${config.payloadVariant.case} has been saved.`, + title: t("toast.saveSuccess.title"), + description: t("toast.saveSuccess.description", { + case: config.payloadVariant.case, + }), }) ) ), @@ -47,9 +50,10 @@ const ConfigPage = () => { workingModuleConfig.map((moduleConfig) => connection?.setModuleConfig(moduleConfig).then(() => toast({ - title: "Saving Config", - description: - `The configuration change ${moduleConfig.payloadVariant.case} has been saved.`, + title: t("toast.saveSuccess.title"), + description: t("toast.saveSuccess.description", { + case: moduleConfig.payloadVariant.case, + }), }) ) ), @@ -59,8 +63,8 @@ const ConfigPage = () => { await connection?.commitEditSettings(); } catch (_error) { toast({ - title: "Error Saving Config", - description: "An error occurred while saving the configuration.", + title: t("toast.configSaveError.title"), + description: t("toast.configSaveError.description"), }); } finally { setIsSaving(false); @@ -70,15 +74,18 @@ const ConfigPage = () => { const leftSidebar = useMemo( () => ( - + setActiveConfigSection("device")} Icon={SettingsIcon} /> setActiveConfigSection("module")} Icon={BoxesIcon} @@ -95,8 +102,8 @@ const ConfigPage = () => { contentClassName="overflow-auto" leftBar={leftSidebar} label={activeConfigSection === "device" - ? "Radio Config" - : "Module Config"} + ? t("navigation.radioConfig") + : t("navigation.moduleConfig")} actions={[ { key: "save", diff --git a/src/pages/Dashboard/index.tsx b/src/pages/Dashboard/index.tsx index 77541d0b..69cfa2e2 100644 --- a/src/pages/Dashboard/index.tsx +++ b/src/pages/Dashboard/index.tsx @@ -13,8 +13,11 @@ import { UsersIcon, } from "lucide-react"; import { useMemo } from "react"; +import { useTranslation } from "react-i18next"; +import LanguageSwitcher from "@components/LanguageSwitcher.tsx"; export const Dashboard = () => { + const { t } = useTranslation("dashboard"); const { setConnectDialogOpen, setSelectedDevice } = useAppStore(); const { getDevices } = useDeviceStore(); @@ -22,12 +25,17 @@ export const Dashboard = () => { return ( <> -
+
- Connected Devices - Manage, connect and disconnect devices + + {t("dashboard.title")} + + + {t("dashboard.description")} +
+
@@ -49,25 +57,32 @@ export const Dashboard = () => {

{device.getNode(device.hardware.myNodeNum)?.user - ?.longName ?? "UNK"} + ?.longName ?? + t("unknown.shortName")}

{device.connection?.connType === "ble" && ( <> - BLE + {t( + "dashboard.connectionType_ble", + )} )} {device.connection?.connType === "serial" && ( <> - Serial + {t( + "dashboard.connectionType_serial", + )} )} {device.connection?.connType === "http" && ( <> - Network + {t( + "dashboard.connectionType_network", + )} )}
@@ -96,15 +111,22 @@ export const Dashboard = () => { size={48} className="mx-auto text-text-secondary" /> - No Devices - Connect at least one device to get started + + {t("dashboard.noDevicesTitle")} + + {/* */} + + {t("dashboard.noDevicesDescription")} +
)} diff --git a/src/pages/Messages.tsx b/src/pages/Messages.tsx index 457b4c83..dc55400c 100644 --- a/src/pages/Messages.tsx +++ b/src/pages/Messages.tsx @@ -20,6 +20,7 @@ import { import { useSidebar } from "@core/stores/sidebarStore.tsx"; import { Input } from "@components/UI/Input.tsx"; import { randId } from "@core/utils/randId.ts"; +import { useTranslation } from "react-i18next"; type NodeInfoWithUnread = Protobuf.Mesh.NodeInfo & { unreadCount: number }; @@ -45,6 +46,7 @@ export const MessagesPage = () => { const { toast } = useToast(); const { isCollapsed } = useSidebar(); const [searchTerm, setSearchTerm] = useState(""); + const { t } = useTranslation(["messages", "channels", "ui"]); const deferredSearch = useDeferredValue(searchTerm); const filteredNodes = (): NodeInfoWithUnread[] => { @@ -163,7 +165,7 @@ export const MessagesPage = () => { default: return (
- Select a channel or node to start messaging. + {t("messagesPage.selectChatPrompt")}
); } @@ -171,13 +173,21 @@ export const MessagesPage = () => { const leftSidebar = useMemo(() => ( - + {filteredChannels?.map((channel) => ( { @@ -214,7 +224,7 @@ export const MessagesPage = () => {
diff --git a/src/pages/Nodes.tsx b/src/pages/Nodes.tsx index ff398f1f..c349cde3 100644 --- a/src/pages/Nodes.tsx +++ b/src/pages/Nodes.tsx @@ -26,6 +26,7 @@ import { useFilterNode, } from "@components/generic/Filter/useFilterNode.ts"; import { FilterControl } from "@components/generic/Filter/FilterControl.tsx"; +import { useTranslation } from "react-i18next"; export interface DeleteNoteDialogProps { open: boolean; @@ -33,6 +34,7 @@ export interface DeleteNoteDialogProps { } const NodesPage = (): JSX.Element => { + const { t } = useTranslation("nodes"); const { getNodes, hardware, connection, hasNodeError, setDialogOpen } = useDevice(); const { setNodeNumDetails } = useAppStore(); @@ -100,7 +102,7 @@ const NodesPage = (): JSX.Element => {
{ [
@@ -164,16 +194,20 @@ const NodesPage = (): JSX.Element => { {node.hopsAway !== undefined ? node?.viaMqtt === false && node.hopsAway === 0 - ? "Direct" + ? t("nodesTable.connectionStatus.direct") : `${node.hopsAway?.toString()} ${ - node.hopsAway ?? 0 > 1 ? "hops" : "hop" - } away` - : "-"} - {node?.viaMqtt === true ? ", via MQTT" : ""} + node.hopsAway ?? 0 > 1 + ? t("unit.hop.plural") + : t("unit.hops_one") + } ${t("nodesTable.connectionStatus.away")}` + : t("nodesTable.connectionStatus.unknown")} + {node?.viaMqtt === true + ? t("nodesTable.connectionStatus.viaMqtt") + : ""} , {node.lastHeard === 0 - ?

Never

+ ?

{t("nodesTable.lastHeardStatus.never")}

: }
, @@ -182,9 +216,14 @@ const NodesPage = (): JSX.Element => { : } , - {node.snr}db/ - {Math.min(Math.max((node.snr + 10) * 5, 0), 100)}%/ - {(node.snr + 10) * 5}raw + {node.snr} + {t("unit.dbm")}/ + {Math.min( + Math.max((node.snr + 10) * 5, 0), + 100, + )}%/{/* Percentage */} + {(node.snr + 10) * 5} + {t("unit.raw")} , {Protobuf.Mesh.HardwareModel[node.user?.hwModel ?? 0]} @@ -193,7 +232,7 @@ const NodesPage = (): JSX.Element => { {base16 .stringify(node.user?.macaddr ?? []) .match(/.{1,2}/g) - ?.join(":") ?? "UNK"} + ?.join(":") ?? t("unknown.shortName")} , ])} /> diff --git a/src/tests/setupTests.ts b/src/tests/setupTests.ts index e5826209..37f1f3c1 100644 --- a/src/tests/setupTests.ts +++ b/src/tests/setupTests.ts @@ -3,6 +3,18 @@ import { cleanup } from "@testing-library/react"; import { enableMapSet } from "immer"; import "@testing-library/jest-dom"; import "@testing-library/user-event"; +import i18n from "i18next"; +import { initReactI18next } from "react-i18next"; +import channelsEN from "@app/i18n/locales/en/channels.json"; +import commandPaletteEN from "@app/i18n/locales/en/commandPalette.json"; +import commonEN from "@app/i18n/locales/en/common.json"; +import deviceConfigEN from "@app/i18n/locales/en/deviceConfig.json"; +import moduleConfigEN from "@app/i18n/locales/en/moduleConfig.json"; +import dashboardEN from "@app/i18n/locales/en/dashboard.json"; +import dialogEN from "@app/i18n/locales/en/dialog.json"; +import messagesEN from "@app/i18n/locales/en/messages.json"; +import nodesEN from "@app/i18n/locales/en/nodes.json"; +import uiEN from "@app/i18n/locales/en/ui.json"; enableMapSet(); @@ -14,12 +26,65 @@ vi.mock("idb-keyval", () => ({ keys: vi.fn(() => Promise.resolve([])), createStore: vi.fn(() => ({})), })); + globalThis.ResizeObserver = class { observe() {} unobserve() {} disconnect() {} }; +const appNamespaces = [ + "channels", + "commandPalette", + "common", + "deviceConfig", + "moduleConfig", + "dashboard", + "dialog", + "messages", + "nodes", + "ui", +]; +const appFallbackNS = ["common", "ui", "dialog"]; +const appDefaultNS = "common"; + +i18n + .use(initReactI18next) + .init({ + lng: "en", + fallbackLng: "en", + + ns: appNamespaces, + defaultNS: appDefaultNS, + fallbackNS: appFallbackNS, + + supportedLngs: ["en"], + + resources: { + en: { + channels: channelsEN, + commandPalette: commandPaletteEN, + common: commonEN, + deviceConfig: deviceConfigEN, + moduleConfig: moduleConfigEN, + dashboard: dashboardEN, + dialog: dialogEN, + messages: messagesEN, + nodes: nodesEN, + ui: uiEN, + }, + }, + + interpolation: { + escapeValue: false, + }, + + react: { + useSuspense: false, + }, + debug: false, + }); + afterEach(() => { cleanup(); }); diff --git a/vite.config.ts b/vite.config.ts index 4d5bed60..a49feff5 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,48 +1,47 @@ -import { defineConfig } from 'vite'; -import react from '@vitejs/plugin-react'; -import { VitePWA } from 'vite-plugin-pwa'; -import { execSync } from 'node:child_process'; +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; +import { VitePWA } from "vite-plugin-pwa"; +import { execSync } from "node:child_process"; import process from "node:process"; -import path from 'node:path'; +import path from "node:path"; - -let hash = ''; +let hash = ""; try { - hash = execSync('git rev-parse --short HEAD', { encoding: 'utf8' }).trim(); + hash = execSync("git rev-parse --short HEAD", { encoding: "utf8" }).trim(); } catch (error) { - console.error('Error getting git hash:', error); - hash = 'DEV'; + console.error("Error getting git hash:", error); + hash = "DEV"; } export default defineConfig({ plugins: [ react(), VitePWA({ - registerType: 'autoUpdate', - strategies: 'generateSW', + registerType: "autoUpdate", + strategies: "generateSW", devOptions: { - enabled: false + enabled: false, }, workbox: { cleanupOutdatedCaches: true, - sourcemap: true - } - }) + sourcemap: true, + }, + }), ], define: { - 'import.meta.env.VITE_COMMIT_HASH': JSON.stringify(hash), + "import.meta.env.VITE_COMMIT_HASH": JSON.stringify(hash), }, build: { emptyOutDir: true, - assetsDir: './', + assetsDir: "./", }, resolve: { alias: { - '@app': path.resolve(process.cwd(), './src'), - '@pages': path.resolve(process.cwd(), './src/pages'), - '@components': path.resolve(process.cwd(), './src/components'), - '@core': path.resolve(process.cwd(), './src/core'), - '@layouts': path.resolve(process.cwd(), './src/layouts'), + "@app": path.resolve(process.cwd(), "./src"), + "@pages": path.resolve(process.cwd(), "./src/pages"), + "@components": path.resolve(process.cwd(), "./src/components"), + "@core": path.resolve(process.cwd(), "./src/core"), + "@layouts": path.resolve(process.cwd(), "./src/layouts"), }, }, server: { @@ -52,4 +51,4 @@ export default defineConfig({ "Cross-Origin-Embedder-Policy": "require-corp", }, }, -}); \ No newline at end of file +}); diff --git a/vitest.config.ts b/vitest.config.ts index aaed988c..24aa0ac4 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,6 +1,6 @@ import path from "node:path"; -import react from '@vitejs/plugin-react'; -import { defineConfig } from 'vitest/config' +import react from "@vitejs/plugin-react"; +import { defineConfig } from "vitest/config"; import { enableMapSet } from "immer"; enableMapSet(); @@ -10,21 +10,21 @@ export default defineConfig({ ], resolve: { alias: { - '@app': path.resolve(process.cwd(), './src'), - '@core': path.resolve(process.cwd(), './src/core'), - '@pages': path.resolve(process.cwd(), './src/pages'), - '@components': path.resolve(process.cwd(), './src/components'), - '@layouts': path.resolve(process.cwd(), './src/layouts'), + "@app": path.resolve(process.cwd(), "./src"), + "@core": path.resolve(process.cwd(), "./src/core"), + "@pages": path.resolve(process.cwd(), "./src/pages"), + "@components": path.resolve(process.cwd(), "./src/components"), + "@layouts": path.resolve(process.cwd(), "./src/layouts"), }, }, test: { - environment: 'happy-dom', + environment: "happy-dom", globals: true, mockReset: true, clearMocks: true, restoreMocks: true, - root: path.resolve(process.cwd(), './src'), - include: ['**/*.{test,spec}.{ts,tsx}'], + root: path.resolve(process.cwd(), "./src"), + include: ["**/*.{test,spec}.{ts,tsx}"], setupFiles: ["./src/tests/setupTests.ts"], }, -}) \ No newline at end of file +});