Skip to content

Commit

Permalink
fix some i18n config docs (#10746)
Browse files Browse the repository at this point in the history
* fix some i18n config docs

* Move manual option to last position

---------

Co-authored-by: = <otterlord.dev@gmail.com>
  • Loading branch information
sarah11918 and TheOtterlord authored Apr 10, 2024
1 parent c3008fd commit 51b3a6a
Showing 1 changed file with 40 additions and 14 deletions.
54 changes: 40 additions & 14 deletions packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1494,22 +1494,11 @@ export interface AstroUserConfig {
* @description
*
* Controls the routing strategy to determine your site URLs. Set this based on your folder/URL path configuration for your default language.
*
*/
// prettier-ignore
routing?:
/**
*
* @docs
* @name i18n.routing.manual
* @type {string}
* @version 4.6.0
* @description
* When this option is enabled, Astro will **disable** its i18n middleware so that you can implement your own custom logic. No other `routing` options (e.g. `prefixDefaultLocale`) may be configured with `routing: "manual"`.
*
* You will be responsible for writing your own routing logic, or executing Astro's i18n middleware manually alongside your own.
*/
'manual'
| {
{
/**
* @docs
* @name i18n.routing.prefixDefaultLocale
Expand All @@ -1526,6 +1515,18 @@ export interface AstroUserConfig {
* When `true`, all URLs will display a language prefix.
* 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.
*
* ```js
* export default defineConfig({
* i18n: {
* defaultLocale: "en",
* locales: ["en", "fr", "pt-br", "es"],
* routing: {
* prefixDefaultLocale: true,
* }
* }
* })
* ```
*/
prefixDefaultLocale?: boolean;

Expand Down Expand Up @@ -1568,7 +1569,32 @@ export interface AstroUserConfig {
* - `"pathname": The strategy is applied to the pathname of the URLs
*/
strategy?: 'pathname';
};
} |
/**
*
* @docs
* @name i18n.routing.manual
* @kind h4
* @type {string}
* @version 4.6.0
* @description
* When this option is enabled, Astro will **disable** its i18n middleware so that you can implement your own custom logic. No other `routing` options (e.g. `prefixDefaultLocale`) may be configured with `routing: "manual"`.
*
* You will be responsible for writing your own routing logic, or executing Astro's i18n middleware manually alongside your own.
*
* ```js
* export default defineConfig({
* i18n: {
* defaultLocale: "en",
* locales: ["en", "fr", "pt-br", "es"],
* routing: {
* prefixDefaultLocale: true,
* }
* }
* })
* ```
*/
'manual';

/**
* @name i18n.domains
Expand Down

0 comments on commit 51b3a6a

Please sign in to comment.