From 64a31c0daf7325650ca3da972a201ca3e2e79b72 Mon Sep 17 00:00:00 2001 From: wearrrrr Date: Tue, 23 Jan 2024 14:58:40 -0600 Subject: [PATCH] Kinda i18n support, very early WIP --- astro-i18n.config.ts | 16 - astro-i18next.config.ts | 4 + astro.config.mjs | 2 + package-lock.json | 578 ++++++++++++++++++ package.json | 9 +- .../locales/en/translation.json | 0 public/locales/jp/translation.json | 5 + src/components/Dropdown.astro | 1 + src/components/Header.astro | 10 +- src/env.d.ts | 206 ++++++- src/i18n/ui.ts | 19 + src/i18n/utils.ts | 13 + src/layouts/Layout.astro | 3 + src/middleware/index.ts | 10 - src/pages/{404/index.astro => en/404.astro} | 1 - src/pages/{ => en}/games.astro | 5 +- src/pages/en/index.astro | 64 ++ src/pages/en/settings.astro | 15 + src/pages/index.astro | 86 +-- src/pages/jp/404.astro | 16 + src/pages/jp/games.astro | 92 +++ src/pages/jp/index.astro | 64 ++ src/pages/jp/settings.astro | 20 + src/pages/settings.astro | 18 - 24 files changed, 1135 insertions(+), 122 deletions(-) delete mode 100644 astro-i18n.config.ts create mode 100644 astro-i18next.config.ts rename src/i18n/common/en.json => public/locales/en/translation.json (100%) create mode 100644 public/locales/jp/translation.json create mode 100644 src/i18n/ui.ts create mode 100644 src/i18n/utils.ts delete mode 100644 src/middleware/index.ts rename src/pages/{404/index.astro => en/404.astro} (99%) rename src/pages/{ => en}/games.astro (97%) create mode 100644 src/pages/en/index.astro create mode 100644 src/pages/en/settings.astro create mode 100644 src/pages/jp/404.astro create mode 100644 src/pages/jp/games.astro create mode 100644 src/pages/jp/index.astro create mode 100644 src/pages/jp/settings.astro delete mode 100644 src/pages/settings.astro diff --git a/astro-i18n.config.ts b/astro-i18n.config.ts deleted file mode 100644 index cf75f36..0000000 --- a/astro-i18n.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineAstroI18nConfig } from "astro-i18n" - -export default defineAstroI18nConfig({ - primaryLocale: "en", // default app locale - secondaryLocales: [], // other supported locales - fallbackLocale: "en", // fallback locale (on missing translation) - trailingSlash: "never", // "never" or "always" - run: "server", // "client+server" or "server" - showPrimaryLocale: false, // "/en/about" vs "/about" - translationLoadingRules: [], // per page group loading - translationDirectory: {}, // translation directory names - translations: { - - }, // { [translation_group1]: { [locale1]: {}, ... } } - routes: {}, // { [secondary_locale1]: { about: "about-translated", ... } } -}) \ No newline at end of file diff --git a/astro-i18next.config.ts b/astro-i18next.config.ts new file mode 100644 index 0000000..8ef8159 --- /dev/null +++ b/astro-i18next.config.ts @@ -0,0 +1,4 @@ +export default { + defaultLocale: "en", + locales: ["en", "jp"], + }; \ No newline at end of file diff --git a/astro.config.mjs b/astro.config.mjs index e22b6d4..250c736 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,9 +1,11 @@ import { defineConfig } from 'astro/config'; +import astroI18next from "astro-i18next"; import node from "@astrojs/node"; // https://astro.build/config export default defineConfig({ + integrations: [astroI18next()], output: "hybrid", adapter: node({ mode: "middleware", diff --git a/package-lock.json b/package-lock.json index a5234f4..2290aaf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,10 +14,13 @@ "@tomphttp/bare-server-node": "^2.0.1", "astro": "^4.1.1", "astro-i18n": "^2.2.4", + "astro-i18next": "^1.0.0-beta.21", "compression": "^1.7.4", "dotenv": "^16.3.1", "express": "^4.18.2", "i": "^0.3.7", + "i18next": "^23.7.18", + "i18next-browser-languagedetector": "^7.2.0", "npm": "^10.2.5", "typescript": "^5.3.3" } @@ -465,6 +468,17 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/runtime": { + "version": "7.23.8", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.8.tgz", + "integrity": "sha512-Y7KbAP984rn1VGMbGqKmBLio9V7y5Je9GvU4rQPCPinCyNfUcToxIXl06d59URp/F3LwinvODxab5N/G6qggkw==", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/template": { "version": "7.22.15", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", @@ -1414,6 +1428,26 @@ "node": ">= 8" } }, + "node_modules/@proload/core": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@proload/core/-/core-0.3.3.tgz", + "integrity": "sha512-7dAFWsIK84C90AMl24+N/ProHKm4iw0akcnoKjRvbfHifJZBLhaDsDus1QJmhG12lXj4e/uB/8mB/0aduCW+NQ==", + "dependencies": { + "deepmerge": "^4.2.2", + "escalade": "^3.1.1" + } + }, + "node_modules/@proload/plugin-tsm": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@proload/plugin-tsm/-/plugin-tsm-0.2.1.tgz", + "integrity": "sha512-Ex1sL2BxU+g8MHdAdq9SZKz+pU34o8Zcl9PHWo2WaG9hrnlZme607PU6gnpoAYsDBpHX327+eu60wWUk+d/b+A==", + "dependencies": { + "tsm": "^2.1.4" + }, + "peerDependencies": { + "@proload/core": "^0.3.2" + } + }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.9.4", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.9.4.tgz", @@ -2003,6 +2037,50 @@ "esbuild": "0.x" } }, + "node_modules/astro-i18next": { + "version": "1.0.0-beta.21", + "resolved": "https://registry.npmjs.org/astro-i18next/-/astro-i18next-1.0.0-beta.21.tgz", + "integrity": "sha512-1YPqwexumHpK/d9afEoi52CBFTu6k4MYv/oHjsaAasZDvFClU6U5VPttC/OgZcXRYggCM6ee2LOnyHqlmXOeLA==", + "dependencies": { + "@proload/core": "^0.3.3", + "@proload/plugin-tsm": "^0.2.1", + "i18next": "^22.4.10", + "i18next-browser-languagedetector": "^7.0.1", + "i18next-fs-backend": "^2.1.1", + "i18next-http-backend": "^2.1.1", + "iso-639-1": "^2.1.15", + "locale-emoji": "^0.3.0", + "pathe": "^1.1.0" + }, + "bin": { + "astro-i18next": "dist/cli/index.js" + }, + "peerDependencies": { + "astro": ">=1.0.0" + } + }, + "node_modules/astro-i18next/node_modules/i18next": { + "version": "22.5.1", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-22.5.1.tgz", + "integrity": "sha512-8TGPgM3pAD+VRsMtUMNknRz3kzqwp/gPALrWMsDnmC1mKqJwpWyooQRLMcbTwq8z8YwSmuj+ZYvc+xCuEpkssA==", + "funding": [ + { + "type": "individual", + "url": "https://locize.com" + }, + { + "type": "individual", + "url": "https://locize.com/i18next.html" + }, + { + "type": "individual", + "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" + } + ], + "dependencies": { + "@babel/runtime": "^7.20.6" + } + }, "node_modules/async-exit-hook": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/async-exit-hook/-/async-exit-hook-2.0.1.tgz", @@ -2676,6 +2754,14 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, + "node_modules/cross-fetch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", + "dependencies": { + "node-fetch": "^2.6.12" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -2734,6 +2820,14 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/define-data-property": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", @@ -2931,6 +3025,306 @@ "@esbuild/win32-x64": "0.19.11" } }, + "node_modules/esbuild-android-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.18.tgz", + "integrity": "sha512-wnpt3OXRhcjfIDSZu9bnzT4/TNTDsOUvip0foZOUBG7QbSt//w3QV4FInVJxNhKc/ErhUxc5z4QjHtMi7/TbgA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-android-arm64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.18.tgz", + "integrity": "sha512-G4xu89B8FCzav9XU8EjsXacCKSG2FT7wW9J6hOc18soEHJdtWu03L3TQDGf0geNxfLTtxENKBzMSq9LlbjS8OQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.18.tgz", + "integrity": "sha512-2WAvs95uPnVJPuYKP0Eqx+Dl/jaYseZEUUT1sjg97TJa4oBtbAKnPnl3b5M9l51/nbx7+QAEtuummJZW0sBEmg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-darwin-arm64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.18.tgz", + "integrity": "sha512-tKPSxcTJ5OmNb1btVikATJ8NftlyNlc8BVNtyT/UAr62JFOhwHlnoPrhYWz09akBLHI9nElFVfWSTSRsrZiDUA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.18.tgz", + "integrity": "sha512-TT3uBUxkteAjR1QbsmvSsjpKjOX6UkCstr8nMr+q7zi3NuZ1oIpa8U41Y8I8dJH2fJgdC3Dj3CXO5biLQpfdZA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-freebsd-arm64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.18.tgz", + "integrity": "sha512-R/oVr+X3Tkh+S0+tL41wRMbdWtpWB8hEAMsOXDumSSa6qJR89U0S/PpLXrGF7Wk/JykfpWNokERUpCeHDl47wA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-32": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.18.tgz", + "integrity": "sha512-lphF3HiCSYtaa9p1DtXndiQEeQDKPl9eN/XNoBf2amEghugNuqXNZA/ZovthNE2aa4EN43WroO0B85xVSjYkbg==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.18.tgz", + "integrity": "sha512-hNSeP97IviD7oxLKFuii5sDPJ+QHeiFTFLoLm7NZQligur8poNOWGIgpQ7Qf8Balb69hptMZzyOBIPtY09GZYw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.18.tgz", + "integrity": "sha512-UH779gstRblS4aoS2qpMl3wjg7U0j+ygu3GjIeTonCcN79ZvpPee12Qun3vcdxX+37O5LFxz39XeW2I9bybMVA==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-arm64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.18.tgz", + "integrity": "sha512-54qr8kg/6ilcxd+0V3h9rjT4qmjc0CccMVWrjOEM/pEcUzt8X62HfBSeZfT2ECpM7104mk4yfQXkosY8Quptug==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-mips64le": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.18.tgz", + "integrity": "sha512-Mk6Ppwzzz3YbMl/ZZL2P0q1tnYqh/trYZ1VfNP47C31yT0K8t9s7Z077QrDA/guU60tGNp2GOwCQnp+DYv7bxQ==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-ppc64le": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.18.tgz", + "integrity": "sha512-b0XkN4pL9WUulPTa/VKHx2wLCgvIAbgwABGnKMY19WhKZPT+8BxhZdqz6EgkqCLld7X5qiCY2F/bfpUUlnFZ9w==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-riscv64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.18.tgz", + "integrity": "sha512-ba2COaoF5wL6VLZWn04k+ACZjZ6NYniMSQStodFKH/Pu6RxzQqzsmjR1t9QC89VYJxBeyVPTaHuBMCejl3O/xg==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-linux-s390x": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.18.tgz", + "integrity": "sha512-VbpGuXEl5FCs1wDVp93O8UIzl3ZrglgnSQ+Hu79g7hZu6te6/YHgVJxCM2SqfIila0J3k0csfnf8VD2W7u2kzQ==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-netbsd-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.18.tgz", + "integrity": "sha512-98ukeCdvdX7wr1vUYQzKo4kQ0N2p27H7I11maINv73fVEXt2kyh4K4m9f35U1K43Xc2QGXlzAw0K9yoU7JUjOg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-openbsd-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.18.tgz", + "integrity": "sha512-yK5NCcH31Uae076AyQAXeJzt/vxIo9+omZRKj1pauhk3ITuADzuOx5N2fdHrAKPxN+zH3w96uFKlY7yIn490xQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-sunos-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.18.tgz", + "integrity": "sha512-On22LLFlBeLNj/YF3FT+cXcyKPEI263nflYlAhz5crxtp3yRG1Ugfr7ITyxmCmjm4vbN/dGrb/B7w7U8yJR9yw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-32": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.18.tgz", + "integrity": "sha512-o+eyLu2MjVny/nt+E0uPnBxYuJHBvho8vWsC2lV61A7wwTWC3jkN2w36jtA+yv1UgYkHRihPuQsL23hsCYGcOQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.18.tgz", + "integrity": "sha512-qinug1iTTaIIrCorAUjR0fcBk24fjzEedFYhhispP8Oc7SFvs+XeW3YpAKiKp8dRpizl4YYAhxMjlftAMJiaUw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/esbuild-windows-arm64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.18.tgz", + "integrity": "sha512-q9bsYzegpZcLziq0zgUi5KqGVtfhjxGbnksaBFYmWLxeV/S1fK4OLdq2DFYnXcLMjlZw2L0jLsk1eGoB522WXQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -3618,6 +4012,49 @@ "node": ">=0.4" } }, + "node_modules/i18next": { + "version": "23.7.18", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-23.7.18.tgz", + "integrity": "sha512-b9N2KjRCYQNlUvE1Kc83g8knyUkL5NiZQOp9BsTR/v/LXk6Fzz+doOzTg2/826XK28mCgBkYLNAtixjE58qpCw==", + "funding": [ + { + "type": "individual", + "url": "https://locize.com" + }, + { + "type": "individual", + "url": "https://locize.com/i18next.html" + }, + { + "type": "individual", + "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" + } + ], + "dependencies": { + "@babel/runtime": "^7.23.2" + } + }, + "node_modules/i18next-browser-languagedetector": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/i18next-browser-languagedetector/-/i18next-browser-languagedetector-7.2.0.tgz", + "integrity": "sha512-U00DbDtFIYD3wkWsr2aVGfXGAj2TgnELzOX9qv8bT0aJtvPV9CRO77h+vgmHFBMe7LAxdwvT/7VkCWGya6L3tA==", + "dependencies": { + "@babel/runtime": "^7.23.2" + } + }, + "node_modules/i18next-fs-backend": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/i18next-fs-backend/-/i18next-fs-backend-2.3.1.tgz", + "integrity": "sha512-tvfXskmG/9o+TJ5Fxu54sSO5OkY6d+uMn+K6JiUGLJrwxAVfer+8V3nU8jq3ts9Pe5lXJv4b1N7foIjJ8Iy2Gg==" + }, + "node_modules/i18next-http-backend": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/i18next-http-backend/-/i18next-http-backend-2.4.2.tgz", + "integrity": "sha512-wKrgGcaFQ4EPjfzBTjzMU0rbFTYpa0S5gv9N/d8WBmWS64+IgJb7cHddMvV+tUkse7vUfco3eVs2lB+nJhPo3w==", + "dependencies": { + "cross-fetch": "4.0.0" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -3862,6 +4299,14 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, + "node_modules/iso-639-1": { + "version": "2.1.15", + "resolved": "https://registry.npmjs.org/iso-639-1/-/iso-639-1-2.1.15.tgz", + "integrity": "sha512-7c7mBznZu2ktfvyT582E2msM+Udc1EjOyhVRE/0ZsjD9LBtWSm23h3PtiRh2a35XoUsTQQjJXaJzuLjXsOdFDg==", + "engines": { + "node": ">=6.0" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -3955,6 +4400,11 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/locale-emoji": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/locale-emoji/-/locale-emoji-0.3.0.tgz", + "integrity": "sha512-JGm8+naU49CBDnH1jksS3LecPdfWQLxFgkLN6ZhYONKa850pJ0Xt8DPGJnYK0ZuJI8jTuiDDPCDtSL3nyacXwg==" + }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -4964,6 +5414,25 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/node-releases": { "version": "2.0.14", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", @@ -7974,6 +8443,11 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==" }, + "node_modules/pathe": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", + "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==" + }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -8248,6 +8722,11 @@ "node": ">=8.10.0" } }, + "node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, "node_modules/rehype": { "version": "13.0.1", "resolved": "https://registry.npmjs.org/rehype/-/rehype-13.0.1.tgz", @@ -9343,6 +9822,11 @@ "node": ">=0.6" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "node_modules/trim-lines": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", @@ -9386,6 +9870,86 @@ "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", "optional": true }, + "node_modules/tsm": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tsm/-/tsm-2.3.0.tgz", + "integrity": "sha512-++0HFnmmR+gMpDtKTnW3XJ4yv9kVGi20n+NfyQWB9qwJvTaIWY9kBmzek2YUQK5APTQ/1DTrXmm4QtFPmW9Rzw==", + "dependencies": { + "esbuild": "^0.15.16" + }, + "bin": { + "tsm": "bin.js" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/tsm/node_modules/@esbuild/android-arm": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.15.18.tgz", + "integrity": "sha512-5GT+kcs2WVGjVs7+boataCkO5Fg0y4kCjzkB5bAip7H4jfnOS3dA6KPiww9W1OEKTKeAcUVhdZGvgI65OXmUnw==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsm/node_modules/@esbuild/linux-loong64": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.18.tgz", + "integrity": "sha512-L4jVKS82XVhw2nvzLg/19ClLWg0y27ulRwuP7lcyL6AbUWB5aPglXY3M21mauDQMDfRLs8cQmeT03r/+X3cZYQ==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsm/node_modules/esbuild": { + "version": "0.15.18", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.18.tgz", + "integrity": "sha512-x/R72SmW3sSFRm5zrrIjAhCeQSAWoni3CmHEqfQrZIQTM3lVCdehdwuIqaOtfC2slvpdlLa62GYoN8SxT23m6Q==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.15.18", + "@esbuild/linux-loong64": "0.15.18", + "esbuild-android-64": "0.15.18", + "esbuild-android-arm64": "0.15.18", + "esbuild-darwin-64": "0.15.18", + "esbuild-darwin-arm64": "0.15.18", + "esbuild-freebsd-64": "0.15.18", + "esbuild-freebsd-arm64": "0.15.18", + "esbuild-linux-32": "0.15.18", + "esbuild-linux-64": "0.15.18", + "esbuild-linux-arm": "0.15.18", + "esbuild-linux-arm64": "0.15.18", + "esbuild-linux-mips64le": "0.15.18", + "esbuild-linux-ppc64le": "0.15.18", + "esbuild-linux-riscv64": "0.15.18", + "esbuild-linux-s390x": "0.15.18", + "esbuild-netbsd-64": "0.15.18", + "esbuild-openbsd-64": "0.15.18", + "esbuild-sunos-64": "0.15.18", + "esbuild-windows-32": "0.15.18", + "esbuild-windows-64": "0.15.18", + "esbuild-windows-arm64": "0.15.18" + } + }, "node_modules/type-fest": { "version": "2.19.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", @@ -9906,6 +10470,20 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index d1c4be4..51f8add 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,7 @@ "version": "0.0.1", "scripts": { "start": "node .", - "build": "astro build", - "i18n:extract": "astro-i18n extract", - "i18n:generate:pages": "astro-i18n generate:pages --purge", - "i18n:generate:types": "astro-i18n generate:types", - "i18n:sync": "npm run i18n:generate:pages && npm run i18n:generate:types" + "build": "astro build" }, "dependencies": { "@astrojs/check": "^0.4.0", @@ -17,10 +13,13 @@ "@tomphttp/bare-server-node": "^2.0.1", "astro": "^4.1.1", "astro-i18n": "^2.2.4", + "astro-i18next": "^1.0.0-beta.21", "compression": "^1.7.4", "dotenv": "^16.3.1", "express": "^4.18.2", "i": "^0.3.7", + "i18next": "^23.7.18", + "i18next-browser-languagedetector": "^7.2.0", "npm": "^10.2.5", "typescript": "^5.3.3" } diff --git a/src/i18n/common/en.json b/public/locales/en/translation.json similarity index 100% rename from src/i18n/common/en.json rename to public/locales/en/translation.json diff --git a/public/locales/jp/translation.json b/public/locales/jp/translation.json new file mode 100644 index 0000000..8454786 --- /dev/null +++ b/public/locales/jp/translation.json @@ -0,0 +1,5 @@ +{ + "brand": "アルー", + "games": "ゲーム", + "settings": "設定" +} \ No newline at end of file diff --git a/src/components/Dropdown.astro b/src/components/Dropdown.astro index cdda5e0..5617a66 100644 --- a/src/components/Dropdown.astro +++ b/src/components/Dropdown.astro @@ -35,6 +35,7 @@ const { buttonNameDefault, dropdownList, id } = Astro.props; width: 100%; border-radius: 10px; min-width: 140px; + height: 50px; } .dropdown-menu { margin: 0; diff --git a/src/components/Header.astro b/src/components/Header.astro index ea8c6d3..40be545 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -1,15 +1,17 @@ --- - import { t } from "astro-i18n" + import { getLangFromUrl, useTranslations } from "../i18n/utils" + const lang = getLangFromUrl(Astro.url); + const t = useTranslations(lang); ---
diff --git a/src/env.d.ts b/src/env.d.ts index 8c34fb4..2e4229b 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -1 +1,205 @@ -/// \ No newline at end of file +/// + +// ###> astro-i18n/type-generation ### +type PrimaryLocale = "en" +type SecondaryLocale = "" +type Locale = PrimaryLocale | SecondaryLocale +type RouteParameters = {"/games":undefined;"/":undefined;"/settings":undefined;"/404":undefined;} +type Route = keyof RouteParameters +type TranslationVariables = {"nav.brand":object|undefined;"nav.games":object|undefined;"nav.settings":object|undefined;} +type Translation = keyof TranslationVariables +type Environment = "none"|"node"|"browser" +declare module "astro-i18n" { + type GetStaticPathsProps = {paginate:Function;rss:Function} + type GetStaticPathsItem = {params:Record;props?:Record} + type DeepStringRecord = {[key: string]:string|DeepStringRecord} + type TranslationDirectory = {i18n?:string;pages?: string} + export type Translations = {[group: string]:{[locale: string]: DeepStringRecord}} + export type TranslationFormatters = {[formatterName: string]:(value:unknown,...args:unknown[])=>unknown} + export type TranslationLoadingRules = {groups:string[];routes: string[]}[] + export type SegmentTranslations = {[secondaryLocale: string]:{[segment: string]:string}} + export interface AstroI18nConfig {primaryLocale:string;secondaryLocales:string[];fallbackLocale:string;showPrimaryLocale:boolean;trailingSlash:"always"|"never";run:"server"|"client+server";translations:Translations;translationLoadingRules:TranslationLoadingRules;translationDirectory:TranslationDirectory;routes:SegmentTranslations;srcDir:string;} + /** Typed astro-i18n config definition. */ + export function defineAstroI18nConfig(config: Partial): Partial + /** The `astro-i18n` middleware. */ + export function useAstroI18n( + config?: Partial | string, + formatters?: TranslationFormatters, + ): (...args: any[]) => any + /** Workaround function to make astroI18n work inside getStaticPaths. This is because Astro's getStaticPaths runs before everything which doesn't allows astroI18n to update its state automatically. */ + function createGetStaticPaths( + callback: ( + props: GetStaticPathsProps, + ) => GetStaticPathsItem[] | Promise, + ): (props: GetStaticPathsProps & { + astroI18n?: { + locale: string; + }; + }) => Promise + /** + * @param key The translation key, for example `"my.nested.translation.key"`. + * @param properties An object containing your interpolation variables and/or your variants, for example `{ variant: 3, interpolation: "text" }`. + * @param options `route`: Overrides the current route, you will be able to access that route's translations. `locale`: Overrides the current locale, this allows you to control which language you want to translate to. `fallbackLocale`: Overrides the fallback locale. + */ + export function t( + key: T | string & {}, + ...args: undefined extends TranslationVariables[T] + ? [ + properties?: keyof TranslationVariables extends T + ? Record + : TranslationVariables[T], + options?: { + route?: Route | string & {} + locale?: Locale | string & {} + fallbackLocale?: Locale | string & {} + } + ] + : [ + properties: TranslationVariables[T], + options?: { + route?: Route | string & {} + locale?: Locale | string & {} + fallbackLocale?: Locale | string & {} + } + ] + ): string + /** + * @param route A route in any of the configured languages, for example `"/en/my/english/route/[param]"`. + * @param parameters An object containing your route parameters, for example `{ slug: "my-blog-post-slug" }`. + * @param options `targetLocale`: Overrides the target locale. `routeLocale`: Overrides the given route locale, this is useful if astro-i18n cannot figure out the route's locale. `showPrimaryLocale`: Overrides the showPrimaryLocale parameter. `query`: Adds these query parameters at the end of the translated route. + */ + export function l( + route: T | string & {}, + ...args: T extends keyof RouteParameters + ? undefined extends RouteParameters[T] + ? [ + parameters?: Record, + options?: { + targetLocale?: string, + routeLocale?: string, + showPrimaryLocale?: string, + query?: Record + } + ] + : [ + parameters: RouteParameters[T], + options?: { + targetLocale?: string, + routeLocale?: string, + showPrimaryLocale?: string, + query?: Record + } + ] + : [ + parameters?: Record, + options?: { + targetLocale?: string, + routeLocale?: string, + showPrimaryLocale?: string, + query?: Record + } + ] + ): string + class AstroI18n { + /** The detected runtime environment. */ + environment: Environment + /** The current page route. */ + route: string + /** All page routes. For example: `["/", "/about", "/posts/[slug]"]` */ + pages: string[] + /** The equivalent page for the current route. For example if route is equal to `"/posts/my-cool-cat"` this could return `"/posts/[slug]"`. */ + page: string + /** The current page locale. */ + locale: Locale + /** All configured locales. */ + locales: Locale[] + /** The default/primary locale. */ + primaryLocale: PrimaryLocale + /** Locales other than the default/primary one. */ + secondaryLocales: SecondaryLocale[] + /** The fallback locale, when a translation is missing in a locale the fallback locale will be used to find a replacement. */ + fallbackLocale: Locale + /** True when astro-i18n is initialized. */ + isInitialized: boolean + /** + * @param key The translation key, for example `"my.nested.translation.key"`. + * @param properties An object containing your interpolation variables and/or your variants, for example `{ variant: 3, interpolation: "text" }`. + * @param options `route`: Overrides the current route, you will be able to access that route's translations. `locale`: Overrides the current locale, this allows you to control which language you want to translate to. `fallbackLocale`: Overrides the fallback locale. + */ + t( + key: T | string & {}, + ...args: undefined extends TranslationVariables[T] + ? [ + properties?: keyof TranslationVariables extends T + ? Record + : TranslationVariables[T], + options?: { + route?: Route | string & {} + locale?: Locale | string & {} + fallbackLocale?: Locale | string & {} + } + ] + : [ + properties: TranslationVariables[T], + options?: { + route?: Route | string & {} + locale?: Locale | string & {} + fallbackLocale?: Locale | string & {} + } + ] + ): string + /** + * @param route A route in any of the configured languages, for example `"/en/my/english/route/[param]"`. + * @param parameters An object containing your route parameters, for example `{ slug: "my-blog-post-slug" }`. + * @param options `targetLocale`: Overrides the target locale. `routeLocale`: Overrides the given route locale, this is useful if astro-i18n cannot figure out the route's locale. `showPrimaryLocale`: Overrides the showPrimaryLocale parameter. `query`: Adds these query parameters at the end of the translated route. + */ + l( + route: T | string & {}, + ...args: T extends keyof RouteParameters + ? undefined extends RouteParameters[T] + ? [ + parameters?: Record, + options?: { + targetLocale?: string, + routeLocale?: string, + showPrimaryLocale?: string, + query?: Record + } + ] + : [ + parameters: RouteParameters[T], + options?: { + targetLocale?: string, + routeLocale?: string, + showPrimaryLocale?: string, + query?: Record + } + ] + : [ + parameters?: Record, + options?: { + targetLocale?: string, + routeLocale?: string, + showPrimaryLocale?: string, + query?: Record + } + ] + ): string + /** Adds new translations at runtime. */ + addTranslations(translations: Translations): this + /** Adds new translation formatters at runtime. */ + addFormatters(translationFormatters: TranslationFormatters): this + /** Adds new translation loading rules at runtime. */ + addTranslationLoadingRules(translationLoadingRules: TranslationLoadingRules): this + /** Adds new route segment translations at runtime. */ + addRoutes(routes: SegmentTranslations): this + /** Tries to parse one of the configured locales out of the given route. If no configured locale is found it will return `null`. */ + extractRouteLocale(route: string): string|null + /** Initializes astro-i18n on the server-side. */ + initialize(config?: Partial | string, formatters?: TranslationFormatters = {}): Promise + /** Redirects the user to the given destination. */ + redirect(destination: string | URL, status = 301) + } + export const astroI18n: AstroI18n +} +// ###< astro-i18n/type-generation ### diff --git a/src/i18n/ui.ts b/src/i18n/ui.ts new file mode 100644 index 0000000..7e3dd14 --- /dev/null +++ b/src/i18n/ui.ts @@ -0,0 +1,19 @@ +export const languages = { + en: 'English', + jp: "日本語", + }; + + export const defaultLang = 'en'; + + export const ui = { + en: { + 'nav.brand': 'Alu', + 'nav.games': "Games", + 'nav.settings': "Settings", + }, + jp: { + 'nav.brand': 'アルー', + 'nav.games': "ゲーム", + 'nav.settings': "設定", + }, + } as const; \ No newline at end of file diff --git a/src/i18n/utils.ts b/src/i18n/utils.ts new file mode 100644 index 0000000..a206047 --- /dev/null +++ b/src/i18n/utils.ts @@ -0,0 +1,13 @@ +import { ui, defaultLang } from './ui'; + +export function getLangFromUrl(url: URL) { + const [, lang] = url.pathname.split('/'); + if (lang in ui) return lang as keyof typeof ui; + return defaultLang; +} + +export function useTranslations(lang: keyof typeof ui) { + return function t(key: keyof typeof ui[typeof defaultLang]) { + return ui[lang][key] || ui[defaultLang][key]; + } +} \ No newline at end of file diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 33209d8..645a55a 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -9,8 +9,11 @@ interface Props { } const { title } = Astro.props; + +import i18next from 'i18next'; --- + diff --git a/src/middleware/index.ts b/src/middleware/index.ts deleted file mode 100644 index 1efb1d2..0000000 --- a/src/middleware/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { sequence } from "astro/middleware" -import config from "../../astro-i18n.config.ts" -import { useAstroI18n } from "astro-i18n" - -const astroI18n = useAstroI18n( - config, - undefined /* custom formatters */, -) - -export const onRequest = sequence(astroI18n) \ No newline at end of file diff --git a/src/pages/404/index.astro b/src/pages/en/404.astro similarity index 99% rename from src/pages/404/index.astro rename to src/pages/en/404.astro index ab02acc..d1fb9da 100644 --- a/src/pages/404/index.astro +++ b/src/pages/en/404.astro @@ -1,6 +1,5 @@ --- import Layout from "../../layouts/Layout.astro"; - --- diff --git a/src/pages/games.astro b/src/pages/en/games.astro similarity index 97% rename from src/pages/games.astro rename to src/pages/en/games.astro index 44456e8..8d05d79 100644 --- a/src/pages/games.astro +++ b/src/pages/en/games.astro @@ -1,7 +1,6 @@ --- -import Layout from "../layouts/Layout.astro"; -import Footer from "../components/Footer.astro"; -import GameItem from "../components/GameItem.astro"; +import Layout from "../../layouts/Layout.astro"; +import GameItem from "../../components/GameItem.astro"; --- diff --git a/src/pages/en/index.astro b/src/pages/en/index.astro new file mode 100644 index 0000000..ee90b11 --- /dev/null +++ b/src/pages/en/index.astro @@ -0,0 +1,64 @@ +--- +import Layout from "../../layouts/Layout.astro"; +import UVRegistrar from "../../components/UVRegistrar.astro"; +--- + + +
+

Welcome to Alu

+
+ +
Loading...
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/src/pages/en/settings.astro b/src/pages/en/settings.astro new file mode 100644 index 0000000..c385721 --- /dev/null +++ b/src/pages/en/settings.astro @@ -0,0 +1,15 @@ +--- +import SettingsTablist from "../../components/SettingsTablist.astro"; +import Layout from "../../layouts/Layout.astro"; +--- + + +

Settings

+ +
+ + \ No newline at end of file diff --git a/src/pages/index.astro b/src/pages/index.astro index 2e3f2d4..9a670d8 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,68 +1,26 @@ --- -import Layout from '../layouts/Layout.astro'; -import UVRegistrar from '../components/UVRegistrar.astro'; +import { ViewTransitions } from "astro:transitions"; -import { astroI18n, t } from "astro-i18n" - -astroI18n.locale --- - -
-

Welcome to Alu

-
- -
Loading...
-
- -
-
- -
- - \ No newline at end of file + + + + + + + + + diff --git a/src/pages/jp/404.astro b/src/pages/jp/404.astro new file mode 100644 index 0000000..d1fb9da --- /dev/null +++ b/src/pages/jp/404.astro @@ -0,0 +1,16 @@ +--- +import Layout from "../../layouts/Layout.astro"; +--- + + +
+

404!

+

The content you have requested could not be found!

+
+
+ + \ No newline at end of file diff --git a/src/pages/jp/games.astro b/src/pages/jp/games.astro new file mode 100644 index 0000000..8d05d79 --- /dev/null +++ b/src/pages/jp/games.astro @@ -0,0 +1,92 @@ +--- +import Layout from "../../layouts/Layout.astro"; +import GameItem from "../../components/GameItem.astro"; +--- + + +

Games

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/src/pages/jp/index.astro b/src/pages/jp/index.astro new file mode 100644 index 0000000..ee90b11 --- /dev/null +++ b/src/pages/jp/index.astro @@ -0,0 +1,64 @@ +--- +import Layout from "../../layouts/Layout.astro"; +import UVRegistrar from "../../components/UVRegistrar.astro"; +--- + + +
+

Welcome to Alu

+
+ +
Loading...
+
+ +
+
+ +
+ + \ No newline at end of file diff --git a/src/pages/jp/settings.astro b/src/pages/jp/settings.astro new file mode 100644 index 0000000..0f66abf --- /dev/null +++ b/src/pages/jp/settings.astro @@ -0,0 +1,20 @@ +--- +import { changeLanguage } from "i18next"; +import Switch from "../../components/Switch.astro"; +import SettingsTablist from "../../components/SettingsTablist.astro"; +import Layout from "../../layouts/Layout.astro"; +import ThemeLoader from "../../components/ThemeLoader.astro"; + +changeLanguage("en"); +--- + + +

Settings

+ +
+ + \ No newline at end of file diff --git a/src/pages/settings.astro b/src/pages/settings.astro deleted file mode 100644 index ca7a792..0000000 --- a/src/pages/settings.astro +++ /dev/null @@ -1,18 +0,0 @@ ---- -import Switch from "../components/Switch.astro"; -import SettingsTablist from "../components/SettingsTablist.astro"; -import Layout from "../layouts/Layout.astro"; -import ThemeLoader from "../components/ThemeLoader.astro"; - ---- - - -

Settings

- -
- - \ No newline at end of file