diff --git a/.changeset/blue-mice-hide.md b/.changeset/blue-mice-hide.md new file mode 100644 index 0000000000..b5e8e39cae --- /dev/null +++ b/.changeset/blue-mice-hide.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Updates i18n configuration reference diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 9aa7dc89b6..c5a74340a4 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -1441,7 +1441,6 @@ export interface AstroUserConfig { */ devOverlay?: boolean; - // TODO review with docs team before merging to `main` /** * @docs * @name experimental.i18n @@ -1451,6 +1450,8 @@ export interface AstroUserConfig { * @description * * Configures experimental i18n routing and allows you to specify some customization options. + * + * See our guide for more information on [internationalization in Astro](/en/guides/internationalization/) */ i18n?: { /** @@ -1461,6 +1462,8 @@ export interface AstroUserConfig { * @description * * The default locale of your website/application. This is a required field. + * + * No particular language format or syntax is enforced, but we suggest using lower-case and hyphens as needed (e.g. "es", "pt-br") for greatest compatibility. */ defaultLocale: string; /** @@ -1470,7 +1473,7 @@ export interface AstroUserConfig { * @version 3.5.0 * @description * - * A list of all locales supported by the website (e.g. `['en', 'es', 'pt_BR']`). This list should also include the `defaultLocale`. This is a required field. + * A list of all locales supported by the website (e.g. `['en', 'es', 'pt-br']`). This list should also include the `defaultLocale`. This is a required field. * * No particular language format or syntax is enforced, but your folder structure must match exactly the locales in the list. */ @@ -1489,14 +1492,14 @@ export interface AstroUserConfig { * * #### Example * - * The following example configures your content fallback strategy to redirect unavailable pages in `/pt/` to their `es` version, and unavailable pages in `/fr/` to their `en` version. Unavailable `/es/` pages will return a 404. + * The following example configures your content fallback strategy to redirect unavailable pages in `/pt-br/` to their `es` version, and unavailable pages in `/fr/` to their `en` version. Unavailable `/es/` pages will return a 404. * * ```js * export defualt defineConfig({ * experimental: { * i18n: { * defaultLocale: "en", - * locales: ["en", "fr", "pt", "es"], + * locales: ["en", "fr", "pt-br", "es"], * fallback: { * pt: "es", * fr: "en" @@ -1516,14 +1519,15 @@ export interface AstroUserConfig { * @version 3.5.0 * @description * - * Controls the routing strategy to determine your site URLs. + * Controls the routing strategy to determine your site URLs. Set this based on your folder/URL path configuration for your default language: * - * - `prefix-other-locales`(default): Only non-default languages will display a language prefix. The `defaultLocale` will not show a language prefix. - * URLs will be of the form `example.com/[lang]/content/` for all non-default languages, but `example.com/content/` for the default locale. + * - `prefix-other-locales`(default): Only non-default languages will display a language prefix. + * The `defaultLocale` will not show a language prefix and content files do not exist in a localized folder. + * URLs will be of the form `example.com/[locale]/content/` for all non-default languages, but `example.com/content/` for the default locale. * - `prefix-always`: All URLs will display a language prefix. - * URLs will be of the form `example.com/[lang]/content/` for every route, including the default language. + * URLs will be of the form `example.com/[locale]/content/` for every route, including the default language. + * Localized folders are used for every language, including the default. * - * Note: Astro requires all content to exist within a `/[lang]/` folder, even for the default language. */ routingStrategy?: 'prefix-always' | 'prefix-other-locales'; };