Skip to content

Commit

Permalink
[docs] hotfixes to i18n config-ref (#9037)
Browse files Browse the repository at this point in the history
Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
  • Loading branch information
sarah11918 and natemoo-re committed Nov 9, 2023
1 parent 83c8870 commit ea71975
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/blue-mice-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Updates i18n configuration reference
22 changes: 13 additions & 9 deletions packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,6 @@ export interface AstroUserConfig {
*/
devOverlay?: boolean;

// TODO review with docs team before merging to `main`
/**
* @docs
* @name experimental.i18n
Expand All @@ -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?: {
/**
Expand All @@ -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;
/**
Expand All @@ -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.
*/
Expand All @@ -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"
Expand All @@ -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';
};
Expand Down

0 comments on commit ea71975

Please sign in to comment.