diff --git a/astro.config.mjs b/astro.config.mjs index 250c736..b58d321 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,11 +1,10 @@ import { defineConfig } from 'astro/config'; -import astroI18next from "astro-i18next"; import node from "@astrojs/node"; // https://astro.build/config export default defineConfig({ - integrations: [astroI18next()], + integrations: [], output: "hybrid", adapter: node({ mode: "middleware", diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 117c459..7763083 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -1,24 +1,32 @@ +--- + +import { getLangFromUrl, useTranslations } from "../i18n/utils" +const lang = getLangFromUrl(Astro.url); +const t = useTranslations(lang); + +--- +
diff --git a/src/components/GameItem.astro b/src/components/GameItem.astro index 922bbfe..a8d5f8f 100644 --- a/src/components/GameItem.astro +++ b/src/components/GameItem.astro @@ -3,7 +3,7 @@ const { name, image, slugName } = Astro.props; --- diff --git a/src/i18n/en.json b/src/i18n/en.json new file mode 100644 index 0000000..247bea4 --- /dev/null +++ b/src/i18n/en.json @@ -0,0 +1,14 @@ +{ + "nav.brand": "Alu", + "nav.games": "Games", + "nav.settings": "Settings", + + "menu.welcome": "Welcome to Alu", + "menu.search": "Search...", + + "footer.brand": "Alu", + "footer.madeWithLove": "Made with ❤️ by wearr", + "footer.services": "Services", + "footer.socials": "Socials", + "footer.aluProject": "Alu Project" +} \ No newline at end of file diff --git a/src/i18n/jp.json b/src/i18n/jp.json new file mode 100644 index 0000000..e820145 --- /dev/null +++ b/src/i18n/jp.json @@ -0,0 +1,14 @@ +{ + "nav.brand": "アルー", + "nav.games": "ゲーム", + "nav.settings": "設定", + + "menu.welcome": "アルーにようこそ", + "menu.search": "検索...", + + "footer.brand": "アルー", + "footer.madeWithLove": "「wearr」による❤️で作られました", + "footer.services": "サービス", + "footer.socials": "ソーシャル", + "footer.aluProject": "アループロジェクト" +} \ No newline at end of file diff --git a/src/i18n/ui.ts b/src/i18n/ui.ts index 7e3dd14..e5679bd 100644 --- a/src/i18n/ui.ts +++ b/src/i18n/ui.ts @@ -1,19 +1,15 @@ +import en from './en.json'; +import jp from './jp.json'; + + export const languages = { en: 'English', jp: "日本語", }; - export const defaultLang = 'en'; +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 +export const ui = { + en, + jp +}; \ No newline at end of file diff --git a/src/pages/en/404.astro b/src/pages/404.astro similarity index 83% rename from src/pages/en/404.astro rename to src/pages/404.astro index d1fb9da..8d3b0ea 100644 --- a/src/pages/en/404.astro +++ b/src/pages/404.astro @@ -1,5 +1,5 @@ --- -import Layout from "../../layouts/Layout.astro"; +import Layout from "../layouts/Layout.astro"; ---