Skip to content

Types

The i18n:astro module exports a few types:

1
export type Locale = "en" | "fr";
2
3
export type LocalePathParams = {
4
"/about": never;
5
"/blog": never;
6
"/": never;
7
"/blog/[slug]": {
8
"slug": string;
9
};
10
};
11
12
export type LocalePath = keyof LocalePathParams;

Locale

Generated from your integration config locales Array. Example:

export type Locale = "en" | "fr";

LocalePathParams

Generated from the files in src/routes. Example:

export type LocalePathParams = {
"/about": never;
"/blog": never;
"/": never;
"/blog/[slug]": {
"slug": string;
};
};

LocalePath

export type LocalePath = keyof LocalePathParams;