feat: configure i18n

finxol.io 65161be7 1613f573

verified
+18 -2
astro.config.mjs
···
// @ts-check
-
import { defineConfig } from 'astro/config';
+
import { defineConfig } from "astro/config";
+
import deno from "@deno/astro-adapter";
// https://astro.build/config
-
export default defineConfig({});
+
export default defineConfig({
+
site: "https://staging.colinozanne.fr",
+
output: "server",
+
adapter: deno(),
+
i18n: {
+
locales: ["en", "fr"],
+
defaultLocale: "fr",
+
routing: {
+
prefixDefaultLocale: false,
+
},
+
domains: {
+
fr: "https://staging.colinozanne.fr",
+
en: "https://staging.colinozanne.co.uk",
+
},
+
},
+
});
+8
deno.lock
···
{
"version": "5",
"specifiers": {
+
"npm:@deno/astro-adapter@~0.3.2": "0.3.2_astro@5.15.3__vite@6.4.1___picomatch@4.0.3__zod@3.25.76",
"npm:astro@^5.15.3": "5.15.3_vite@6.4.1__picomatch@4.0.3_zod@3.25.76"
},
"npm": {
···
"integrity": "sha512-+ntATQe1AlL7nTOYjwjj6w3299CgRot48wL761TUGYpYgAou3AaONZazp0PKZyCyWhudWsjhq1nvRHOvbMzhTA==",
"dependencies": [
"fontkit"
+
]
+
},
+
"@deno/astro-adapter@0.3.2_astro@5.15.3__vite@6.4.1___picomatch@4.0.3__zod@3.25.76": {
+
"integrity": "sha512-nN0kQGobRs2XE3R+O/DWYQanEWpteJNsIf5TD65787qFEw2CrqkFNcNolZFJiKUF/2Y/TKyOLRjMS3F6auECVg==",
+
"dependencies": [
+
"astro"
]
},
"@emnapi/runtime@1.7.0": {
···
"workspace": {
"packageJson": {
"dependencies": [
+
"npm:@deno/astro-adapter@~0.3.2",
"npm:astro@^5.15.3"
+14 -13
package.json
···
{
-
"name": "portfolio-v2",
-
"type": "module",
-
"version": "0.0.1",
-
"scripts": {
-
"dev": "astro dev",
-
"build": "astro build",
-
"preview": "astro preview",
-
"astro": "astro"
-
},
-
"dependencies": {
-
"astro": "^5.15.3"
-
}
-
}
+
"name": "portfolio-v2",
+
"type": "module",
+
"version": "0.0.1",
+
"scripts": {
+
"dev": "astro dev",
+
"build": "astro build",
+
"preview": "deno run --allow-net --allow-read --allow-env ./dist/server/entry.mjs",
+
"astro": "astro"
+
},
+
"dependencies": {
+
"@deno/astro-adapter": "^0.3.2",
+
"astro": "^5.15.3"
+
}
+
}
+9
src/pages/en/index.astro
···
+
---
+
import Welcome from "@/components/Welcome.astro";
+
import Layout from "@/layouts/Layout.astro";
+
---
+
+
<Layout>
+
English
+
<Welcome />
+
</Layout>
+4 -3
src/pages/index.astro src/pages/fr/index.astro
···
---
-
import Welcome from '../components/Welcome.astro';
-
import Layout from '../layouts/Layout.astro';
+
import Welcome from "@/components/Welcome.astro";
+
import Layout from "@/layouts/Layout.astro";
// Welcome to Astro! Wondering what to do next? Check out the Astro documentation at https://docs.astro.build
// Don't want to use any of this? Delete everything in this file, the `assets`, `components`, and `layouts` directories, and start fresh.
---
<Layout>
-
<Welcome />
+
Français
+
<Welcome />
</Layout>
+10 -3
tsconfig.json
···
{
-
"extends": "astro/tsconfigs/strict",
-
"include": [".astro/types.d.ts", "**/*"],
-
"exclude": ["dist"]
+
"extends": "astro/tsconfigs/strict",
+
"include": [".astro/types.d.ts", "**/*"],
+
"exclude": ["dist"],
+
"compilerOptions": {
+
"checkJs": true,
+
"baseUrl": "./",
+
"paths": {
+
"@/*": ["src/*"]
+
}
+
}
}