@intlayer/docs 7.0.1 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +4 -11
  2. package/dist/cjs/common.cjs +5 -1
  3. package/dist/cjs/common.cjs.map +1 -1
  4. package/dist/esm/common.mjs +5 -1
  5. package/dist/esm/common.mjs.map +1 -1
  6. package/dist/types/common.d.ts.map +1 -1
  7. package/docs/ar/intlayer_with_nextjs_15.md +10 -6
  8. package/docs/ar/intlayer_with_nextjs_16.md +11 -7
  9. package/docs/de/intlayer_with_nextjs_15.md +10 -6
  10. package/docs/de/intlayer_with_nextjs_16.md +11 -7
  11. package/docs/en/CI_CD.md +4 -0
  12. package/docs/en/configuration.md +29 -42
  13. package/docs/en/formatters.md +4 -0
  14. package/docs/en/how_works_intlayer.md +4 -0
  15. package/docs/en/index.md +1 -0
  16. package/docs/en/intlayer_CMS.md +6 -0
  17. package/docs/en/intlayer_cli.md +8 -0
  18. package/docs/en/intlayer_with_nextjs_14.md +14 -6
  19. package/docs/en/intlayer_with_nextjs_15.md +14 -6
  20. package/docs/en/intlayer_with_nextjs_16.md +15 -7
  21. package/docs/en/intlayer_with_nextjs_page_router.md +4 -0
  22. package/docs/en/intlayer_with_nuxt.md +4 -0
  23. package/docs/en/intlayer_with_react_native+expo.md +7 -0
  24. package/docs/en/intlayer_with_react_router_v7.md +4 -0
  25. package/docs/en/intlayer_with_tanstack.md +4 -0
  26. package/docs/en/intlayer_with_vite+preact.md +51 -26
  27. package/docs/en/intlayer_with_vite+react.md +4 -0
  28. package/docs/en/intlayer_with_vite+solid.md +4 -0
  29. package/docs/en/intlayer_with_vite+svelte.md +4 -0
  30. package/docs/en/intlayer_with_vite+vue.md +4 -0
  31. package/docs/en/introduction.md +1 -0
  32. package/docs/en/releases/v7.md +10 -12
  33. package/docs/en/roadmap.md +6 -0
  34. package/docs/en-GB/intlayer_with_nextjs_14.md +10 -6
  35. package/docs/en-GB/intlayer_with_nextjs_15.md +10 -6
  36. package/docs/en-GB/intlayer_with_nextjs_16.md +11 -7
  37. package/docs/es/intlayer_with_nextjs_14.md +11 -6
  38. package/docs/es/intlayer_with_nextjs_15.md +7 -4
  39. package/docs/es/intlayer_with_nextjs_16.md +11 -7
  40. package/docs/fr/intlayer_with_nextjs_15.md +10 -6
  41. package/docs/fr/intlayer_with_nextjs_16.md +12 -25
  42. package/docs/hi/intlayer_with_nextjs_15.md +10 -6
  43. package/docs/hi/intlayer_with_nextjs_16.md +11 -7
  44. package/docs/id/intlayer_with_nextjs_16.md +11 -7
  45. package/docs/it/intlayer_with_nextjs_15.md +10 -6
  46. package/docs/it/intlayer_with_nextjs_16.md +11 -7
  47. package/docs/ja/intlayer_with_nextjs_14.md +11 -6
  48. package/docs/ja/intlayer_with_nextjs_15.md +10 -6
  49. package/docs/ja/intlayer_with_nextjs_16.md +11 -7
  50. package/docs/ko/intlayer_with_nextjs_14.md +11 -6
  51. package/docs/ko/intlayer_with_nextjs_15.md +10 -6
  52. package/docs/ko/intlayer_with_nextjs_16.md +11 -7
  53. package/docs/pl/intlayer_with_nextjs_16.md +11 -7
  54. package/docs/pt/intlayer_with_nextjs_14.md +10 -7
  55. package/docs/pt/intlayer_with_nextjs_15.md +10 -6
  56. package/docs/pt/intlayer_with_nextjs_16.md +11 -7
  57. package/docs/ru/intlayer_with_nextjs_15.md +7 -4
  58. package/docs/ru/intlayer_with_nextjs_16.md +11 -7
  59. package/docs/tr/intlayer_with_nextjs_15.md +10 -6
  60. package/docs/tr/intlayer_with_nextjs_16.md +11 -7
  61. package/docs/vi/intlayer_with_nextjs_16.md +11 -7
  62. package/docs/zh/intlayer_with_nextjs_14.md +11 -6
  63. package/docs/zh/intlayer_with_nextjs_15.md +7 -4
  64. package/docs/zh/intlayer_with_nextjs_16.md +11 -7
  65. package/package.json +14 -14
  66. package/src/common.ts +7 -1
@@ -47,6 +47,10 @@ history:
47
47
 
48
48
  See [Application Template](https://github.com/aymericzip/intlayer-next-15-template) on GitHub.
49
49
 
50
+ ## Table of Contents
51
+
52
+ <TOC>
53
+
50
54
  ## What is Intlayer?
51
55
 
52
56
  **Intlayer** is an innovative, open-source internationalization (i18n) library designed to simplify multilingual support in modern web applications. Intlayer seamlessly integrates with the latest **Next.js 15** framework, including its powerful **App Router**. It is optimized to work with **Server Components** for efficient rendering and is fully compatible with [**Turbopack**](https://nextjs.org/docs/architecture/turbopack).
@@ -829,15 +833,17 @@ export const generateMetadata = async ({
829
833
  * ```
830
834
  */
831
835
  const multilingualUrls = getMultilingualUrls("/");
836
+ const localizedUrl =
837
+ multilingualUrls[locale as keyof typeof multilingualUrls];
832
838
 
833
839
  return {
834
840
  ...metadata,
835
841
  alternates: {
836
- canonical: multilingualUrls[locale as keyof typeof multilingualUrls],
842
+ canonical: localizedUrl,
837
843
  languages: { ...multilingualUrls, "x-default": "/" },
838
844
  },
839
845
  openGraph: {
840
- url: multilingualUrls[locale],
846
+ url: localizedUrl,
841
847
  },
842
848
  };
843
849
  };
@@ -869,15 +875,16 @@ export const generateMetadata = async ({ params }) => {
869
875
  * ```
870
876
  */
871
877
  const multilingualUrls = getMultilingualUrls("/");
878
+ const localizedUrl = multilingualUrls[locale];
872
879
 
873
880
  return {
874
881
  ...metadata,
875
882
  alternates: {
876
- canonical: multilingualUrls[locale],
883
+ canonical: localizedUrl,
877
884
  languages: { ...multilingualUrls, "x-default": "/" },
878
885
  },
879
886
  openGraph: {
880
- url: multilingualUrls[locale],
887
+ url: localizedUrl,
881
888
  },
882
889
  };
883
890
  };
@@ -909,15 +916,16 @@ const generateMetadata = async ({ params }) => {
909
916
  * ```
910
917
  */
911
918
  const multilingualUrls = getMultilingualUrls("/");
919
+ const localizedUrl = multilingualUrls[locale];
912
920
 
913
921
  return {
914
922
  ...metadata,
915
923
  alternates: {
916
- canonical: multilingualUrls[locale],
924
+ canonical: localizedUrl,
917
925
  languages: { ...multilingualUrls, "x-default": "/" },
918
926
  },
919
927
  openGraph: {
920
- url: multilingualUrls[locale],
928
+ url: localizedUrl,
921
929
  },
922
930
  };
923
931
  };
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2024-12-06
3
- updatedAt: 2025-10-09
3
+ updatedAt: 2025-10-26
4
4
  title: How to translate your Next.js 16 app – i18n guide 2025
5
5
  description: Discover how to make your Next.js 16 website multilingual. Follow the documentation to internationalize (i18n) and translate it.
6
6
  keywords:
@@ -28,6 +28,10 @@ history:
28
28
 
29
29
  See [Application Template](https://github.com/aymericzip/intlayer-next-16-template) on GitHub.
30
30
 
31
+ ## Table of Contents
32
+
33
+ <TOC>
34
+
31
35
  ## What is Intlayer?
32
36
 
33
37
  **Intlayer** is an innovative, open-source internationalization (i18n) library designed to simplify multilingual support in modern web applications. Intlayer seamlessly integrates with the latest **Next.js 16** framework, including its powerful **App Router**. It is optimized to work with **Server Components** for efficient rendering and is fully compatible with [**Turbopack**](https://nextjs.org/docs/architecture/turbopack).
@@ -804,15 +808,17 @@ export const generateMetadata = async ({
804
808
  * ```
805
809
  */
806
810
  const multilingualUrls = getMultilingualUrls("/");
811
+ const localizedUrl =
812
+ multilingualUrls[locale as keyof typeof multilingualUrls];
807
813
 
808
814
  return {
809
815
  ...metadata,
810
816
  alternates: {
811
- canonical: multilingualUrls[locale as keyof typeof multilingualUrls],
817
+ canonical: localizedUrl,
812
818
  languages: { ...multilingualUrls, "x-default": "/" },
813
819
  },
814
820
  openGraph: {
815
- url: multilingualUrls[locale],
821
+ url: localizedUrl,
816
822
  },
817
823
  };
818
824
  };
@@ -844,15 +850,16 @@ export const generateMetadata = async ({ params }) => {
844
850
  * ```
845
851
  */
846
852
  const multilingualUrls = getMultilingualUrls("/");
853
+ const localizedUrl = multilingualUrls[locale];
847
854
 
848
855
  return {
849
856
  ...metadata,
850
857
  alternates: {
851
- canonical: multilingualUrls[locale],
858
+ canonical: localizedUrl,
852
859
  languages: { ...multilingualUrls, "x-default": "/" },
853
860
  },
854
861
  openGraph: {
855
- url: multilingualUrls[locale],
862
+ url: localizedUrl,
856
863
  },
857
864
  };
858
865
  };
@@ -884,15 +891,16 @@ const generateMetadata = async ({ params }) => {
884
891
  * ```
885
892
  */
886
893
  const multilingualUrls = getMultilingualUrls("/");
894
+ const localizedUrl = multilingualUrls[locale];
887
895
 
888
896
  return {
889
897
  ...metadata,
890
898
  alternates: {
891
- canonical: multilingualUrls[locale],
899
+ canonical: localizedUrl,
892
900
  languages: { ...multilingualUrls, "x-default": "/" },
893
901
  },
894
902
  openGraph: {
895
- url: multilingualUrls[locale],
903
+ url: localizedUrl,
896
904
  },
897
905
  };
898
906
  };
@@ -27,6 +27,10 @@ history:
27
27
 
28
28
  # Translate your Next.js and Page Router website using Intlayer | Internationalization (i18n)
29
29
 
30
+ ## Table of Contents
31
+
32
+ <TOC>
33
+
30
34
  ## What is Intlayer?
31
35
 
32
36
  **Intlayer** is an innovative, open-source internationalization (i18n) library designed to simplify multilingual support in modern web applications. Intlayer seamlessly integrates with the latest **Next.js** framework, including its traditional **Page Router**.
@@ -25,6 +25,10 @@ history:
25
25
 
26
26
  See [Application Template](https://github.com/aymericzip/intlayer-nuxt-template) on GitHub.
27
27
 
28
+ ## Table of Contents
29
+
30
+ <TOC>
31
+
28
32
  ## What is Intlayer?
29
33
 
30
34
  **Intlayer** is an innovative, open-source internationalization (i18n) library designed to simplify multilingual support in modern web applications.
@@ -28,6 +28,10 @@ history:
28
28
 
29
29
  See [Application Template](https://github.com/aymericzip/intlayer-react-native-template) on GitHub.
30
30
 
31
+ ## Table of Contents
32
+
33
+ <TOC>
34
+
31
35
  ## What is Intlayer?
32
36
 
33
37
  **Intlayer** is an **innovative, open-source internationalization (i18n) library** that simplifies multilingual support in modern applications. It works in many JavaScript/TypeScript environments, **including React Native** (via the `react-intlayer` package).
@@ -153,6 +157,9 @@ module.exports = (async () => {
153
157
  })();
154
158
  ```
155
159
 
160
+ > Note: `configMetroIntlayer` is a promise function. Use `configMetroIntlayerSync` instead if you want to use it synchronously, or avoid IFFE (Immediately Invoked Function Expression).
161
+ > Note: `configMetroIntlayerSync` does not allow to build intlayer dictionaries on server start
162
+
156
163
  ## Step 4: Add the Intlayer provider
157
164
 
158
165
  To keep synchronized the user language across your application, you need to wrap your root component with the `IntlayerProvider` component from `react-intlayer-native`.
@@ -31,6 +31,10 @@ history:
31
31
 
32
32
  This guide demonstrates how to integrate **Intlayer** for seamless internationalization in React Router v7 projects with locale-aware routing, TypeScript support, and modern development practices.
33
33
 
34
+ ## Table of Contents
35
+
36
+ <TOC>
37
+
34
38
  ## What is Intlayer?
35
39
 
36
40
  **Intlayer** is an innovative, open-source internationalization (i18n) library designed to simplify multilingual support in modern web applications.
@@ -28,6 +28,10 @@ history:
28
28
 
29
29
  # Translate your Tanstack Start website using Intlayer | Internationalization (i18n)
30
30
 
31
+ ## Table of Contents
32
+
33
+ <TOC>
34
+
31
35
  This guide demonstrates how to integrate **Intlayer** for seamless internationalization in Tanstack Start projects with locale-aware routing, TypeScript support, and modern development practices.
32
36
 
33
37
  ## What is Intlayer?
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2025-04-18
3
- updatedAt: 2025-06-29
3
+ updatedAt: 2025-10-28
4
4
  title: How to translate your Vite and Preact app – i18n guide 2025
5
5
  description: Discover how to make your Vite and Preact website multilingual. Follow the documentation to internationalize (i18n) and translate it.
6
6
  keywords:
@@ -16,6 +16,9 @@ slugs:
16
16
  - vite-and-preact
17
17
  applicationTemplate: https://github.com/aymericzip/intlayer-vite-preact-template
18
18
  history:
19
+ - version: 7.0.0
20
+ date: 2025-10-28
21
+ changes: Update LocaleRouter component to use new route configuration
19
22
  - version: 5.5.10
20
23
  date: 2025-06-29
21
24
  changes: Init history
@@ -27,6 +30,10 @@ history:
27
30
 
28
31
  See [Application Template](https://github.com/aymericzip/intlayer-vite-preact-template) on GitHub.
29
32
 
33
+ ## Table of Contents
34
+
35
+ <TOC>
36
+
30
37
  ## What is Intlayer?
31
38
 
32
39
  **Intlayer** is an innovative, open-source internationalization (i18n) library designed to simplify multilingual support in modern web applications.
@@ -88,6 +95,10 @@ const config: IntlayerConfig = {
88
95
  ],
89
96
  defaultLocale: Locales.ENGLISH,
90
97
  },
98
+ routing: {
99
+ mode: "prefix-no-default", // Default: prefix all locales except the default locale
100
+ storage: ["cookie", "header"], // Default: store locale in cookie and detect from header
101
+ },
91
102
  };
92
103
 
93
104
  export default config;
@@ -107,6 +118,10 @@ const config = {
107
118
  ],
108
119
  defaultLocale: Locales.ENGLISH,
109
120
  },
121
+ routing: {
122
+ mode: "prefix-no-default", // Default: prefix all locales except the default locale
123
+ storage: ["cookie", "header"], // Default: store locale in cookie and detect from header
124
+ },
110
125
  };
111
126
 
112
127
  export default config;
@@ -126,12 +141,16 @@ const config = {
126
141
  ],
127
142
  defaultLocale: Locales.ENGLISH,
128
143
  },
144
+ routing: {
145
+ mode: "prefix-no-default", // Default: prefix all locales except the default locale
146
+ storage: ["cookie", "header"], // Default: store locale in cookie and detect from header
147
+ },
129
148
  };
130
149
 
131
150
  module.exports = config;
132
151
  ```
133
152
 
134
- > Through this configuration file, you can set up localized URLs, middleware redirection, cookie names, the location and extension of your content declarations, disable Intlayer logs in the console, and more. For a complete list of available parameters, refer to the [configuration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/configuration.md).
153
+ > Through this configuration file, you can set up localized URLs, routing modes, storage options, cookie names, the location and extension of your content declarations, disable Intlayer logs in the console, and more. For a complete list of available parameters, refer to the [configuration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/configuration.md).
135
154
 
136
155
  ### Step 3: Integrate Intlayer in Your Vite Configuration
137
156
 
@@ -607,7 +626,7 @@ Example:
607
626
  - https://example.com/fr/about
608
627
  ```
609
628
 
610
- > By default, the routes are not prefixed for the default locale. If you want to prefix the default locale, you can set the `middleware.prefixDefault` option to `true` in your configuration. See the [configuration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/configuration.md) for more information.
629
+ > By default, the routes are not prefixed for the default locale (`routing.mode: "prefix-no-default"`). If you want to prefix the default locale, you can set the `routing.mode` option to `"prefix-all"` in your configuration. See the [configuration documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/configuration.md) for more information.
611
630
 
612
631
  To add localized routing to your application, you can create a `LocaleRouter` component that wraps your application's routes and handles locale-based routing. Here is an example using [preact-iso](https://github.com/preactjs/preact-iso):
613
632
 
@@ -626,13 +645,13 @@ yarn add preact-iso
626
645
  ```
627
646
 
628
647
  ```tsx fileName="src/components/LocaleRouter.tsx" codeFormat="typescript"
629
- import { type Locales, configuration, getPathWithoutLocale } from "intlayer";
630
- import { ComponentChildren, FunctionalComponent } from "preact";
648
+ import { configuration, getPathWithoutLocale, type Locale } from "intlayer";
649
+ import type { ComponentChildren, FunctionalComponent } from "preact";
650
+ import { useEffect } from "preact/hooks";
631
651
  import { IntlayerProvider } from "preact-intlayer";
632
652
  import { LocationProvider, useLocation } from "preact-iso";
633
- import { useEffect } from "preact/hooks";
634
653
 
635
- const { internationalization, middleware } = configuration;
654
+ const { internationalization, routing } = configuration;
636
655
  const { locales, defaultLocale } = internationalization;
637
656
 
638
657
  const Navigate: FunctionalComponent<{ to: string; replace?: boolean }> = ({
@@ -652,7 +671,7 @@ const Navigate: FunctionalComponent<{ to: string; replace?: boolean }> = ({
652
671
  */
653
672
  const AppLocalized: FunctionalComponent<{
654
673
  children: ComponentChildren;
655
- locale?: Locales;
674
+ locale?: Locale;
656
675
  }> = ({ children, locale }) => {
657
676
  const { path: pathname, url } = useLocation();
658
677
 
@@ -671,9 +690,9 @@ const AppLocalized: FunctionalComponent<{
671
690
  );
672
691
 
673
692
  /**
674
- * If middleware.prefixDefault is true, the default locale should always be prefixed.
693
+ * If routing.mode is 'prefix-all', the default locale should always be prefixed.
675
694
  */
676
- if (middleware.prefixDefault) {
695
+ if (routing.mode === "prefix-all") {
677
696
  // Validate the locale
678
697
  if (!locale || !locales.includes(locale)) {
679
698
  // Redirect to the default locale with the updated path
@@ -691,7 +710,7 @@ const AppLocalized: FunctionalComponent<{
691
710
  );
692
711
  } else {
693
712
  /**
694
- * When middleware.prefixDefault is false, the default locale is not prefixed.
713
+ * When routing.mode is not 'prefix-all', the default locale is not prefixed.
695
714
  * Ensure that the current locale is valid and not the default locale.
696
715
  */
697
716
  if (
@@ -722,10 +741,12 @@ const RouterContent: FunctionalComponent<{
722
741
  return null;
723
742
  }
724
743
 
725
- const pathLocale = path.split("/")[1] as Locales;
744
+ const pathLocale = path.split("/")[1] as Locale;
726
745
 
727
746
  const isLocaleRoute = locales
728
- .filter((locale) => middleware.prefixDefault || locale !== defaultLocale)
747
+ .filter(
748
+ (locale) => routing.mode === "prefix-all" || locale !== defaultLocale
749
+ )
729
750
  .some((locale) => locale.toString() === pathLocale);
730
751
 
731
752
  if (isLocaleRoute) {
@@ -734,7 +755,7 @@ const RouterContent: FunctionalComponent<{
734
755
 
735
756
  return (
736
757
  <AppLocalized
737
- locale={!middleware.prefixDefault ? defaultLocale : undefined}
758
+ locale={routing.mode !== "prefix-all" ? defaultLocale : undefined}
738
759
  >
739
760
  {children}
740
761
  </AppLocalized>
@@ -763,7 +784,7 @@ import { useEffect } from "preact/hooks";
763
784
  import { h } from "preact"; // Required for JSX
764
785
 
765
786
  // Destructuring configuration from Intlayer
766
- const { internationalization, middleware } = configuration;
787
+ const { internationalization, routing } = configuration;
767
788
  const { locales, defaultLocale } = internationalization;
768
789
 
769
790
  const Navigate = ({ to, replace }) => {
@@ -796,9 +817,9 @@ const AppLocalized = ({ children, locale }) => {
796
817
  );
797
818
 
798
819
  /**
799
- * If middleware.prefixDefault is true, the default locale should always be prefixed.
820
+ * If routing.mode is 'prefix-all', the default locale should always be prefixed.
800
821
  */
801
- if (middleware.prefixDefault) {
822
+ if (routing.mode === "prefix-all") {
802
823
  // Validate the locale
803
824
  if (!locale || !locales.includes(locale)) {
804
825
  // Redirect to the default locale with the updated path
@@ -816,7 +837,7 @@ const AppLocalized = ({ children, locale }) => {
816
837
  );
817
838
  } else {
818
839
  /**
819
- * When middleware.prefixDefault is false, the default locale is not prefixed.
840
+ * When routing.mode is not 'prefix-all', the default locale is not prefixed.
820
841
  * Ensure that the current locale is valid and not the default locale.
821
842
  */
822
843
  if (
@@ -848,7 +869,9 @@ const RouterContent = ({ children }) => {
848
869
  const pathLocale = path.split("/")[1];
849
870
 
850
871
  const isLocaleRoute = locales
851
- .filter((locale) => middleware.prefixDefault || locale !== defaultLocale)
872
+ .filter(
873
+ (locale) => routing.mode === "prefix-all" || locale !== defaultLocale
874
+ )
852
875
  .some((locale) => locale.toString() === pathLocale);
853
876
 
854
877
  if (isLocaleRoute) {
@@ -857,7 +880,7 @@ const RouterContent = ({ children }) => {
857
880
 
858
881
  return (
859
882
  <AppLocalized
860
- locale={!middleware.prefixDefault ? defaultLocale : undefined}
883
+ locale={routing.mode !== "prefix-all" ? defaultLocale : undefined}
861
884
  >
862
885
  {children}
863
886
  </AppLocalized>
@@ -884,7 +907,7 @@ const { useEffect } = require("preact/hooks");
884
907
  const { h } = require("preact"); // Required for JSX
885
908
 
886
909
  // Destructuring configuration from Intlayer
887
- const { internationalization, middleware } = configuration;
910
+ const { internationalization, routing } = configuration;
888
911
  const { locales, defaultLocale } = internationalization;
889
912
 
890
913
  const Navigate = ({ to, replace }) => {
@@ -917,9 +940,9 @@ const AppLocalized = ({ children, locale }) => {
917
940
  );
918
941
 
919
942
  /**
920
- * If middleware.prefixDefault is true, the default locale should always be prefixed.
943
+ * If routing.mode is 'prefix-all', the default locale should always be prefixed.
921
944
  */
922
- if (middleware.prefixDefault) {
945
+ if (routing.mode === "prefix-all") {
923
946
  // Validate the locale
924
947
  if (!locale || !locales.includes(locale)) {
925
948
  // Redirect to the default locale with the updated path
@@ -937,7 +960,7 @@ const AppLocalized = ({ children, locale }) => {
937
960
  );
938
961
  } else {
939
962
  /**
940
- * When middleware.prefixDefault is false, the default locale is not prefixed.
963
+ * When routing.mode is not 'prefix-all', the default locale is not prefixed.
941
964
  * Ensure that the current locale is valid and not the default locale.
942
965
  */
943
966
  if (
@@ -969,7 +992,9 @@ const RouterContent = ({ children }) => {
969
992
  const pathLocale = path.split("/")[1];
970
993
 
971
994
  const isLocaleRoute = locales
972
- .filter((locale) => middleware.prefixDefault || locale !== defaultLocale)
995
+ .filter(
996
+ (locale) => routing.mode === "prefix-all" || locale !== defaultLocale
997
+ )
973
998
  .some((locale) => locale.toString() === pathLocale);
974
999
 
975
1000
  if (isLocaleRoute) {
@@ -978,7 +1003,7 @@ const RouterContent = ({ children }) => {
978
1003
 
979
1004
  return (
980
1005
  <AppLocalized
981
- locale={!middleware.prefixDefault ? defaultLocale : undefined}
1006
+ locale={routing.mode !== "prefix-all" ? defaultLocale : undefined}
982
1007
  >
983
1008
  {children}
984
1009
  </AppLocalized>
@@ -29,6 +29,10 @@ history:
29
29
 
30
30
  See [Application Template](https://github.com/aymericzip/intlayer-vite-react-template) on GitHub.
31
31
 
32
+ ## Table of Contents
33
+
34
+ <TOC>
35
+
32
36
  ## What is Intlayer?
33
37
 
34
38
  **Intlayer** is an innovative, open-source internationalization (i18n) library designed to simplify multilingual support in modern web applications.
@@ -42,6 +42,10 @@ With Intlayer, you can:
42
42
 
43
43
  ## Step-by-Step Guide to Set Up Intlayer in a Vite and Solid Application
44
44
 
45
+ ## Table of Contents
46
+
47
+ <TOC>
48
+
45
49
  ### Step 1: Install Dependencies
46
50
 
47
51
  Install the necessary packages using npm:
@@ -27,6 +27,10 @@ history:
27
27
 
28
28
  <!-- See [Application Template](https://github.com/aymericzip/intlayer-solid-template) on GitHub. -->
29
29
 
30
+ ## Table of Contents
31
+
32
+ <TOC>
33
+
30
34
  ## What is Intlayer?
31
35
 
32
36
  **Intlayer** is an innovative, open-source internationalization (i18n) library designed to simplify multilingual support in modern web applications.
@@ -25,6 +25,10 @@ history:
25
25
 
26
26
  See [Application Template](https://github.com/aymericzip/intlayer-vite-vue-template) on GitHub.
27
27
 
28
+ ## Table of Contents
29
+
30
+ <TOC>
31
+
28
32
  ## What is Intlayer?
29
33
 
30
34
  **Intlayer** is an innovative, open-source internationalization (i18n) library designed to simplify multilingual support in modern web applications.
@@ -187,6 +187,7 @@ Organize your multilingual content close to your code to keep everything consist
187
187
 
188
188
  We’ve built Intlayer with flexibility in mind, offering seamless integration across popular frameworks and build tools:
189
189
 
190
+ - **[Intlayer with Next.js 16](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_with_nextjs_16.md)**
190
191
  - **[Intlayer with Next.js 15](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_with_nextjs_15.md)**
191
192
  - **[Intlayer with Next.js 14 (App Router)](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_with_nextjs_14.md)**
192
193
  - **[Intlayer with Next.js Page Router](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_with_nextjs_page_router.md)**
@@ -187,8 +187,7 @@ storage: ['cookie', 'localStorage']
187
187
 
188
188
  For production applications that need to balance functionality with GDPR compliance:
189
189
 
190
- ```typescript
191
- // intlayer.config.ts
190
+ ```typescript fileName="intlayer.config.ts"
192
191
  export default {
193
192
  internationalization: {
194
193
  locales: ["en", "fr", "es"],
@@ -260,8 +259,7 @@ If not set, Intlayer will try to detect the format command automatically. By try
260
259
 
261
260
  The `formatCommand` option accepts a string template where `{{file}}` will be replaced with the actual file path:
262
261
 
263
- ```typescript
264
- // intlayer.config.ts
262
+ ```typescript fileName="intlayer.config.ts"
265
263
  export default {
266
264
  content: {
267
265
  formatCommand: 'bun x biome format "{{file}}" --write --log-level none',
@@ -320,7 +318,7 @@ The `fill` property has been moved from the `content` section to a new `dictiona
320
318
 
321
319
  **v6 configuration:**
322
320
 
323
- ```typescript
321
+ ```typescript fileName="intlayer.config.ts"
324
322
  export default {
325
323
  content: {
326
324
  autoFill: "./{{fileName}}.content.json",
@@ -331,7 +329,7 @@ export default {
331
329
 
332
330
  **v7 configuration:**
333
331
 
334
- ```typescript
332
+ ```typescript fileName="intlayer.config.ts"
335
333
  export default {
336
334
  content: {
337
335
  contentDir: ["src"],
@@ -399,7 +397,7 @@ The fill command now supports complex content declaration structures, including:
399
397
 
400
398
  ### Example usage
401
399
 
402
- ```typescript
400
+ ```typescript fileName="*.content.ts"
403
401
  // Rewrite current file with all locales
404
402
  const content = {
405
403
  key: "example",
@@ -484,7 +482,7 @@ Advanced chunking strategies handle large content files without exceeding AI con
484
482
 
485
483
  ### Example workflow
486
484
 
487
- ```typescript
485
+ ```typescript fileName="*.content.ts"
488
486
  // Large content file gets automatically chunked
489
487
  const content = {
490
488
  key: "large-documentation",
@@ -539,7 +537,7 @@ The system automatically:
539
537
 
540
538
  **Before (v6):**
541
539
 
542
- ```typescript
540
+ ```typescript fileName="intlayer.config.ts"
543
541
  export default {
544
542
  content: {
545
543
  autoFill: "./{{fileName}}.content.json",
@@ -558,7 +556,7 @@ export default {
558
556
 
559
557
  **After (v7):**
560
558
 
561
- ```typescript
559
+ ```typescript fileName="intlayer.config.ts"
562
560
  export default {
563
561
  content: {
564
562
  contentDir: ["src"],
@@ -588,7 +586,7 @@ export default {
588
586
 
589
587
  **Before (v6):**
590
588
 
591
- ```typescript
589
+ ```typescript fileName="*.content.ts"
592
590
  const content = {
593
591
  key: "example",
594
592
  autoFill: true, // Rewrites this file
@@ -600,7 +598,7 @@ const content = {
600
598
 
601
599
  **After (v7):**
602
600
 
603
- ```typescript
601
+ ```typescript fileName="*.content.ts"
604
602
  const content = {
605
603
  key: "example",
606
604
  fill: true, // Rewrites this file
@@ -31,6 +31,12 @@ Intlayer is a content management and internationalization solution designed to s
31
31
 
32
32
  ---
33
33
 
34
+ ## Table of Contents
35
+
36
+ <TOC>
37
+
38
+ ---
39
+
34
40
  ## Current Features
35
41
 
36
42
  ### 1. Content Declaration
@@ -722,15 +722,17 @@ export const generateMetadata = ({
722
722
  * ```
723
723
  */
724
724
  const multilingualUrls = getMultilingualUrls("/");
725
+ const localizedUrl =
726
+ multilingualUrls[locale as keyof typeof multilingualUrls];
725
727
 
726
728
  return {
727
729
  ...metadata,
728
730
  alternates: {
729
- canonical: multilingualUrls[locale as keyof typeof multilingualUrls],
731
+ canonical: localizedUrl,
730
732
  languages: { ...multilingualUrls, "x-default": "/" },
731
733
  },
732
734
  openGraph: {
733
- url: multilingualUrls[locale],
735
+ url: localizedUrl,
734
736
  },
735
737
  };
736
738
  };
@@ -760,15 +762,16 @@ export const generateMetadata = ({ params: { locale } }) => {
760
762
  * ```
761
763
  */
762
764
  const multilingualUrls = getMultilingualUrls("/");
765
+ const localizedUrl = multilingualUrls[locale];
763
766
 
764
767
  return {
765
768
  ...metadata,
766
769
  alternates: {
767
- canonical: multilingualUrls[locale],
770
+ canonical: localizedUrl,
768
771
  languages: { ...multilingualUrls, "x-default": "/" },
769
772
  },
770
773
  openGraph: {
771
- url: multilingualUrls[locale],
774
+ url: localizedUrl,
772
775
  },
773
776
  };
774
777
  };
@@ -798,15 +801,16 @@ const generateMetadata = ({ params: { locale } }) => {
798
801
  * ```
799
802
  */
800
803
  const multilingualUrls = getMultilingualUrls("/");
804
+ const localizedUrl = multilingualUrls[locale];
801
805
 
802
806
  return {
803
807
  ...metadata,
804
808
  alternates: {
805
- canonical: multilingualUrls[locale],
809
+ canonical: localizedUrl,
806
810
  languages: { ...multilingualUrls, "x-default": "/" },
807
811
  },
808
812
  openGraph: {
809
- url: multilingualUrls[locale],
813
+ url: localizedUrl,
810
814
  },
811
815
  };
812
816
  };