This commit is contained in:
Vincent van der Wal
2026-08-01 15:07:28 +02:00
parent 9806396476
commit 774afa6c65
45 changed files with 1515 additions and 239 deletions
+26 -1
View File
@@ -1,3 +1,4 @@
import { paraglideVitePlugin } from '@inlang/paraglide-js';
import { sveltekit } from '@sveltejs/kit/vite';
import tailwindcss from '@tailwindcss/vite';
import { playwright } from '@vitest/browser-playwright';
@@ -29,8 +30,32 @@ const viteServerConfig = (): Plugin => ({
}
});
// Every locale carries its own path prefix, English included, so a URL always
// says which language it is in. `trailingSlash: 'always'` (see routes/+layout.ts)
// means the patterns have to match both `/de/weather/week/` and `/de`.
const LOCALES = ['en', 'de', 'es', 'fr', 'it'] as const;
const urlPatterns = [
{
pattern: '/:path(.*)?',
localized: LOCALES.map((locale) => [locale, `/${locale}/:path(.*)?`] as [string, string])
}
];
export default defineConfig({
plugins: [tailwindcss(), sveltekit(), viteServerConfig()],
plugins: [
paraglideVitePlugin({
project: './project.inlang',
outdir: './src/lib/paraglide',
// the URL is authoritative; the cookie only carries a choice forward to
// the next bare visit, and the browser's languages seed a first visit
strategy: ['url', 'cookie', 'preferredLanguage', 'baseLocale'],
urlPatterns
}),
tailwindcss(),
sveltekit(),
viteServerConfig()
],
test: {
expect: { requireAssertions: true },