Fix the dev server????

This commit is contained in:
rift 2024-07-24 15:38:59 -05:00
parent 721fa7bcda
commit 0262ee9ff0
6 changed files with 5009 additions and 12 deletions

View file

@ -1,9 +1,13 @@
import { defineConfig } from 'astro/config'; import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind"; import tailwind from "@astrojs/tailwind";
import icon from "astro-icon"; import icon from "astro-icon";
// https://astro.build/config // https://astro.build/config
export default defineConfig({ export default defineConfig({
integrations: [tailwind(), icon()] integrations: [tailwind(), icon()],
}); i18n: {
defaultLocale: "en-US",
locales: ["en-US", "jp"],
},
});

4988
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,7 @@ import { isMobileNavOpen } from "../store.js";
import Logo from "./Logo.astro"; import Logo from "./Logo.astro";
import HeaderButton from "./HeaderButton.astro"; import HeaderButton from "./HeaderButton.astro";
import { Icon } from "astro-icon/components"; import { Icon } from "astro-icon/components";
const lang = getLangFromUrl(Astro.url); const lang = getLangFromUrl(Astro.url);
const t = useTranslations(lang); const t = useTranslations(lang);
--- ---

View file

@ -1,8 +1,10 @@
--- ---
import { STATIC_PATHS } from "../../i18n/utils";
import Layout from "../../layouts/Layout.astro"; import Layout from "../../layouts/Layout.astro";
export function getStaticPaths() { export function getStaticPaths() {
const STATIC_PATHS = [
{ params: { lang: "en_US" } },
{ params: { lang: "jp" } },
];
return STATIC_PATHS; return STATIC_PATHS;
} }
--- ---

View file

@ -1,8 +1,10 @@
--- ---
import { STATIC_PATHS } from "../../i18n/utils";
import Layout from "../../layouts/Layout.astro"; import Layout from "../../layouts/Layout.astro";
export function getStaticPaths() { export function getStaticPaths() {
const STATIC_PATHS = [
{ params: { lang: "en_US" } },
{ params: { lang: "jp" } },
];
return STATIC_PATHS; return STATIC_PATHS;
} }
--- ---

View file

@ -11,14 +11,14 @@ loading...
try { try {
let parsed = JSON.parse(currentLang).value; let parsed = JSON.parse(currentLang).value;
switch (parsed) { switch (parsed) {
case "en_US": case "en-US":
redirect("/en_US/"); redirect("/en-US/");
break; break;
case "jp": case "jp":
redirect("/jp/"); redirect("/jp/");
break; break;
default: default:
redirect("/en/"); redirect("/en-US/");
break; break;
} }
} catch { } catch {
@ -32,9 +32,9 @@ loading...
} else { } else {
localStorage.setItem( localStorage.setItem(
"selectedLanguage", "selectedLanguage",
JSON.stringify({ value: "en_US" }) JSON.stringify({ value: "en-US" })
); );
redirect("/en_US/"); redirect("/en-US/");
} }
} }
</script> </script>