@intlayer/docs 9.0.0-canary.5 → 9.0.0-canary.6

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 (37) hide show
  1. package/docs/ar/intlayer_with_react_native+expo.md +56 -79
  2. package/docs/ar/packages/react-native-intlayer/exports.md +48 -14
  3. package/docs/de/intlayer_with_react_native+expo.md +50 -68
  4. package/docs/de/packages/react-native-intlayer/exports.md +47 -13
  5. package/docs/en/intlayer_with_react_native+expo.md +14 -18
  6. package/docs/en/packages/react-native-intlayer/exports.md +47 -13
  7. package/docs/en-GB/intlayer_with_react_native+expo.md +40 -94
  8. package/docs/en-GB/packages/react-native-intlayer/exports.md +51 -18
  9. package/docs/es/intlayer_with_react_native+expo.md +43 -80
  10. package/docs/es/packages/react-native-intlayer/exports.md +47 -13
  11. package/docs/fr/intlayer_with_react_native+expo.md +54 -68
  12. package/docs/fr/packages/react-native-intlayer/exports.md +47 -13
  13. package/docs/hi/intlayer_with_react_native+expo.md +90 -87
  14. package/docs/hi/packages/react-native-intlayer/exports.md +48 -14
  15. package/docs/id/intlayer_with_react_native+expo.md +45 -33
  16. package/docs/id/packages/react-native-intlayer/exports.md +47 -13
  17. package/docs/it/intlayer_with_react_native+expo.md +32 -72
  18. package/docs/it/packages/react-native-intlayer/exports.md +47 -13
  19. package/docs/ja/intlayer_with_react_native+expo.md +98 -137
  20. package/docs/ja/packages/react-native-intlayer/exports.md +47 -14
  21. package/docs/ko/intlayer_with_react_native+expo.md +231 -29
  22. package/docs/ko/packages/react-native-intlayer/exports.md +48 -14
  23. package/docs/pl/intlayer_with_react_native+expo.md +75 -46
  24. package/docs/pl/packages/react-native-intlayer/exports.md +47 -13
  25. package/docs/pt/intlayer_with_react_native+expo.md +38 -75
  26. package/docs/pt/packages/react-native-intlayer/exports.md +47 -13
  27. package/docs/ru/intlayer_with_react_native+expo.md +71 -60
  28. package/docs/ru/packages/react-native-intlayer/exports.md +49 -16
  29. package/docs/tr/intlayer_with_react_native+expo.md +30 -56
  30. package/docs/tr/packages/react-native-intlayer/exports.md +48 -15
  31. package/docs/uk/intlayer_with_react_native+expo.md +64 -52
  32. package/docs/uk/packages/react-native-intlayer/exports.md +47 -13
  33. package/docs/vi/intlayer_with_react_native+expo.md +43 -32
  34. package/docs/vi/packages/react-native-intlayer/exports.md +47 -13
  35. package/docs/zh/intlayer_with_react_native+expo.md +216 -82
  36. package/docs/zh/packages/react-native-intlayer/exports.md +48 -14
  37. package/package.json +6 -6
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2025-06-18
3
- updatedAt: 2026-05-31
3
+ updatedAt: 2026-06-25
4
4
  title: "Expo + React Native i18n - Complete guide to translate your app"
5
5
  description: "No more i18next. The 2026 guide to building a multilingual (i18n) Expo + React Native app. Translate with AI agents and optimise bundle size, SEO and performances."
6
6
  keywords:
@@ -17,6 +17,9 @@ slugs:
17
17
  applicationTemplate: https://github.com/aymericzip/intlayer-react-native-template
18
18
  applicationShowcase: https://intlayer-react-native.vercel.app
19
19
  history:
20
+ - version: 9.0.0
21
+ date: 2026-06-25
22
+ changes: "Import providers and hooks directly from react-native-intlayer; react-intlayer is no longer needed as a direct dependency"
20
23
  - version: 8.9.0
21
24
  date: 2026-05-04
22
25
  changes: "Update Solid useIntlayer API usage to direct property access"
@@ -29,7 +32,7 @@ history:
29
32
  author: aymericzip
30
33
  ---
31
34
 
32
- # Getting Started Internationalising (i18n) with Intlayer and React Native
35
+ # Translate your Expo and React Native app | Internationalisation (i18n)
33
36
 
34
37
  <Tabs defaultTab="code">
35
38
  <Tab label="Code" value="code">
@@ -37,7 +40,7 @@ author: aymericzip
37
40
  <iframe
38
41
  src="https://ide.intlayer.org/aymericzip/intlayer-react-native-template?file=intlayer.config.ts"
39
42
  className="m-auto overflow-hidden rounded-lg border-0 max-md:size-full max-md:h-[700px] md:aspect-16/9 md:w-full"
40
- title="Demo CodeSandbox - Intlayer"
43
+ title="Demo CodeSandbox - How to Internationalise your application using Intlayer"
41
44
  sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
42
45
  loading="lazy"
43
46
  />
@@ -56,17 +59,19 @@ author: aymericzip
56
59
  </Tab>
57
60
  </Tabs>
58
61
 
59
- See [Application Template](https://github.com/aymericzip/intlayer-react-native-template) on GitHub.
62
+ ## Table of Contents
63
+
64
+ <TOC/>
60
65
 
61
66
  ## Why Intlayer over alternatives?
62
67
 
63
- Compared to main solutions like `react-native-localize` or `i18next`, Intlayer is a solution that comes with integrated optimizations such as:
68
+ Compared to main solutions like `react-native-localize` or `i18next`, Intlayer is a solution that comes with integrated optimisations such as:
64
69
 
65
70
  <AccordionGroup>
66
71
 
67
72
  <Accordion header="Full React Native coverage">
68
73
 
69
- Intlayer is optimized to work perfectly with React Native and Expo by offering **component-level content scoping**, **TypeScript support**, and all the features needed for scaling internationalization (i18n) in mobile apps.
74
+ Intlayer is optimised to work perfectly with React Native and Expo by offering **component-level content scoping**, **TypeScript support**, and all the features needed for scaling internationalisation (i18n) in mobile apps.
70
75
 
71
76
  </Accordion>
72
77
 
@@ -90,7 +95,7 @@ Use automation to translate in your CI/CD pipeline using the LLM of your choice
90
95
 
91
96
  <Accordion header="Performance">
92
97
 
93
- Connecting massive JSON files to components can lead to performance and reactivity issues. Intlayer optimizes your content loading at build time.
98
+ Connecting massive JSON files to components can lead to performance and reactivity issues. Intlayer optimises your content loading at build time.
94
99
 
95
100
  </Accordion>
96
101
 
@@ -136,23 +141,19 @@ bunx intlayer-cli init --interactive
136
141
  > This command will detect your environment and install the required packages. For example:
137
142
 
138
143
  ```bash packageManager="npm"
139
- npm install intlayer react-intlayer
140
- npm install --save-dev react-native-intlayer
144
+ npm install intlayer react-native-intlayer
141
145
  ```
142
146
 
143
147
  ```bash packageManager="pnpm"
144
- pnpm add intlayer react-intlayer
145
- pnpm add --save-dev react-native-intlayer
148
+ pnpm add intlayer react-native-intlayer
146
149
  ```
147
150
 
148
151
  ```bash packageManager="yarn"
149
- yarn add intlayer react-intlayer
150
- yarn add --save-dev react-native-intlayer
152
+ yarn add intlayer react-native-intlayer
151
153
  ```
152
154
 
153
155
  ```bash packageManager="bun"
154
- bun add intlayer react-intlayer
155
- bun add --dev react-native-intlayer
156
+ bun add intlayer react-native-intlayer
156
157
  ```
157
158
 
158
159
  ### Packages
@@ -160,76 +161,14 @@ bun add --dev react-native-intlayer
160
161
  - **intlayer**
161
162
  The core i18n toolkit for configuration, dictionary content, types generation, and CLI commands.
162
163
 
163
- - **react-intlayer**
164
- React integration that provides the context providers and React hooks you’ll use in React Native for obtaining and switching locales.
165
-
166
164
  - **react-native-intlayer**
167
- React Native integration that provides the Metro plugin for integrating Intlayer with the React Native bundler.
165
+ React Native integration that provides the context providers and React hooks you'll use to obtain and switch locales, the React Native polyfills, and the Metro plugin for integrating Intlayer with the React Native bundler. It re-exports everything from `react-intlayer`, so you only need this single package in a React Native app.
168
166
 
169
167
  ---
170
168
 
171
169
  </Step>
172
170
 
173
- <Step number={2} title="Install Dependencies">
174
-
175
- From your React Native project, install the following packages:
176
-
177
- ```bash packageManager="npm"
178
- npx intlayer-cli init --interactive
179
- ```
180
-
181
- ```bash packageManager="pnpm"
182
- pnpm dlx intlayer-cli init --interactive
183
- ```
184
-
185
- ```bash packageManager="yarn"
186
- yarn dlx intlayer-cli init --interactive
187
- ```
188
-
189
- ```bash packageManager="bun"
190
- bunx intlayer-cli init --interactive
191
- ```
192
-
193
- > the `--interactive` flag is optional. Use `intlayer-cli init` if you're an AI agent.
194
-
195
- > This command will detect your environment and install the required packages. For example:
196
-
197
- ```bash packageManager="npm"
198
- npm install intlayer react-intlayer
199
- npm install --save-dev react-native-intlayer
200
- ```
201
-
202
- ```bash packageManager="pnpm"
203
- pnpm add intlayer react-intlayer
204
- pnpm add --save-dev react-native-intlayer
205
- ```
206
-
207
- ```bash packageManager="yarn"
208
- yarn add intlayer react-intlayer
209
- yarn add --save-dev react-native-intlayer
210
- ```
211
-
212
- ```bash packageManager="bun"
213
- bun add intlayer react-intlayer
214
- bun add --dev react-native-intlayer
215
- ```
216
-
217
- ### Packages
218
-
219
- - **intlayer**
220
- The core i18n toolkit for configuration, dictionary content, types generation, and CLI commands.
221
-
222
- - **react-intlayer**
223
- React integration that provides the context providers and React hooks you’ll use in React Native for obtaining and switching locales.
224
-
225
- - **react-native-intlayer**
226
- React Native integration that provides the Metro plugin for integrating Intlayer with the React Native bundler.
227
-
228
- ---
229
-
230
- </Step>
231
-
232
- <Step number={3} title="Create an Intlayer Config">
171
+ <Step number={2} title="Create an Intlayer Config">
233
172
 
234
173
  In your project root (or anywhere convenient), create an **Intlayer config** file. It might look like this:
235
174
 
@@ -263,7 +202,7 @@ Within this config, you can:
263
202
 
264
203
  </Step>
265
204
 
266
- <Step number={4} title="Add the Metro plugin">
205
+ <Step number={3} title="Add the Metro plugin">
267
206
 
268
207
  Metro is a bundler for React Native. It is the default bundler for React Native projects created with the `react-native init` command. To use Intlayer with Metro, you need to add the plugin to your `metro.config.js` file:
269
208
 
@@ -278,13 +217,18 @@ module.exports = (async () => {
278
217
  })();
279
218
  ```
280
219
 
220
+ > Note: `configMetroIntlayer` is a promise function. Use `configMetroIntlayerSync` instead if you want to use it synchronously, or avoid IFFE (Immediately Invoked Function Expression).
221
+ > Note: `configMetroIntlayerSync` does not allow building intlayer dictionaries on server start.
222
+
281
223
  </Step>
282
224
 
283
- <Step number={5} title="Add the Intlayer provider">
225
+ <Step number={4} title="Add the Intlayer provider">
226
+
227
+ To keep the user language synchronised across your application, you need to wrap your root component with the `IntlayerProvider` component from `react-native-intlayer`.
284
228
 
285
- To keep synchronized the user language across your application, you need to wrap your root component with the `IntlayerProvider` component from `react-intlayer-native`.
229
+ > Always import from `react-native-intlayer`. Its `IntlayerProvider` includes polyfills for the web API used by Intlayer, and the package re-exports all the hooks and utilities from `react-intlayer`.
286
230
 
287
- > Make sure to use the provider from `react-native-intlayer` instead of `react-intlayer`. The export from `react-native-intlayer` includes polyfills for the web API.
231
+ Also, you need to add the `intlayerPolyfill` function to your `index.js` file to ensure that Intlayer can work properly.
288
232
 
289
233
  ```tsx fileName="app/_layout.tsx" codeFormat={["typescript", "esm"]}
290
234
  import { Stack } from "expo-router";
@@ -309,7 +253,7 @@ export default RootLayout;
309
253
 
310
254
  </Step>
311
255
 
312
- <Step number={6} title="Declare Your Content">
256
+ <Step number={5} title="Declare Your Content">
313
257
 
314
258
  Create **content declaration** files anywhere in your project (commonly within `src/`), using any of the extension formats that Intlayer supports:
315
259
 
@@ -324,7 +268,7 @@ Create **content declaration** files anywhere in your project (commonly within `
324
268
  - `.content.cjx`
325
269
  - etc.
326
270
 
327
- > **Expo Router (web): keep `.content.*` files out of the `app/` directory.** Expo Router treats every JavaScript/TypeScript file inside `app/` as a route. On web, its route discovery scans the filesystem directly and does **not** honor Metro's `resolver.blockList`, so a co-located `*.content.ts` is registered as a route. A file such as `app/(tabs)/_layout.content.ts` is even parsed as a layout (the `.content` part is read as a platform suffix), which collides with the real `_layout.tsx` and throws:
271
+ > **Expo Router (web): keep `.content.*` files out of the `app/` directory.** Expo Router treats every JavaScript/TypeScript file inside `app/` as a route. On web, its route discovery scans the filesystem directly and does **not** honour Metro's `resolver.blockList`, so a co-located `*.content.ts` is registered as a route. A file such as `app/(tabs)/_layout.content.ts` is even parsed as a layout (the `.content` part is read as a platform suffix), which collides with the real `_layout.tsx` and throws:
328
272
  >
329
273
  > ```
330
274
  > The layouts "./(tabs)/_layout.content.ts" and "./(tabs)/_layout.tsx" conflict on the route "/(tabs)/_layout.content". Remove or rename one of these files.
@@ -375,13 +319,13 @@ export default homeScreenContent;
375
319
  }
376
320
  ```
377
321
 
378
- > For details on content declarations, see [Intlayers content docs](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/dictionary/content_file.md).
322
+ > For details on content declarations, see [Intlayer's content docs](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/dictionary/content_file.md).
379
323
 
380
324
  ---
381
325
 
382
326
  </Step>
383
327
 
384
- <Step number={7} title="Use Intlayer in Your Components">
328
+ <Step number={6} title="Use Intlayer in Your Components">
385
329
 
386
330
  Use the `useIntlayer` hook in child components to obtain localised content.
387
331
 
@@ -389,7 +333,7 @@ Use the `useIntlayer` hook in child components to obtain localised content.
389
333
 
390
334
  ```tsx fileName="app/(tabs)/index.tsx" codeFormat={["typescript", "esm"]}
391
335
  import { Image, StyleSheet, Platform } from "react-native";
392
- import { useIntlayer } from "intlayer";
336
+ import { useIntlayer } from "react-native-intlayer";
393
337
  import { HelloWave } from "@/components/HelloWave";
394
338
  import ParallaxScrollView from "@/components/ParallaxScrollView";
395
339
  import { ThemedText } from "@/components/ThemedText";
@@ -428,21 +372,23 @@ const styles = StyleSheet.create({
428
372
  export default HomeScreen;
429
373
  ```
430
374
 
431
- > When using `content.someKey` in string-based props (e.g., a buttons `title` or a `Text` components `children`), **call `content.someKey.value`** to obtain the actual string.
375
+ > When using `content.someKey` in string-based props (e.g., a button's `title` or a `Text` component's `children`), **call `content.someKey.value`** to obtain the actual string.
376
+
377
+ > If your app already exists, you can use the [Intlayer Compiler](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/compiler.md), as well as the [extract command](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/cli/extract.md), to transform thousands of components in a second.
432
378
 
433
379
  ---
434
380
 
435
381
  </Step>
436
382
 
437
- <Step number={8} title="Change the App Locale" isOptional={true}>
383
+ <Step number={7} title="Change the App Locale" isOptional={true}>
438
384
 
439
- To switch locales from within your components, you can use the `useLocale` hooks `setLocale` method:
385
+ To switch locales from within your components, you can use the `useLocale` hook's `setLocale` method:
440
386
 
441
387
  ```tsx fileName="src/components/LocaleSwitcher.tsx" codeFormat={["typescript", "esm"]}
442
388
  import { type FC } from "react";
443
389
  import { View, Text, TouchableOpacity, StyleSheet } from "react-native";
444
390
  import { getLocaleName } from "intlayer";
445
- import { useLocale } from "react-intlayer";
391
+ import { useLocale } from "react-native-intlayer";
446
392
 
447
393
  export const LocaleSwitcher: FC = () => {
448
394
  const { setLocale, availableLocales } = useLocale();
@@ -483,7 +429,7 @@ const styles = StyleSheet.create({
483
429
  });
484
430
  ```
485
431
 
486
- This triggers a re-render of all components that use Intlayer content, now displaying translations for the new locale.
432
+ This triggers a re-render of all components that use Intlayer content, now showing translations for the new locale.
487
433
 
488
434
  > See [`useLocale` docs](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/packages/react-intlayer/useLocale.md) for more details.
489
435
 
@@ -560,7 +506,7 @@ Intlayer primarily targets the Web Intl API; on React Native you must include th
560
506
 
561
507
  Checklist:
562
508
 
563
- - Use the latest versions of `intlayer`, `react-intlayer`, and `react-native-intlayer`.
509
+ - Use the latest versions of `intlayer` and `react-native-intlayer`.
564
510
  - Enable the Intlayer polyfill.
565
511
  - If you use `getLocaleName` or other Intl-API-based utilities, import these polyfills early (for example in `index.js` or `App.tsx`):
566
512
 
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  createdAt: 2026-01-21
3
- updatedAt: 2026-01-21
3
+ updatedAt: 2026-06-25
4
4
  title: react-native-intlayer Package Documentation
5
- description: React Native support for Intlayer, providing a provider and polyfills.
5
+ description: React Native support for Intlayer, providing providers, hooks, polyfills, and Metro configuration.
6
6
  keywords:
7
7
  - react-native-intlayer
8
8
  - react-native
@@ -14,6 +14,9 @@ slugs:
14
14
  - react-native-intlayer
15
15
  - exports
16
16
  history:
17
+ - version: 9.0.0
18
+ date: 2026-06-25
19
+ changes: "Re-export the full react-intlayer API (hooks, utilities, format/html/markdown subpaths) so a React Native app only depends on react-native-intlayer"
17
20
  - version: 8.0.0
18
21
  date: 2026-01-21
19
22
  changes: "Unified documentation for all exports"
@@ -22,7 +25,9 @@ author: aymericzip
22
25
 
23
26
  # react-native-intlayer Package
24
27
 
25
- The `react-native-intlayer` package provides the necessary tools to integrate Intlayer into React Native applications. It includes a provider and polyfills for locale support.
28
+ The `react-native-intlayer` package provides the necessary tools to integrate Intlayer into React Native applications. It re-exports the full `react-intlayer` API (hooks and utilities) with a React Native-ready `IntlayerProvider`, plus the polyfills and Metro configuration required by React Native.
29
+
30
+ > In a React Native app, import **everything** from `react-native-intlayer`. You do not need to install or import `react-intlayer` directly.
26
31
 
27
32
  ## Installation
28
33
 
@@ -34,31 +39,62 @@ npm install react-native-intlayer
34
39
 
35
40
  ### Provider
36
41
 
37
- | Component | Description |
38
- | ------------------ | --------------------------------------------------------------------------------- |
39
- | `IntlayerProvider` | Provider component that wraps your application and provides the Intlayer context. |
42
+ | Component | Description |
43
+ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
44
+ | `IntlayerProvider` | Provider component that wraps your application and provides the Intlayer context. Automatically applies the required polyfills. |
45
+
46
+ ```tsx
47
+ import { IntlayerProvider } from "react-native-intlayer";
48
+ ```
49
+
50
+ ### Hooks and utilities
51
+
52
+ These are re-exported from `react-intlayer`, so you can import them straight from `react-native-intlayer`:
40
53
 
41
- Import:
54
+ | Export | Description |
55
+ | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
56
+ | `useIntlayer` | Access localised content for a dictionary key. |
57
+ | `useLocale` | Read and change the current locale. |
58
+ | `useDictionary`, `useDictionaryAsync`, `useDictionaryDynamic`, `useLoadDynamic` | Load dictionary content in various ways. |
59
+ | `useI18n` | i18next-compatible hook. |
60
+ | `t` | Inline translation helper. |
61
+ | `getIntlayer`, `getDictionary` | Imperative content getters. |
62
+ | `localeCookie`, `localeInStorage`, `setLocaleCookie`, `setLocaleInStorage`, `useLocaleCookie`, `useLocaleStorage` | Locale persistence helpers. |
42
63
 
43
64
  ```tsx
44
- import "react-native-intlayer";
65
+ import { useIntlayer, useLocale, t } from "react-native-intlayer";
45
66
  ```
46
67
 
47
68
  ### Polyfill
48
69
 
49
- | Function | Description |
50
- | ------------------ | ----------------------------------------------------------------------------------- |
51
- | `intlayerPolyfill` | Function that applies the necessary polyfills for React Native to support Intlayer. |
70
+ | Function | Description |
71
+ | ------------------ | ------------------------------------------------------------------------------- |
72
+ | `intlayerPolyfill` | Function that applies necessary polyfills for React Native to support Intlayer. |
73
+
74
+ ```tsx
75
+ import { intlayerPolyfill } from "react-native-intlayer";
76
+ ```
77
+
78
+ > The polyfill is applied automatically when you import `IntlayerProvider`. Call `intlayerPolyfill` manually only if you need the polyfills before the provider mounts.
79
+
80
+ ### Formatters
81
+
82
+ Number, date, and other Intl-based formatting hooks are available from the `/format` subpath:
52
83
 
53
- Import:
84
+ ```tsx
85
+ import { useNumber, useDate } from "react-native-intlayer/format";
86
+ ```
87
+
88
+ ### Markdown and HTML rendering
54
89
 
55
90
  ```tsx
56
- import "react-native-intlayer";
91
+ import { MarkdownProvider } from "react-native-intlayer/markdown";
92
+ import { HTMLProvider } from "react-native-intlayer/html";
57
93
  ```
58
94
 
59
95
  ### Metro Configuration
60
96
 
61
- The `react-native-intlayer` package provides Metro configuration utilities to ensure that Intlayer functions correctly with React Native.
97
+ The `react-native-intlayer` package provides Metro configuration utilities to ensure that Intlayer works correctly with React Native.
62
98
 
63
99
  | Function | Description |
64
100
  | ------------------------- | ---------------------------------------------------------------------------------------------- |
@@ -66,9 +102,6 @@ The `react-native-intlayer` package provides Metro configuration utilities to en
66
102
  | `configMetroIntlayerSync` | Synchronous function that merges the Metro configuration without preparing Intlayer resources. |
67
103
  | `exclusionList` | Creates a RegExp pattern for Metro's blockList to exclude content files from the bundle. |
68
104
 
69
- Import:
70
-
71
105
  ```tsx
72
- import "react-native-intlayer/metro";
73
- import "react-native-intlayer/metro";
106
+ import { configMetroIntlayer } from "react-native-intlayer/metro";
74
107
  ```