i18n
This commit is contained in:
+26
-1
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user