0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-06 22:10:10 -05:00

[docs] hotfixes to i18n config-ref (#9037)

Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
This commit is contained in:
Sarah Rainsberger 2023-11-09 16:18:39 -04:00 committed by GitHub
parent 83c8870684
commit ea71975ec0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 9 deletions

View file

@ -0,0 +1,5 @@
---
"astro": patch
---
Updates i18n configuration reference

View file

@ -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';
};