summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.changeset/large-planets-kick.md5
-rw-r--r--packages/astro/src/@types/astro.ts86
2 files changed, 48 insertions, 43 deletions
diff --git a/.changeset/large-planets-kick.md b/.changeset/large-planets-kick.md
new file mode 100644
index 000000000..f1b58b5e5
--- /dev/null
+++ b/.changeset/large-planets-kick.md
@@ -0,0 +1,5 @@
+---
+"astro": patch
+---
+
+Fixes an issue where the `i18n.routing` object had all its fields defined as mandatory. Now they all are optionals and shouldn't break when using `astro.config.mts`.
diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts
index c07dd0f65..53b4f2889 100644
--- a/packages/astro/src/@types/astro.ts
+++ b/packages/astro/src/@types/astro.ts
@@ -1492,7 +1492,7 @@ export interface AstroUserConfig {
* 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.
*/
- prefixDefaultLocale: boolean;
+ prefixDefaultLocale?: boolean;
/**
* @docs
@@ -1521,7 +1521,7 @@ export interface AstroUserConfig {
* })
*```
* */
- redirectToDefaultLocale: boolean;
+ redirectToDefaultLocale?: boolean;
/**
* @name i18n.routing.strategy
@@ -1532,48 +1532,48 @@ export interface AstroUserConfig {
*
* - `"pathname": The strategy is applied to the pathname of the URLs
*/
- strategy: 'pathname';
-
- /**
- * @name i18n.domains
- * @type {Record<string, string> }
- * @default '{}'
- * @version 4.3.0
- * @description
- *
- * Configures the URL pattern of one or more supported languages to use a custom domain (or sub-domain).
- *
- * When a locale is mapped to a domain, a `/[locale]/` path prefix will not be used.
- * However, localized folders within `src/pages/` are still required, including for your configured `defaultLocale`.
- *
- * Any other locale not configured will default to a localized path-based URL according to your `prefixDefaultLocale` strategy (e.g. `https://example.com/[locale]/blog`).
- *
- * ```js
- * //astro.config.mjs
- * export default defineConfig({
- * site: "https://example.com",
- * output: "server", // required, with no prerendered pages
- * adapter: node({
- * mode: 'standalone',
- * }),
- * i18n: {
- * defaultLocale: "en",
- * locales: ["en", "fr", "pt-br", "es"],
- * prefixDefaultLocale: false,
- * domains: {
- * fr: "https://fr.example.com",
- * es: "https://example.es"
- * }
- * },
- * })
- * ```
- *
- * Both page routes built and URLs returned by the `astro:i18n` helper functions [`getAbsoluteLocaleUrl()`](https://docs.astro.build/en/guides/internationalization/#getabsolutelocaleurl) and [`getAbsoluteLocaleUrlList()`](https://docs.astro.build/en/guides/internationalization/#getabsolutelocaleurllist) will use the options set in `i18n.domains`.
- *
- * See the [Internationalization Guide](https://docs.astro.build/en/guides/internationalization/#domains) for more details, including the limitations of this feature.
- */
- domains?: Record<string, string>;
+ strategy?: 'pathname';
};
+
+ /**
+ * @name i18n.domains
+ * @type {Record<string, string> }
+ * @default '{}'
+ * @version 4.3.0
+ * @description
+ *
+ * Configures the URL pattern of one or more supported languages to use a custom domain (or sub-domain).
+ *
+ * When a locale is mapped to a domain, a `/[locale]/` path prefix will not be used.
+ * However, localized folders within `src/pages/` are still required, including for your configured `defaultLocale`.
+ *
+ * Any other locale not configured will default to a localized path-based URL according to your `prefixDefaultLocale` strategy (e.g. `https://example.com/[locale]/blog`).
+ *
+ * ```js
+ * //astro.config.mjs
+ * export default defineConfig({
+ * site: "https://example.com",
+ * output: "server", // required, with no prerendered pages
+ * adapter: node({
+ * mode: 'standalone',
+ * }),
+ * i18n: {
+ * defaultLocale: "en",
+ * locales: ["en", "fr", "pt-br", "es"],
+ * prefixDefaultLocale: false,
+ * domains: {
+ * fr: "https://fr.example.com",
+ * es: "https://example.es"
+ * }
+ * },
+ * })
+ * ```
+ *
+ * Both page routes built and URLs returned by the `astro:i18n` helper functions [`getAbsoluteLocaleUrl()`](https://docs.astro.build/en/guides/internationalization/#getabsolutelocaleurl) and [`getAbsoluteLocaleUrlList()`](https://docs.astro.build/en/guides/internationalization/#getabsolutelocaleurllist) will use the options set in `i18n.domains`.
+ *
+ * See the [Internationalization Guide](https://docs.astro.build/en/guides/internationalization/#domains) for more details, including the limitations of this feature.
+ */
+ domains?: Record<string, string>;
};
/** ⚠️ WARNING: SUBJECT TO CHANGE */