@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.
- package/docs/ar/intlayer_with_react_native+expo.md +56 -79
- package/docs/ar/packages/react-native-intlayer/exports.md +48 -14
- package/docs/de/intlayer_with_react_native+expo.md +50 -68
- package/docs/de/packages/react-native-intlayer/exports.md +47 -13
- package/docs/en/intlayer_with_react_native+expo.md +14 -18
- package/docs/en/packages/react-native-intlayer/exports.md +47 -13
- package/docs/en-GB/intlayer_with_react_native+expo.md +40 -94
- package/docs/en-GB/packages/react-native-intlayer/exports.md +51 -18
- package/docs/es/intlayer_with_react_native+expo.md +43 -80
- package/docs/es/packages/react-native-intlayer/exports.md +47 -13
- package/docs/fr/intlayer_with_react_native+expo.md +54 -68
- package/docs/fr/packages/react-native-intlayer/exports.md +47 -13
- package/docs/hi/intlayer_with_react_native+expo.md +90 -87
- package/docs/hi/packages/react-native-intlayer/exports.md +48 -14
- package/docs/id/intlayer_with_react_native+expo.md +45 -33
- package/docs/id/packages/react-native-intlayer/exports.md +47 -13
- package/docs/it/intlayer_with_react_native+expo.md +32 -72
- package/docs/it/packages/react-native-intlayer/exports.md +47 -13
- package/docs/ja/intlayer_with_react_native+expo.md +98 -137
- package/docs/ja/packages/react-native-intlayer/exports.md +47 -14
- package/docs/ko/intlayer_with_react_native+expo.md +231 -29
- package/docs/ko/packages/react-native-intlayer/exports.md +48 -14
- package/docs/pl/intlayer_with_react_native+expo.md +75 -46
- package/docs/pl/packages/react-native-intlayer/exports.md +47 -13
- package/docs/pt/intlayer_with_react_native+expo.md +38 -75
- package/docs/pt/packages/react-native-intlayer/exports.md +47 -13
- package/docs/ru/intlayer_with_react_native+expo.md +71 -60
- package/docs/ru/packages/react-native-intlayer/exports.md +49 -16
- package/docs/tr/intlayer_with_react_native+expo.md +30 -56
- package/docs/tr/packages/react-native-intlayer/exports.md +48 -15
- package/docs/uk/intlayer_with_react_native+expo.md +64 -52
- package/docs/uk/packages/react-native-intlayer/exports.md +47 -13
- package/docs/vi/intlayer_with_react_native+expo.md +43 -32
- package/docs/vi/packages/react-native-intlayer/exports.md +47 -13
- package/docs/zh/intlayer_with_react_native+expo.md +216 -82
- package/docs/zh/packages/react-native-intlayer/exports.md +48 -14
- package/package.json +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-06-18
|
|
3
|
-
updatedAt: 2026-
|
|
3
|
+
updatedAt: 2026-06-25
|
|
4
4
|
title: "Expo + React Native i18n - あなたのアプリを翻訳する完全ガイド"
|
|
5
5
|
description: "i18nextはもう不要。2026年に多言語(i18n)Expo + React Nativeアプリを構築するためのガイド。AIエージェントで翻訳し、バンドルサイズ、SEO、パフォーマンスを最適化します。"
|
|
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: "プロバイダーとフックを react-native-intlayer から直接インポートするよう変更。react-intlayer は直接の依存関係として不要になった"
|
|
20
23
|
- version: 8.9.0
|
|
21
24
|
date: 2026-05-04
|
|
22
25
|
changes: "Solid の useIntlayer API の使用法を直接プロパティアクセスに更新"
|
|
@@ -56,127 +59,118 @@ author: aymericzip
|
|
|
56
59
|
</Tab>
|
|
57
60
|
</Tabs>
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
## 目次
|
|
60
63
|
|
|
61
|
-
|
|
64
|
+
<TOC/>
|
|
62
65
|
|
|
63
|
-
|
|
66
|
+
## 代替手段ではなく Intlayer を使用する理由
|
|
64
67
|
|
|
65
|
-
|
|
68
|
+
`react-native-localize` や `i18next` などの主要なソリューションと比較して、Intlayer は次のような統合された最適化を備えたソリューションです。
|
|
66
69
|
|
|
67
|
-
|
|
70
|
+
<AccordionGroup>
|
|
68
71
|
|
|
69
|
-
|
|
72
|
+
<Accordion header="React Native を完全にカバー">
|
|
70
73
|
|
|
71
|
-
|
|
74
|
+
Intlayer は、**コンポーネントレベルのコンテンツスコープ**、**TypeScript サポート**、およびモバイルアプリの国際化 (i18n) のスケーリングに必要なすべての機能を提供することにより、React Native および Expo と完全に連携するように最適化されています。
|
|
72
75
|
|
|
73
|
-
|
|
76
|
+
</Accordion>
|
|
74
77
|
|
|
75
|
-
|
|
78
|
+
<Accordion header="保守性">
|
|
76
79
|
|
|
77
|
-
|
|
80
|
+
アプリケーションのコンテンツのスコープを設定すると、大規模なアプリケーションの**メンテナンスが容易になります**。コンテンツコードベース全体を確認するという精神的な負担を負うことなく、単一の機能フォルダーを複製または削除できます。さらに、Intlayer は**完全に型指定**されており、コンテンツの正確性を保証します。
|
|
78
81
|
|
|
79
|
-
|
|
82
|
+
</Accordion>
|
|
80
83
|
|
|
81
|
-
|
|
84
|
+
<Accordion header="AI エージェント">
|
|
82
85
|
|
|
83
|
-
|
|
86
|
+
コンテンツを同じ場所に配置すると、大規模言語モデル (LLM) によって**必要なコンテキストが削減**されます。Intlayer には、翻訳の欠落をテストする **CLI**、**[LSP](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/lsp.md)**、**[MCP](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/mcp_server.md)**、および **[エージェントスキル](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/agent_skills.md)** などのツールスイートも付属しており、AI エージェントの開発者エクスペリエンス (DX) がさらにスムーズになります。
|
|
84
87
|
|
|
85
|
-
|
|
88
|
+
</Accordion>
|
|
86
89
|
|
|
87
|
-
|
|
90
|
+
<Accordion header="オートメーション">
|
|
88
91
|
|
|
89
|
-
|
|
92
|
+
AI プロバイダーの費用で、選択した LLM を使用して CI/CD パイプラインで自動化して翻訳します。Intlayer は、コンテンツ抽出を自動化する**コンパイラー**と、**バックグラウンドでの翻訳**を支援する [Web プラットフォーム](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_CMS.md) も提供します。
|
|
90
93
|
|
|
91
|
-
|
|
94
|
+
</Accordion>
|
|
92
95
|
|
|
93
|
-
<
|
|
96
|
+
<Accordion header="パフォーマンス">
|
|
94
97
|
|
|
95
|
-
|
|
98
|
+
大量の JSON ファイルをコンポーネントに接続すると、パフォーマンスと反応性の問題が発生する可能性があります。Intlayer は、ビルド時のコンテンツの読み込みを最適化します。
|
|
96
99
|
|
|
97
|
-
|
|
100
|
+
</Accordion>
|
|
98
101
|
|
|
99
|
-
|
|
102
|
+
<Accordion header="非開発者によるスケーリング">
|
|
100
103
|
|
|
101
|
-
|
|
102
|
-
npm install intlayer 反応-intlayer
|
|
103
|
-
npm install --save-dev 反応ネイティブ-intlayer
|
|
104
|
-
npx 内部層初期化
|
|
105
|
-
「」
|
|
104
|
+
Intlayer は単なる i18n ソリューションではなく、**自己ホスト型[ビジュアルエディター](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_visual_editor.md)** と **[完全な CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/intlayer_CMS.md)** を提供し、**リアルタイム**で多言語コンテンツを管理できるようになり、翻訳者、コピーライター、その他のチームメンバーとのコラボレーションがシームレスになります。コンテンツはローカルおよび/またはリモートに保存できます。
|
|
106
105
|
|
|
107
|
-
|
|
108
|
-
pnpm add intlayer 反応-intlayer
|
|
109
|
-
pnpm add --save-dev 反応ネイティブ-intlayer
|
|
110
|
-
pnpm 内部層初期化
|
|
111
|
-
「」
|
|
106
|
+
</Accordion>
|
|
112
107
|
|
|
113
|
-
|
|
114
|
-
糸 中間層を追加 反応内部層
|
|
115
|
-
糸追加 --save-dev 反応ネイティブ-内部層
|
|
116
|
-
糸の中間層の初期化
|
|
117
|
-
「」
|
|
108
|
+
<Accordion header="バンドルサイズ">
|
|
118
109
|
|
|
119
|
-
|
|
120
|
-
bun add intlayer 反応-intlayer
|
|
121
|
-
バン追加 --dev 反応ネイティブ-intlayer
|
|
122
|
-
bun x 内部層の初期化
|
|
123
|
-
「」
|
|
110
|
+
大量の JSON ファイルをページにロードするのではなく、必要なコンテンツのみをロードします。Intlayer は、**バンドルとビューのサイズを最大 50% 削減**するのに役立ちます。
|
|
124
111
|
|
|
125
|
-
|
|
112
|
+
</Accordion>
|
|
113
|
+
</AccordionGroup>
|
|
126
114
|
|
|
127
|
-
|
|
128
|
-
構成、辞書コンテンツ、タイプ生成、および CLI コマンド用のコア i18n ツールキット。
|
|
115
|
+
<Steps>
|
|
129
116
|
|
|
130
|
-
|
|
131
|
-
React Native でロケールの取得と切り替えに使用するコンテキスト プロバイダーと React フックを提供する React 統合。
|
|
117
|
+
<Step number={1} title="依存関係をインストールする">
|
|
132
118
|
|
|
133
|
-
-
|
|
134
|
-
Intlayer を React Native バンドラーと統合するための Metro プラグインを提供する React Native 統合。
|
|
119
|
+
GitHub の [アプリケーションテンプレート](https://github.com/aymericzip/intlayer-react-native-template) を参照してください。
|
|
135
120
|
|
|
136
|
-
|
|
121
|
+
React Native プロジェクトから、次のパッケージをインストールします:
|
|
137
122
|
|
|
138
|
-
|
|
123
|
+
```bash packageManager="npm"
|
|
124
|
+
npx intlayer-cli init --interactive
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
```bash packageManager="pnpm"
|
|
128
|
+
pnpm dlx intlayer-cli init --interactive
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
```bash packageManager="yarn"
|
|
132
|
+
yarn dlx intlayer-cli init --interactive
|
|
133
|
+
```
|
|
139
134
|
|
|
140
|
-
|
|
135
|
+
```bash packageManager="bun"
|
|
136
|
+
bunx intlayer-cli init --interactive
|
|
137
|
+
```
|
|
141
138
|
|
|
139
|
+
> `--interactive` フラグはオプションです。AI エージェントの場合は `intlayer-cli init` を使用してください。
|
|
142
140
|
|
|
143
|
-
|
|
141
|
+
> このコマンドは環境を検出し、必要なパッケージをインストールします。例えば:
|
|
144
142
|
|
|
145
143
|
```bash packageManager="npm"
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
npm install --save-dev react-native-intlayer
|
|
149
|
-
````
|
|
144
|
+
npm install intlayer react-native-intlayer
|
|
145
|
+
```
|
|
150
146
|
|
|
151
147
|
```bash packageManager="pnpm"
|
|
152
|
-
pnpm add intlayer react-intlayer
|
|
153
|
-
pnpm add --save-dev react-native-intlayer
|
|
154
|
-
pnpm intlayer init
|
|
148
|
+
pnpm add intlayer react-native-intlayer
|
|
155
149
|
```
|
|
156
150
|
|
|
157
151
|
```bash packageManager="yarn"
|
|
158
|
-
yarn add intlayer react-intlayer
|
|
159
|
-
|
|
152
|
+
yarn add intlayer react-native-intlayer
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
```bash packageManager="bun"
|
|
156
|
+
bun add intlayer react-native-intlayer
|
|
160
157
|
```
|
|
161
158
|
|
|
162
159
|
### パッケージ
|
|
163
160
|
|
|
164
161
|
- **intlayer**
|
|
165
|
-
設定、辞書コンテンツ、型生成、CLIコマンドのためのコアi18nツールキット。
|
|
166
|
-
|
|
167
|
-
- **react-intlayer**
|
|
168
|
-
React Nativeでロケールの取得や切り替えに使用するコンテキストプロバイダーとReactフックを提供するReact統合。
|
|
162
|
+
設定、辞書コンテンツ、型生成、CLI コマンドのためのコア i18n ツールキット。
|
|
169
163
|
|
|
170
164
|
- **react-native-intlayer**
|
|
171
|
-
IntlayerをReact Nativeバンドラーと統合するためのMetroプラグインを提供するReact Native
|
|
165
|
+
ロケールの取得や切り替えに使用するコンテキストプロバイダーと React フック、React Native ポリフィル、および Intlayer を React Native バンドラーと統合するための Metro プラグインを提供する React Native 統合。`react-intlayer` からすべてを再エクスポートするため、React Native アプリではこの単一パッケージのみが必要です。
|
|
172
166
|
|
|
173
167
|
---
|
|
174
168
|
|
|
175
169
|
</Step>
|
|
176
170
|
|
|
177
|
-
<Step number={
|
|
171
|
+
<Step number={2} title="Intlayer設定ファイルの作成">
|
|
178
172
|
|
|
179
|
-
|
|
173
|
+
プロジェクトのルート(または任意の便利な場所)に **Intlayer 設定ファイル**を作成します。以下のような内容になるかもしれません:
|
|
180
174
|
|
|
181
175
|
```ts fileName="intlayer.config.ts" codeFormat={["typescript", "esm", "commonjs"]}
|
|
182
176
|
/**
|
|
@@ -204,13 +198,13 @@ export default config;
|
|
|
204
198
|
- **サポートするロケールのリスト**を設定する。
|
|
205
199
|
- **デフォルト**のロケールを設定する。
|
|
206
200
|
- 後で、より高度なオプション(例:ログ、カスタムコンテンツディレクトリなど)を追加することも可能です。
|
|
207
|
-
- 詳細は[Intlayerの設定ドキュメント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/configuration.md)を参照してください。
|
|
201
|
+
- 詳細は [Intlayer の設定ドキュメント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/configuration.md) を参照してください。
|
|
208
202
|
|
|
209
203
|
</Step>
|
|
210
204
|
|
|
211
|
-
<Step number={
|
|
205
|
+
<Step number={3} title="Metro プラグインを追加する">
|
|
212
206
|
|
|
213
|
-
MetroはReact Native用のバンドラーです。`react-native init
|
|
207
|
+
Metro は React Native 用のバンドラーです。`react-native init` コマンドで作成された React Native プロジェクトのデフォルトバンドラーです。Intlayer を Metro で使用するには、`metro.config.js` ファイルにプラグインを追加する必要があります。
|
|
214
208
|
|
|
215
209
|
```js fileName="metro.config.js"
|
|
216
210
|
const { getDefaultConfig } = require("expo/metro-config");
|
|
@@ -223,34 +217,25 @@ module.exports = (async () => {
|
|
|
223
217
|
})();
|
|
224
218
|
```
|
|
225
219
|
|
|
220
|
+
> 注:`configMetroIntlayer` は Promise 関数です。同期的に使用したい場合は `configMetroIntlayerSync` を使用するか、IFFE(即時実行関数式)を避けてください。
|
|
221
|
+
> 注:`configMetroIntlayerSync` はサーバー起動時に intlayer 辞書をビルドすることができません
|
|
222
|
+
|
|
226
223
|
</Step>
|
|
227
224
|
|
|
228
|
-
<Step number={
|
|
225
|
+
<Step number={4} title="Intlayer プロバイダーを追加する">
|
|
229
226
|
|
|
230
|
-
アプリケーション全体でユーザーの言語を同期させるには、ルートコンポーネントを `react-intlayer
|
|
227
|
+
アプリケーション全体でユーザーの言語を同期させるには、ルートコンポーネントを `react-native-intlayer` の `IntlayerProvider` コンポーネントでラップする必要があります。
|
|
231
228
|
|
|
232
|
-
>
|
|
233
|
-
|
|
234
|
-
```tsx fileName="app/_layout.tsx" codeFormat={["typescript", "esm"]}
|
|
235
|
-
import { Stack } from "expo-router";
|
|
236
|
-
import { getLocales } from "expo-localization";
|
|
237
|
-
import { IntlayerProvider } from "react-native-intlayer";
|
|
238
|
-
import { type FC } from "react";
|
|
229
|
+
> 常に `react-native-intlayer` からインポートしてください。その `IntlayerProvider` には Intlayer が使用する Web API のポリフィルが含まれており、このパッケージは `react-intlayer` からすべてのフックとユーティリティを再エクスポートします。
|
|
239
230
|
|
|
231
|
+
また、Intlayer が正しく動作するように、`index.js` ファイルに `intlayerPolyfill` 関数を追加する必要があります。
|
|
240
232
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
const RootLayout: FC = () => {
|
|
244
|
-
return (
|
|
245
|
-
<IntlayerProvider defaultLocale={getDeviceLocale()}>
|
|
246
|
-
<Stack>
|
|
247
|
-
tsx fileName="app/_layout.tsx" codeFormat="typescript"
|
|
233
|
+
```tsx fileName="app/_layout.tsx" codeFormat={["typescript", "esm"]}
|
|
248
234
|
import { Stack } from "expo-router";
|
|
249
235
|
import { getLocales } from "expo-localization";
|
|
250
236
|
import { IntlayerProvider } from "react-native-intlayer";
|
|
251
237
|
import { type FC } from "react";
|
|
252
238
|
|
|
253
|
-
|
|
254
239
|
const getDeviceLocale = () => getLocales()[0]?.languageTag;
|
|
255
240
|
|
|
256
241
|
const RootLayout: FC = () => {
|
|
@@ -268,31 +253,7 @@ export default RootLayout;
|
|
|
268
253
|
|
|
269
254
|
</Step>
|
|
270
255
|
|
|
271
|
-
<Step number={
|
|
272
|
-
|
|
273
|
-
```jsx fileName="app/_layout.cjx" codeFormat="commonjs"
|
|
274
|
-
const { Stack } = require("expo-router");
|
|
275
|
-
const { getLocales } = require("expo-localization");
|
|
276
|
-
const { IntlayerProvider } = require("react-native-intlayer");
|
|
277
|
-
|
|
278
|
-
const getDeviceLocale = () => getLocales()[0]?.languageTag;
|
|
279
|
-
|
|
280
|
-
const RootLayout = () => {
|
|
281
|
-
return (
|
|
282
|
-
<IntlayerProvider defaultLocale={getDeviceLocale()}>
|
|
283
|
-
<Stack>
|
|
284
|
-
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
285
|
-
</Stack>
|
|
286
|
-
</IntlayerProvider>
|
|
287
|
-
);
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
module.exports = RootLayout;
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
</Step>
|
|
294
|
-
|
|
295
|
-
<Step number={7} title="コンテンツを宣言する">
|
|
256
|
+
<Step number={5} title="コンテンツを宣言する">
|
|
296
257
|
|
|
297
258
|
プロジェクト内の任意の場所(一般的には `src/` 内)に**コンテンツ宣言**ファイルを作成します。Intlayer がサポートする任意の拡張子形式を使用できます:
|
|
298
259
|
|
|
@@ -357,21 +318,21 @@ export default homeScreenContent;
|
|
|
357
318
|
}
|
|
358
319
|
```
|
|
359
320
|
|
|
360
|
-
> コンテンツ宣言の詳細については、[Intlayerのコンテンツドキュメント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/dictionary/content_file.md)を参照してください。
|
|
321
|
+
> コンテンツ宣言の詳細については、[Intlayer のコンテンツドキュメント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/dictionary/content_file.md) を参照してください。
|
|
361
322
|
|
|
362
323
|
---
|
|
363
324
|
|
|
364
325
|
</Step>
|
|
365
326
|
|
|
366
|
-
<Step number={
|
|
327
|
+
<Step number={6} title="コンポーネントで Intlayer を使用する">
|
|
367
328
|
|
|
368
|
-
|
|
329
|
+
子コンポーネントで `useIntlayer` フックを使用して、ローカライズされたコンテンツを取得します。
|
|
369
330
|
|
|
370
331
|
### 例
|
|
371
332
|
|
|
372
333
|
```tsx fileName="app/(tabs)/index.tsx" codeFormat={["typescript", "esm"]}
|
|
373
334
|
import { Image, StyleSheet, Platform } from "react-native";
|
|
374
|
-
import { useIntlayer } from "intlayer";
|
|
335
|
+
import { useIntlayer } from "react-native-intlayer";
|
|
375
336
|
import { HelloWave } from "@/components/HelloWave";
|
|
376
337
|
import ParallaxScrollView from "@/components/ParallaxScrollView";
|
|
377
338
|
import { ThemedText } from "@/components/ThemedText";
|
|
@@ -418,7 +379,7 @@ export default HomeScreen;
|
|
|
418
379
|
|
|
419
380
|
</Step>
|
|
420
381
|
|
|
421
|
-
<Step number={
|
|
382
|
+
<Step number={7} title="アプリのロケールを変更する" isOptional={true}>
|
|
422
383
|
|
|
423
384
|
コンポーネント内からロケールを切り替えるには、`useLocale` フックの `setLocale` メソッドを使用できます。
|
|
424
385
|
|
|
@@ -426,7 +387,7 @@ export default HomeScreen;
|
|
|
426
387
|
import { type FC } from "react";
|
|
427
388
|
import { View, Text, TouchableOpacity, StyleSheet } from "react-native";
|
|
428
389
|
import { getLocaleName } from "intlayer";
|
|
429
|
-
import { useLocale } from "react-intlayer";
|
|
390
|
+
import { useLocale } from "react-native-intlayer";
|
|
430
391
|
|
|
431
392
|
export const LocaleSwitcher: FC = () => {
|
|
432
393
|
const { setLocale, availableLocales } = useLocale();
|
|
@@ -467,22 +428,22 @@ const styles = StyleSheet.create({
|
|
|
467
428
|
});
|
|
468
429
|
```
|
|
469
430
|
|
|
470
|
-
これにより、Intlayerのコンテンツを使用しているすべてのコンポーネントが再レンダリングされ、新しいロケールの翻訳が表示されます。
|
|
431
|
+
これにより、Intlayer のコンテンツを使用しているすべてのコンポーネントが再レンダリングされ、新しいロケールの翻訳が表示されます。
|
|
471
432
|
|
|
472
|
-
> 詳細は[`useLocale
|
|
433
|
+
> 詳細は [`useLocale` のドキュメント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/packages/react-intlayer/useLocale.md) をご覧ください。
|
|
473
434
|
|
|
474
435
|
</Step>
|
|
475
436
|
|
|
476
437
|
</Steps>
|
|
477
438
|
|
|
478
|
-
## TypeScriptの設定(TypeScriptを使用している場合)
|
|
439
|
+
## TypeScript の設定(TypeScript を使用している場合)
|
|
479
440
|
|
|
480
|
-
Intlayerは、補完機能を向上させ、翻訳エラーを検出するために、隠しフォルダ(デフォルトは `.intlayer`)に型定義を生成します:
|
|
441
|
+
Intlayer は、補完機能を向上させ、翻訳エラーを検出するために、隠しフォルダ(デフォルトは `.intlayer`)に型定義を生成します:
|
|
481
442
|
|
|
482
443
|
```json5
|
|
483
444
|
// tsconfig.json
|
|
484
445
|
{
|
|
485
|
-
// ... 既存のTS設定
|
|
446
|
+
// ... 既存の TS 設定
|
|
486
447
|
"include": [
|
|
487
448
|
"src", // ソースコード
|
|
488
449
|
".intlayer/types/**/*.ts", // <-- 自動生成された型定義を含める
|
|
@@ -498,22 +459,22 @@ Intlayerは、補完機能を向上させ、翻訳エラーを検出するため
|
|
|
498
459
|
|
|
499
460
|
---
|
|
500
461
|
|
|
501
|
-
## Git設定
|
|
462
|
+
## Git 設定
|
|
502
463
|
|
|
503
|
-
Intlayerによって自動生成されたファイルをコミットしないように、`.gitignore
|
|
464
|
+
Intlayer によって自動生成されたファイルをコミットしないように、`.gitignore` に以下を追加してください:
|
|
504
465
|
|
|
505
466
|
```bash
|
|
506
|
-
#
|
|
467
|
+
# Intlayer によって生成されたファイルを無視
|
|
507
468
|
.intlayer
|
|
508
469
|
```
|
|
509
470
|
|
|
510
471
|
---
|
|
511
472
|
|
|
512
|
-
### VS Code拡張機能
|
|
473
|
+
### VS Code 拡張機能
|
|
513
474
|
|
|
514
|
-
Intlayer
|
|
475
|
+
Intlayer の開発体験を向上させるために、公式の **Intlayer VS Code 拡張機能**をインストールできます。
|
|
515
476
|
|
|
516
|
-
[VS Codeマーケットプレイスからインストール](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
477
|
+
[VS Code マーケットプレイスからインストール](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
517
478
|
|
|
518
479
|
この拡張機能は以下を提供します:
|
|
519
480
|
|
|
@@ -522,17 +483,17 @@ Intlayerの開発体験を向上させるために、公式の**Intlayer VS Code
|
|
|
522
483
|
- 翻訳内容の**インラインプレビュー**。
|
|
523
484
|
- 翻訳の作成や更新を簡単に行うための**クイックアクション**。
|
|
524
485
|
|
|
525
|
-
拡張機能の使い方の詳細については、[Intlayer VS Code拡張機能のドキュメント](https://intlayer.org/doc/vs-code-extension)を参照してください。
|
|
486
|
+
拡張機能の使い方の詳細については、[Intlayer VS Code 拡張機能のドキュメント](https://intlayer.org/doc/vs-code-extension) を参照してください。
|
|
526
487
|
|
|
527
488
|
---
|
|
528
489
|
|
|
529
490
|
## さらに進む
|
|
530
491
|
|
|
531
|
-
- **ビジュアルエディター**:翻訳を視覚的に管理するために、[Intlayerビジュアルエディター](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_visual_editor.md)を使用してください。
|
|
532
|
-
- **CMS統合**: 辞書コンテンツを外部化し、[CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_CMS.md)から取得することも可能です。
|
|
533
|
-
- **CLIコマンド**: 翻訳の**抽出**や**欠落キーの確認**などのタスクには、[Intlayer CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/cli/index.md)を活用してください。
|
|
492
|
+
- **ビジュアルエディター**:翻訳を視覚的に管理するために、[Intlayer ビジュアルエディター](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_visual_editor.md) を使用してください。
|
|
493
|
+
- **CMS 統合**: 辞書コンテンツを外部化し、[CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_CMS.md) から取得することも可能です。
|
|
494
|
+
- **CLI コマンド**: 翻訳の**抽出**や**欠落キーの確認**などのタスクには、[Intlayer CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/cli/index.md) を活用してください。
|
|
534
495
|
|
|
535
|
-
**Intlayer
|
|
496
|
+
**Intlayer** を通じて、完全な i18n 機能を備えた **React Native** アプリの開発をお楽しみください!
|
|
536
497
|
|
|
537
498
|
---
|
|
538
499
|
|
|
@@ -544,7 +505,7 @@ Intlayer は主に Web Intl API を対象としており、React Native では
|
|
|
544
505
|
|
|
545
506
|
チェックリスト:
|
|
546
507
|
|
|
547
|
-
- `intlayer
|
|
508
|
+
- `intlayer` および `react-native-intlayer` の最新バージョンを使用してください。
|
|
548
509
|
- Intlayer polyfill を有効にしてください。
|
|
549
510
|
- `getLocaleName` または他の Intl-API ベースのユーティリティを使用する場合は、これらの polyfill を早期にインポートしてください(たとえば `index.js` または `App.tsx` で):
|
|
550
511
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2026-01-21
|
|
3
|
-
updatedAt: 2026-
|
|
3
|
+
updatedAt: 2026-06-25
|
|
4
4
|
title: react-native-intlayer パッケージのドキュメント
|
|
5
|
-
description: Intlayer のための React Native
|
|
5
|
+
description: Intlayer のための React Native サポート。プロバイダー、フック、ポリフィル、Metro 設定を提供します。
|
|
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: "react-intlayer の完全な API(フック、ユーティリティ、format/html/markdown サブパス)を再エクスポートし、React Native アプリが react-native-intlayer のみに依存できるようにした"
|
|
17
20
|
- version: 8.0.0
|
|
18
21
|
date: 2026-01-21
|
|
19
22
|
changes: "すべてのエクスポートに関するドキュメントを統一"
|
|
@@ -22,7 +25,9 @@ author: aymericzip
|
|
|
22
25
|
|
|
23
26
|
# react-native-intlayer パッケージ
|
|
24
27
|
|
|
25
|
-
`react-native-intlayer` パッケージは、Intlayer を React Native
|
|
28
|
+
`react-native-intlayer` パッケージは、Intlayer を React Native アプリケーションに統合するために必要なツールを提供します。React Native 対応の `IntlayerProvider` を備えた `react-intlayer` の完全な API(フックとユーティリティ)を再エクスポートし、React Native に必要なポリフィルと Metro 設定も含みます。
|
|
29
|
+
|
|
30
|
+
> React Native アプリでは、`react-native-intlayer` から**すべて**をインポートしてください。`react-intlayer` を直接インストールまたはインポートする必要はありません。
|
|
26
31
|
|
|
27
32
|
## インストール
|
|
28
33
|
|
|
@@ -34,14 +39,30 @@ npm install react-native-intlayer
|
|
|
34
39
|
|
|
35
40
|
### プロバイダー
|
|
36
41
|
|
|
37
|
-
| コンポーネント | 説明
|
|
38
|
-
| ------------------ |
|
|
39
|
-
| `IntlayerProvider` | アプリケーションをラップし、Intlayer
|
|
42
|
+
| コンポーネント | 説明 |
|
|
43
|
+
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
44
|
+
| `IntlayerProvider` | アプリケーションをラップし、Intlayer コンテキストを提供するプロバイダーコンポーネント。必要なポリフィルを自動的に適用します。 |
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import { IntlayerProvider } from "react-native-intlayer";
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### フックとユーティリティ
|
|
51
|
+
|
|
52
|
+
これらは `react-intlayer` から再エクスポートされているため、`react-native-intlayer` から直接インポートできます:
|
|
40
53
|
|
|
41
|
-
|
|
54
|
+
| エクスポート | 説明 |
|
|
55
|
+
| ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
56
|
+
| `useIntlayer` | 辞書キーのローカライズされたコンテンツにアクセス。 |
|
|
57
|
+
| `useLocale` | 現在のロケールを読み取り、変更する。 |
|
|
58
|
+
| `useDictionary`, `useDictionaryAsync`, `useDictionaryDynamic`, `useLoadDynamic` | さまざまな方法で辞書コンテンツを読み込む。 |
|
|
59
|
+
| `useI18n` | i18next 互換フック。 |
|
|
60
|
+
| `t` | インライン翻訳ヘルパー。 |
|
|
61
|
+
| `getIntlayer`, `getDictionary` | 命令型コンテンツゲッター。 |
|
|
62
|
+
| `localeCookie`, `localeInStorage`, `setLocaleCookie`, `setLocaleInStorage`, `useLocaleCookie`, `useLocaleStorage` | ロケール永続化ヘルパー。 |
|
|
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
|
### ポリフィル
|
|
@@ -50,10 +71,25 @@ import "react-native-intlayer";
|
|
|
50
71
|
| ------------------ | ----------------------------------------------------------------------------- |
|
|
51
72
|
| `intlayerPolyfill` | React Native が Intlayer をサポートするために必要なポリフィルを適用する関数。 |
|
|
52
73
|
|
|
53
|
-
|
|
74
|
+
```tsx
|
|
75
|
+
import { intlayerPolyfill } from "react-native-intlayer";
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
> ポリフィルは `IntlayerProvider` をインポートすると自動的に適用されます。プロバイダーがマウントされる前にポリフィルが必要な場合のみ、`intlayerPolyfill` を手動で呼び出してください。
|
|
79
|
+
|
|
80
|
+
### フォーマッター
|
|
81
|
+
|
|
82
|
+
数値、日付、その他の Intl ベースのフォーマットフックは `/format` サブパスから利用できます:
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
import { useNumber, useDate } from "react-native-intlayer/format";
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Markdown と HTML のレンダリング
|
|
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 の設定
|
|
@@ -66,9 +102,6 @@ import "react-native-intlayer";
|
|
|
66
102
|
| `configMetroIntlayerSync` | Intlayer のリソースを準備せずに Metro 設定をマージする同期関数。 |
|
|
67
103
|
| `exclusionList` | バンドルからコンテンツファイルを除外するために、Metro の blockList 用の RegExp パターンを作成します。 |
|
|
68
104
|
|
|
69
|
-
インポート:
|
|
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
|
```
|