@intlayer/docs 6.1.5 → 6.1.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/blog/ar/next-i18next_vs_next-intl_vs_intlayer.md +404 -173
- package/blog/de/next-i18next_vs_next-intl_vs_intlayer.md +262 -113
- package/blog/en/intlayer_with_next-i18next.mdx +431 -0
- package/blog/en/intlayer_with_next-intl.mdx +335 -0
- package/blog/en/next-i18next_vs_next-intl_vs_intlayer.md +463 -209
- package/blog/en-GB/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/es/next-i18next_vs_next-intl_vs_intlayer.md +185 -71
- package/blog/fr/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/it/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/ja/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/ko/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/pt/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/blog/ru/next-i18next_vs_next-intl_vs_intlayer.md +36 -28
- package/blog/tr/next-i18next_vs_next-intl_vs_intlayer.md +2 -0
- package/blog/zh/next-i18next_vs_next-intl_vs_intlayer.md +38 -28
- package/dist/cjs/generated/docs.entry.cjs +32 -0
- package/dist/cjs/generated/docs.entry.cjs.map +1 -1
- package/dist/esm/generated/docs.entry.mjs +32 -0
- package/dist/esm/generated/docs.entry.mjs.map +1 -1
- package/dist/types/generated/docs.entry.d.ts +2 -0
- package/dist/types/generated/docs.entry.d.ts.map +1 -1
- package/docs/ar/component_i18n.md +186 -0
- package/docs/ar/intlayer_with_angular.md +2 -2
- package/docs/ar/intlayer_with_astro.md +246 -0
- package/docs/ar/intlayer_with_create_react_app.md +3 -2
- package/docs/ar/intlayer_with_express.md +2 -2
- package/docs/ar/intlayer_with_nestjs.md +2 -2
- package/docs/ar/intlayer_with_nextjs_14.md +2 -2
- package/docs/ar/intlayer_with_nextjs_15.md +2 -2
- package/docs/ar/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ar/intlayer_with_nuxt.md +2 -2
- package/docs/ar/intlayer_with_react_native+expo.md +11 -20
- package/docs/ar/intlayer_with_react_router_v7.md +195 -241
- package/docs/ar/intlayer_with_tanstack.md +198 -272
- package/docs/ar/intlayer_with_vite+preact.md +9 -9
- package/docs/ar/intlayer_with_vite+react.md +7 -7
- package/docs/ar/intlayer_with_vite+vue.md +9 -9
- package/docs/ar/vs_code_extension.md +48 -109
- package/docs/de/component_i18n.md +186 -0
- package/docs/de/intlayer_with_angular.md +2 -2
- package/docs/de/intlayer_with_astro.md +246 -0
- package/docs/de/intlayer_with_create_react_app.md +2 -2
- package/docs/de/intlayer_with_express.md +2 -2
- package/docs/de/intlayer_with_nestjs.md +2 -2
- package/docs/de/intlayer_with_nextjs_14.md +2 -2
- package/docs/de/intlayer_with_nextjs_15.md +2 -2
- package/docs/de/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/de/intlayer_with_nuxt.md +2 -2
- package/docs/de/intlayer_with_react_native+expo.md +11 -20
- package/docs/de/intlayer_with_react_router_v7.md +193 -242
- package/docs/de/intlayer_with_tanstack.md +194 -266
- package/docs/de/intlayer_with_vite+preact.md +9 -9
- package/docs/de/intlayer_with_vite+react.md +9 -9
- package/docs/de/intlayer_with_vite+vue.md +11 -11
- package/docs/de/packages/vite-intlayer/index.md +3 -3
- package/docs/de/vs_code_extension.md +46 -107
- package/docs/en/component_i18n.md +186 -0
- package/docs/en/how_works_intlayer.md +1 -1
- package/docs/en/index.md +1 -1
- package/docs/en/intlayer_cli.md +1 -1
- package/docs/en/intlayer_with_angular.md +4 -4
- package/docs/en/intlayer_with_astro.md +246 -0
- package/docs/en/intlayer_with_create_react_app.md +4 -4
- package/docs/en/intlayer_with_express.md +3 -3
- package/docs/en/intlayer_with_lynx+react.md +1 -1
- package/docs/en/intlayer_with_nestjs.md +2 -2
- package/docs/en/intlayer_with_nextjs_14.md +31 -5
- package/docs/en/intlayer_with_nextjs_15.md +31 -5
- package/docs/en/intlayer_with_nextjs_page_router.md +5 -5
- package/docs/en/intlayer_with_nuxt.md +4 -4
- package/docs/en/intlayer_with_react_native+expo.md +46 -24
- package/docs/en/intlayer_with_react_router_v7.md +164 -211
- package/docs/en/intlayer_with_tanstack.md +166 -241
- package/docs/en/intlayer_with_vite+preact.md +12 -12
- package/docs/en/intlayer_with_vite+react.md +12 -12
- package/docs/en/intlayer_with_vite+solid.md +2 -2
- package/docs/en/intlayer_with_vite+svelte.md +2 -2
- package/docs/en/intlayer_with_vite+vue.md +12 -12
- package/docs/en/introduction.md +1 -1
- package/docs/en/packages/next-intlayer/useDictionary.md +1 -1
- package/docs/en/packages/next-intlayer/useIntlayer.md +1 -1
- package/docs/en/packages/react-intlayer/useDictionary.md +1 -1
- package/docs/en/packages/react-intlayer/useI18n.md +1 -1
- package/docs/en/packages/react-intlayer/useIntlayer.md +1 -1
- package/docs/en/releases/v6.md +1 -0
- package/docs/en/roadmap.md +1 -1
- package/docs/en/vs_code_extension.md +24 -114
- package/docs/en-GB/component_i18n.md +186 -0
- package/docs/en-GB/intlayer_with_angular.md +3 -3
- package/docs/en-GB/intlayer_with_astro.md +246 -0
- package/docs/en-GB/intlayer_with_create_react_app.md +5 -4
- package/docs/en-GB/intlayer_with_express.md +2 -2
- package/docs/en-GB/intlayer_with_nestjs.md +2 -2
- package/docs/en-GB/intlayer_with_nextjs_14.md +4 -4
- package/docs/en-GB/intlayer_with_nextjs_15.md +2 -2
- package/docs/en-GB/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/en-GB/intlayer_with_nuxt.md +2 -2
- package/docs/en-GB/intlayer_with_react_native+expo.md +11 -20
- package/docs/en-GB/intlayer_with_react_router_v7.md +171 -220
- package/docs/en-GB/intlayer_with_tanstack.md +174 -248
- package/docs/en-GB/intlayer_with_vite+preact.md +9 -9
- package/docs/en-GB/intlayer_with_vite+react.md +9 -9
- package/docs/en-GB/intlayer_with_vite+vue.md +11 -11
- package/docs/en-GB/packages/next-intlayer/useIntlayer.md +1 -1
- package/docs/en-GB/packages/react-intlayer/useIntlayer.md +1 -1
- package/docs/en-GB/vs_code_extension.md +42 -103
- package/docs/es/component_i18n.md +182 -0
- package/docs/es/intlayer_with_angular.md +2 -2
- package/docs/es/intlayer_with_astro.md +246 -0
- package/docs/es/intlayer_with_create_react_app.md +3 -2
- package/docs/es/intlayer_with_express.md +2 -2
- package/docs/es/intlayer_with_nextjs_14.md +2 -2
- package/docs/es/intlayer_with_nextjs_15.md +2 -2
- package/docs/es/intlayer_with_react_native+expo.md +11 -20
- package/docs/es/intlayer_with_react_router_v7.md +188 -232
- package/docs/es/intlayer_with_tanstack.md +203 -273
- package/docs/es/intlayer_with_vite+preact.md +7 -7
- package/docs/es/intlayer_with_vite+react.md +7 -7
- package/docs/es/intlayer_with_vite+vue.md +9 -9
- package/docs/es/vs_code_extension.md +53 -114
- package/docs/fr/component_i18n.md +186 -0
- package/docs/fr/intlayer_with_angular.md +2 -2
- package/docs/fr/intlayer_with_astro.md +246 -0
- package/docs/fr/intlayer_with_create_react_app.md +3 -2
- package/docs/fr/intlayer_with_express.md +2 -2
- package/docs/fr/intlayer_with_nestjs.md +2 -2
- package/docs/fr/intlayer_with_nextjs_14.md +2 -2
- package/docs/fr/intlayer_with_react_native+expo.md +11 -20
- package/docs/fr/intlayer_with_react_router_v7.md +188 -248
- package/docs/fr/intlayer_with_tanstack.md +192 -265
- package/docs/fr/intlayer_with_vite+preact.md +7 -7
- package/docs/fr/intlayer_with_vite+react.md +7 -7
- package/docs/fr/intlayer_with_vite+vue.md +9 -9
- package/docs/fr/vs_code_extension.md +50 -111
- package/docs/hi/component_i18n.md +186 -0
- package/docs/hi/intlayer_cli.md +1 -4
- package/docs/hi/intlayer_with_angular.md +2 -2
- package/docs/hi/intlayer_with_astro.md +246 -0
- package/docs/hi/intlayer_with_create_react_app.md +2 -2
- package/docs/hi/intlayer_with_express.md +2 -2
- package/docs/hi/intlayer_with_nestjs.md +2 -2
- package/docs/hi/intlayer_with_nextjs_14.md +2 -2
- package/docs/hi/intlayer_with_nextjs_15.md +2 -2
- package/docs/hi/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/hi/intlayer_with_nuxt.md +2 -2
- package/docs/hi/intlayer_with_react_native+expo.md +11 -20
- package/docs/hi/intlayer_with_react_router_v7.md +199 -243
- package/docs/hi/intlayer_with_tanstack.md +210 -285
- package/docs/hi/intlayer_with_vite+preact.md +9 -9
- package/docs/hi/intlayer_with_vite+react.md +9 -9
- package/docs/hi/intlayer_with_vite+solid.md +1 -1
- package/docs/hi/intlayer_with_vite+vue.md +11 -11
- package/docs/hi/vs_code_extension.md +49 -110
- package/docs/it/component_i18n.md +186 -0
- package/docs/it/intlayer_with_angular.md +2 -2
- package/docs/it/intlayer_with_astro.md +246 -0
- package/docs/it/intlayer_with_create_react_app.md +3 -2
- package/docs/it/intlayer_with_express.md +2 -2
- package/docs/it/intlayer_with_nestjs.md +2 -2
- package/docs/it/intlayer_with_nextjs_14.md +2 -2
- package/docs/it/intlayer_with_nextjs_15.md +2 -2
- package/docs/it/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/it/intlayer_with_nuxt.md +2 -2
- package/docs/it/intlayer_with_react_native+expo.md +11 -21
- package/docs/it/intlayer_with_react_router_v7.md +195 -242
- package/docs/it/intlayer_with_tanstack.md +203 -267
- package/docs/it/intlayer_with_vite+preact.md +9 -9
- package/docs/it/intlayer_with_vite+react.md +13 -11
- package/docs/it/intlayer_with_vite+vue.md +11 -11
- package/docs/it/vs_code_extension.md +50 -111
- package/docs/ja/component_i18n.md +186 -0
- package/docs/ja/intlayer_with_angular.md +2 -2
- package/docs/ja/intlayer_with_astro.md +246 -0
- package/docs/ja/intlayer_with_create_react_app.md +3 -2
- package/docs/ja/intlayer_with_express.md +2 -2
- package/docs/ja/intlayer_with_nestjs.md +2 -2
- package/docs/ja/intlayer_with_nextjs_14.md +2 -2
- package/docs/ja/intlayer_with_nextjs_15.md +2 -2
- package/docs/ja/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ja/intlayer_with_nuxt.md +2 -2
- package/docs/ja/intlayer_with_react_native+expo.md +18 -29
- package/docs/ja/intlayer_with_react_router_v7.md +204 -250
- package/docs/ja/intlayer_with_tanstack.md +218 -286
- package/docs/ja/intlayer_with_vite+preact.md +9 -9
- package/docs/ja/intlayer_with_vite+react.md +11 -11
- package/docs/ja/intlayer_with_vite+vue.md +11 -11
- package/docs/ja/vs_code_extension.md +50 -111
- package/docs/ko/component_i18n.md +186 -0
- package/docs/ko/intlayer_with_angular.md +2 -2
- package/docs/ko/intlayer_with_astro.md +246 -0
- package/docs/ko/intlayer_with_create_react_app.md +3 -2
- package/docs/ko/intlayer_with_express.md +2 -2
- package/docs/ko/intlayer_with_nestjs.md +2 -2
- package/docs/ko/intlayer_with_nextjs_14.md +2 -2
- package/docs/ko/intlayer_with_nextjs_15.md +2 -2
- package/docs/ko/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ko/intlayer_with_nuxt.md +2 -2
- package/docs/ko/intlayer_with_react_native+expo.md +19 -28
- package/docs/ko/intlayer_with_react_router_v7.md +190 -244
- package/docs/ko/intlayer_with_tanstack.md +200 -270
- package/docs/ko/intlayer_with_vite+preact.md +9 -9
- package/docs/ko/intlayer_with_vite+react.md +9 -9
- package/docs/ko/intlayer_with_vite+vue.md +11 -11
- package/docs/ko/vs_code_extension.md +48 -109
- package/docs/pt/component_i18n.md +186 -0
- package/docs/pt/intlayer_with_angular.md +2 -2
- package/docs/pt/intlayer_with_astro.md +246 -0
- package/docs/pt/intlayer_with_create_react_app.md +3 -2
- package/docs/pt/intlayer_with_express.md +2 -2
- package/docs/pt/intlayer_with_nestjs.md +2 -2
- package/docs/pt/intlayer_with_nextjs_14.md +2 -2
- package/docs/pt/intlayer_with_nextjs_15.md +2 -2
- package/docs/pt/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/pt/intlayer_with_nuxt.md +2 -2
- package/docs/pt/intlayer_with_react_native+expo.md +11 -20
- package/docs/pt/intlayer_with_react_router_v7.md +7 -13
- package/docs/pt/intlayer_with_tanstack.md +183 -258
- package/docs/pt/intlayer_with_vite+preact.md +9 -9
- package/docs/pt/intlayer_with_vite+react.md +9 -9
- package/docs/pt/intlayer_with_vite+vue.md +9 -9
- package/docs/pt/vs_code_extension.md +46 -107
- package/docs/ru/component_i18n.md +186 -0
- package/docs/ru/intlayer_with_angular.md +2 -2
- package/docs/ru/intlayer_with_astro.md +246 -0
- package/docs/ru/intlayer_with_create_react_app.md +3 -2
- package/docs/ru/intlayer_with_express.md +2 -2
- package/docs/ru/intlayer_with_nestjs.md +2 -2
- package/docs/ru/intlayer_with_nextjs_14.md +2 -2
- package/docs/ru/intlayer_with_nextjs_15.md +2 -2
- package/docs/ru/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/ru/intlayer_with_nuxt.md +2 -2
- package/docs/ru/intlayer_with_react_native+expo.md +11 -20
- package/docs/ru/intlayer_with_react_router_v7.md +192 -238
- package/docs/ru/intlayer_with_tanstack.md +197 -269
- package/docs/ru/intlayer_with_vite+preact.md +9 -9
- package/docs/ru/intlayer_with_vite+react.md +9 -9
- package/docs/ru/intlayer_with_vite+vue.md +11 -11
- package/docs/ru/vs_code_extension.md +48 -109
- package/docs/tr/component_i18n.md +186 -0
- package/docs/tr/how_works_intlayer.md +1 -1
- package/docs/tr/index.md +1 -1
- package/docs/tr/intlayer_cli.md +1 -1
- package/docs/tr/intlayer_with_angular.md +4 -4
- package/docs/tr/intlayer_with_astro.md +246 -0
- package/docs/tr/intlayer_with_create_react_app.md +4 -4
- package/docs/tr/intlayer_with_express.md +3 -3
- package/docs/tr/intlayer_with_lynx+react.md +1 -1
- package/docs/tr/intlayer_with_nestjs.md +2 -2
- package/docs/tr/intlayer_with_nextjs_14.md +2 -2
- package/docs/tr/intlayer_with_nextjs_15.md +4 -4
- package/docs/tr/intlayer_with_nextjs_page_router.md +5 -5
- package/docs/tr/intlayer_with_nuxt.md +4 -4
- package/docs/tr/intlayer_with_react_native+expo.md +12 -21
- package/docs/tr/intlayer_with_react_router_v7.md +222 -267
- package/docs/tr/intlayer_with_tanstack.md +400 -303
- package/docs/tr/intlayer_with_vite+preact.md +12 -12
- package/docs/tr/intlayer_with_vite+react.md +12 -12
- package/docs/tr/intlayer_with_vite+solid.md +2 -2
- package/docs/tr/intlayer_with_vite+svelte.md +2 -2
- package/docs/tr/intlayer_with_vite+vue.md +12 -12
- package/docs/tr/introduction.md +1 -1
- package/docs/tr/packages/react-intlayer/useDictionary.md +1 -1
- package/docs/tr/packages/react-intlayer/useI18n.md +1 -1
- package/docs/tr/roadmap.md +1 -1
- package/docs/tr/vs_code_extension.md +54 -115
- package/docs/zh/component_i18n.md +186 -0
- package/docs/zh/intlayer_with_angular.md +2 -2
- package/docs/zh/intlayer_with_astro.md +246 -0
- package/docs/zh/intlayer_with_create_react_app.md +3 -2
- package/docs/zh/intlayer_with_express.md +2 -2
- package/docs/zh/intlayer_with_nestjs.md +2 -2
- package/docs/zh/intlayer_with_nextjs_14.md +2 -2
- package/docs/zh/intlayer_with_nextjs_15.md +2 -2
- package/docs/zh/intlayer_with_nextjs_page_router.md +2 -2
- package/docs/zh/intlayer_with_nuxt.md +2 -2
- package/docs/zh/intlayer_with_react_native+expo.md +19 -28
- package/docs/zh/intlayer_with_react_router_v7.md +200 -248
- package/docs/zh/intlayer_with_tanstack.md +208 -283
- package/docs/zh/intlayer_with_vite+preact.md +9 -9
- package/docs/zh/intlayer_with_vite+react.md +9 -9
- package/docs/zh/intlayer_with_vite+vue.md +9 -9
- package/docs/zh/vs_code_extension.md +51 -105
- package/package.json +10 -10
- package/src/generated/docs.entry.ts +32 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
---
|
|
2
|
+
createdAt: 2024-03-07
|
|
3
|
+
updatedAt: 2025-10-03
|
|
4
|
+
title: AstroでのIntlayer入門
|
|
5
|
+
description: Intlayerを使用してViteとReactアプリケーションに国際化(i18n)を追加する方法を学びます。このガイドに従ってアプリを多言語対応にしましょう。
|
|
6
|
+
keywords:
|
|
7
|
+
- 国際化
|
|
8
|
+
- ドキュメント
|
|
9
|
+
- Intlayer
|
|
10
|
+
- Vite
|
|
11
|
+
- React
|
|
12
|
+
- i18n
|
|
13
|
+
- JavaScript
|
|
14
|
+
slugs:
|
|
15
|
+
- doc
|
|
16
|
+
- environment
|
|
17
|
+
- astro
|
|
18
|
+
applicationTemplate: https://github.com/aymericzip/intlayer-astro-template
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# IntlayerとAstroで始める国際化(i18n)
|
|
22
|
+
|
|
23
|
+
GitHubの[アプリケーションテンプレート](https://github.com/aymericzip/intlayer-astro-template)をご覧ください。
|
|
24
|
+
|
|
25
|
+
## Intlayerとは?
|
|
26
|
+
|
|
27
|
+
**Intlayer**は、最新のウェブアプリケーションにおける多言語対応を簡素化するために設計された革新的なオープンソースの国際化(i18n)ライブラリです。
|
|
28
|
+
|
|
29
|
+
Intlayerを使うと、以下が可能です:
|
|
30
|
+
|
|
31
|
+
- **コンポーネントレベルで宣言的な辞書を使用して翻訳を簡単に管理**できます。
|
|
32
|
+
- **メタデータ、ルート、コンテンツを動的にローカライズ**できます。
|
|
33
|
+
- **自動生成された型によりTypeScriptサポートを確保**し、オートコンプリートやエラー検出を向上させます。
|
|
34
|
+
- **動的なロケール検出や切り替えなどの高度な機能**を活用できます。
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## AstroでIntlayerをセットアップするステップバイステップガイド
|
|
39
|
+
|
|
40
|
+
### ステップ1:依存関係のインストール
|
|
41
|
+
|
|
42
|
+
パッケージマネージャーを使って必要なパッケージをインストールします:
|
|
43
|
+
|
|
44
|
+
```bash packageManager="npm"
|
|
45
|
+
npm install intlayer astro-intlayer
|
|
46
|
+
# Optional: add React island support
|
|
47
|
+
npm install react react-dom react-intlayer @astrojs/react
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```bash packageManager="pnpm"
|
|
51
|
+
pnpm add intlayer astro-intlayer
|
|
52
|
+
# オプション: Reactアイランドサポートを追加
|
|
53
|
+
pnpm add react react-dom react-intlayer @astrojs/react
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```bash packageManager="yarn"
|
|
57
|
+
yarn add intlayer astro-intlayer
|
|
58
|
+
# オプション: Reactアイランドサポートを追加
|
|
59
|
+
yarn add react react-dom react-intlayer @astrojs/react
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
- **intlayer**
|
|
63
|
+
設定管理、翻訳、[コンテンツ宣言](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/dictionary/get_started.md)、トランスパイル、および[CLIコマンド](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_cli.md)のための国際化ツールを提供するコアパッケージ。
|
|
64
|
+
|
|
65
|
+
- **astro-intlayer**
|
|
66
|
+
Astroとの統合プラグインを含み、Intlayerを[Viteバンドラー](https://vite.dev/guide/why.html#why-bundle-for-production)と連携させるほか、ユーザーの優先ロケールの検出、クッキー管理、URLリダイレクトの処理を行うミドルウェアも提供します。
|
|
67
|
+
|
|
68
|
+
### ステップ2: プロジェクトの設定
|
|
69
|
+
|
|
70
|
+
アプリケーションの言語を設定するための設定ファイルを作成します:
|
|
71
|
+
|
|
72
|
+
```typescript fileName="intlayer.config.ts"
|
|
73
|
+
import { Locales, type IntlayerConfig } from "intlayer";
|
|
74
|
+
|
|
75
|
+
const config: IntlayerConfig = {
|
|
76
|
+
internationalization: {
|
|
77
|
+
locales: [
|
|
78
|
+
Locales.ENGLISH,
|
|
79
|
+
Locales.FRENCH,
|
|
80
|
+
Locales.SPANISH,
|
|
81
|
+
// 他のロケールをここに追加
|
|
82
|
+
],
|
|
83
|
+
defaultLocale: Locales.ENGLISH,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export default config;
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
> この設定ファイルを通じて、ローカライズされたURLの設定、ミドルウェアのリダイレクション、クッキー名、コンテンツ宣言の場所と拡張子の指定、コンソールでのIntlayerログの無効化などを行うことができます。利用可能なパラメータの完全なリストについては、[設定ドキュメント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/configuration.md)を参照してください。
|
|
91
|
+
|
|
92
|
+
### ステップ3: Astro設定にIntlayerを統合する
|
|
93
|
+
|
|
94
|
+
intlayerプラグインを設定に追加します。
|
|
95
|
+
|
|
96
|
+
```typescript fileName="astro.config.ts"
|
|
97
|
+
// @ts-check
|
|
98
|
+
|
|
99
|
+
import { intlayer } from "astro-intlayer";
|
|
100
|
+
import { defineConfig } from "astro/config";
|
|
101
|
+
|
|
102
|
+
// https://astro.build/config
|
|
103
|
+
export default defineConfig({
|
|
104
|
+
integrations: [intlayer()],
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
> `intlayer()` Astro統合プラグインは、IntlayerをAstroと統合するために使用されます。これは、コンテンツ宣言ファイルのビルドを確実に行い、開発モードでそれらを監視します。Astroアプリケーション内でIntlayerの環境変数を定義します。さらに、パフォーマンスを最適化するためのエイリアスも提供します。
|
|
109
|
+
|
|
110
|
+
### ステップ4: コンテンツを宣言する
|
|
111
|
+
|
|
112
|
+
翻訳を格納するためのコンテンツ宣言を作成および管理します:
|
|
113
|
+
|
|
114
|
+
```tsx fileName="src/app.content.tsx"
|
|
115
|
+
import { t, type Dictionary } from "intlayer";
|
|
116
|
+
import type { ReactNode } from "react";
|
|
117
|
+
|
|
118
|
+
const appContent = {
|
|
119
|
+
key: "app",
|
|
120
|
+
content: {
|
|
121
|
+
title: t({
|
|
122
|
+
en: "Hello World",
|
|
123
|
+
fr: "Bonjour le monde",
|
|
124
|
+
es: "Hola mundo",
|
|
125
|
+
}),
|
|
126
|
+
},
|
|
127
|
+
} satisfies Dictionary;
|
|
128
|
+
|
|
129
|
+
export default appContent;
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
> コンテンツ宣言は、`contentDir` ディレクトリ(デフォルトは `./src`)に含まれている限り、アプリケーションのどこにでも定義できます。また、コンテンツ宣言ファイルの拡張子(デフォルトは `.content.{json,ts,tsx,js,jsx,mjs,mjx,cjs,cjx}`)に一致している必要があります。
|
|
133
|
+
|
|
134
|
+
> 詳細については、[コンテンツ宣言のドキュメント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/dictionary/get_started.md)を参照してください。
|
|
135
|
+
|
|
136
|
+
### ステップ 5: Astro でコンテンツを使用する
|
|
137
|
+
|
|
138
|
+
`intlayer` からエクスポートされるコアヘルパーを使って、`.astro` ファイル内で辞書を直接利用できます。
|
|
139
|
+
|
|
140
|
+
```astro fileName="src/pages/index.astro"
|
|
141
|
+
<!-- astro -->
|
|
142
|
+
---
|
|
143
|
+
import { getIntlayer } from "intlayer";
|
|
144
|
+
import appContent from "../app.content";
|
|
145
|
+
|
|
146
|
+
const { title } = getIntlayer('app');
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
<html lang="en">
|
|
150
|
+
<head>
|
|
151
|
+
<meta charset="utf-8" />
|
|
152
|
+
<meta name="viewport" content="width=device-width" />
|
|
153
|
+
<title>{title}</title>
|
|
154
|
+
</head>
|
|
155
|
+
<body>
|
|
156
|
+
<h1>{title}</h1>
|
|
157
|
+
</body>
|
|
158
|
+
</html>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### ステップ6: ローカライズされたルーティング
|
|
162
|
+
|
|
163
|
+
ローカライズされたページを提供するために、動的なルートセグメントを作成します。例えば `src/pages/[locale]/index.astro` のようにします。
|
|
164
|
+
|
|
165
|
+
```astro fileName="src/pages/[locale]/index.astro"
|
|
166
|
+
<!-- astro -->
|
|
167
|
+
---
|
|
168
|
+
import { getIntlayer } from "intlayer";
|
|
169
|
+
|
|
170
|
+
const { title } = getIntlayer('app');
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
<h1>{title}</h1>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Astroの統合は、開発中にViteのミドルウェアを追加し、ロケール対応のルーティングや環境定義を支援します。独自のロジックや、`intlayer` の `getLocalizedUrl` のようなユーティリティ関数を使って、ロケール間のリンクを作成することも可能です。
|
|
177
|
+
|
|
178
|
+
### ステップ7: お気に入りのフレームワークを使い続ける
|
|
179
|
+
|
|
180
|
+
お気に入りのフレームワークを使い続けて、アプリケーションを構築してください。
|
|
181
|
+
|
|
182
|
+
- Intlayer + React: [Intlayer with React](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_with_vite+react.md)
|
|
183
|
+
- Intlayer + Vue: [Intlayer with Vue](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_with_vite+vue.md)
|
|
184
|
+
- Intlayer + Svelte: [Intlayer with Svelte](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_with_vite+svelte.md)
|
|
185
|
+
- Intlayer + Solid: [Intlayer with Solid](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_with_vite+solid.md)
|
|
186
|
+
- Intlayer + Preact: [Intlayer with Preact](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_with_vite+preact.md)
|
|
187
|
+
|
|
188
|
+
### TypeScriptの設定
|
|
189
|
+
|
|
190
|
+
Intlayerはモジュール拡張を使用してTypeScriptの利点を活かし、コードベースをより強固にします。
|
|
191
|
+
|
|
192
|
+

|
|
193
|
+
|
|
194
|
+

|
|
195
|
+
|
|
196
|
+
TypeScriptの設定に自動生成された型が含まれていることを確認してください。
|
|
197
|
+
|
|
198
|
+
```json5 fileName="tsconfig.json"
|
|
199
|
+
{
|
|
200
|
+
// ... 既存のTypeScript設定
|
|
201
|
+
"include": [
|
|
202
|
+
// ... 既存のTypeScript設定
|
|
203
|
+
".intlayer/**/*.ts", // 自動生成された型を含める
|
|
204
|
+
],
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Git設定
|
|
209
|
+
|
|
210
|
+
Intlayerによって生成されたファイルは無視することを推奨します。これにより、Gitリポジトリへのコミットを避けることができます。
|
|
211
|
+
|
|
212
|
+
これを行うには、以下の指示を `.gitignore` ファイルに追加できます。
|
|
213
|
+
|
|
214
|
+
```plaintext
|
|
215
|
+
# Intlayer によって生成されたファイルを無視する
|
|
216
|
+
.intlayer
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### VS Code 拡張機能
|
|
220
|
+
|
|
221
|
+
Intlayer での開発体験を向上させるために、公式の **Intlayer VS Code 拡張機能** をインストールできます。
|
|
222
|
+
|
|
223
|
+
[VS Code Marketplace からインストール](https://marketplace.visualstudio.com/items?itemName=intlayer.intlayer-vs-code-extension)
|
|
224
|
+
|
|
225
|
+
この拡張機能は以下を提供します:
|
|
226
|
+
|
|
227
|
+
- 翻訳キーの **オートコンプリート**。
|
|
228
|
+
- 欠落している翻訳の **リアルタイムエラー検出**。
|
|
229
|
+
- 翻訳されたコンテンツの **インラインプレビュー**。
|
|
230
|
+
- 翻訳を簡単に作成・更新できる **クイックアクション**。
|
|
231
|
+
|
|
232
|
+
拡張機能の使い方の詳細については、[Intlayer VS Code 拡張機能のドキュメント](https://intlayer.org/doc/vs-code-extension)を参照してください。
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
### さらに進むために
|
|
237
|
+
|
|
238
|
+
さらに進むためには、[ビジュアルエディター](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_visual_editor.md)を実装するか、[CMS](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_CMS.md)を使ってコンテンツを外部化することができます。
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## ドキュメント履歴
|
|
243
|
+
|
|
244
|
+
| バージョン | 日付 | 変更内容 |
|
|
245
|
+
| ---------- | ---------- | ------------------------------------- |
|
|
246
|
+
| 6.2.0 | 2025-10-03 | Astro統合、設定、使用法のリフレッシュ |
|
|
@@ -1174,9 +1174,10 @@ module.exports = App;
|
|
|
1174
1174
|
|
|
1175
1175
|
Intlayerはモジュール拡張を使用してTypeScriptの利点を活用し、コードベースを強化します。
|
|
1176
1176
|
|
|
1177
|
-

|
|
1178
|
+
|
|
1179
|
+

|
|
1178
1180
|
|
|
1179
|
-

|
|
1180
1181
|
自動生成された型を含めるようにTypeScriptの設定を確認してください。
|
|
1181
1182
|
|
|
1182
1183
|
```json5 fileName="tsconfig.json"
|
|
@@ -367,9 +367,9 @@ module.exports = config;
|
|
|
367
367
|
|
|
368
368
|
`express-intlayer` は、TypeScript の強力な機能を活用して国際化プロセスを強化します。TypeScript の静的型付けにより、すべての翻訳キーが網羅されていることが保証され、翻訳漏れのリスクを減らし、保守性を向上させます。
|
|
369
369
|
|
|
370
|
-

|
|
371
371
|
|
|
372
|
-

|
|
373
373
|
|
|
374
374
|
自動生成された型定義ファイル(デフォルトでは ./types/intlayer.d.ts)が tsconfig.json ファイルに含まれていることを確認してください。
|
|
375
375
|
|
|
@@ -219,9 +219,9 @@ export default config;
|
|
|
219
219
|
|
|
220
220
|
`express-intlayer` は、国際化プロセスを強化するために TypeScript の強力な機能を活用しています。TypeScript の静的型付けにより、すべての翻訳キーが確実に管理され、翻訳漏れのリスクを減らし、保守性を向上させます。
|
|
221
221
|
|
|
222
|
-

|
|
223
223
|
|
|
224
|
-

|
|
225
225
|
|
|
226
226
|
自動生成される型定義ファイル(デフォルトでは ./types/intlayer.d.ts)が tsconfig.json ファイルに含まれていることを確認してください。
|
|
227
227
|
|
|
@@ -1445,9 +1445,9 @@ yarn add @intlayer/swc --save-dev
|
|
|
1445
1445
|
|
|
1446
1446
|
Intlayerはモジュール拡張を使用して、TypeScriptの利点を活かし、コードベースをより強固にします。
|
|
1447
1447
|
|
|
1448
|
-

|
|
1449
1449
|
|
|
1450
|
-

|
|
1451
1451
|
|
|
1452
1452
|
TypeScriptの設定に自動生成された型が含まれていることを確認してください。
|
|
1453
1453
|
|
|
@@ -1483,9 +1483,9 @@ yarn add @intlayer/swc --save-dev
|
|
|
1483
1483
|
|
|
1484
1484
|
Intlayer はモジュール拡張を使用して TypeScript の利点を活かし、コードベースをより強固にします。
|
|
1485
1485
|
|
|
1486
|
-

|
|
1487
1487
|
|
|
1488
|
-

|
|
1489
1489
|
|
|
1490
1490
|
TypeScript の設定に自動生成された型を含めていることを確認してください。
|
|
1491
1491
|
|
|
@@ -1431,9 +1431,9 @@ yarn add @intlayer/swc --save-dev
|
|
|
1431
1431
|
|
|
1432
1432
|
Intlayerはモジュール拡張を使用して、TypeScriptの利点を活かし、コードベースをより強固にします。
|
|
1433
1433
|
|
|
1434
|
-

|
|
1435
1435
|
|
|
1436
|
-

|
|
1437
1437
|
|
|
1438
1438
|
TypeScriptの設定に自動生成された型が含まれていることを確認してください。
|
|
1439
1439
|
|
|
@@ -749,9 +749,9 @@ module.exports = aboutMetaContent;
|
|
|
749
749
|
|
|
750
750
|
Intlayerはモジュール拡張を使用してTypeScriptの利点を活かし、コードベースをより強固にします。
|
|
751
751
|
|
|
752
|
-

|
|
753
753
|
|
|
754
|
-

|
|
755
755
|
|
|
756
756
|
TypeScriptの設定に自動生成された型が含まれていることを確認してください。
|
|
757
757
|
|
|
@@ -149,43 +149,41 @@ module.exports = (async () => {
|
|
|
149
149
|
|
|
150
150
|
## ステップ4: Intlayerプロバイダーを追加する
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
アプリケーション全体でユーザーの言語を同期させるには、ルートコンポーネントを `react-intlayer-native` の `IntlayerProvider` コンポーネントでラップする必要があります。
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
> `react-intlayer` の代わりに `react-native-intlayer` のプロバイダーを使用してください。`react-native-intlayer` のエクスポートには Web API のポリフィルが含まれています。
|
|
155
155
|
|
|
156
156
|
```tsx fileName="app/_layout.tsx" codeFormat="typescript"
|
|
157
157
|
import { Stack } from "expo-router";
|
|
158
158
|
import { getLocales } from "expo-localization";
|
|
159
|
-
import {
|
|
160
|
-
import { intlayerPolyfill } from "react-native-intlayer";
|
|
159
|
+
import { IntlayerProvider } from "react-native-intlayer";
|
|
161
160
|
import { type FC } from "react";
|
|
162
161
|
|
|
163
|
-
|
|
162
|
+
|
|
164
163
|
|
|
165
164
|
const getDeviceLocale = () => getLocales()[0]?.languageTag;
|
|
166
165
|
|
|
167
166
|
const RootLayout: FC = () => {
|
|
168
167
|
return (
|
|
169
|
-
<
|
|
168
|
+
<IntlayerProvider defaultLocale={getDeviceLocale()}>
|
|
170
169
|
<Stack>
|
|
171
170
|
tsx fileName="app/_layout.tsx" codeFormat="typescript"
|
|
172
171
|
import { Stack } from "expo-router";
|
|
173
172
|
import { getLocales } from "expo-localization";
|
|
174
|
-
import {
|
|
175
|
-
import { intlayerPolyfill } from "react-native-intlayer";
|
|
173
|
+
import { IntlayerProvider } from "react-native-intlayer";
|
|
176
174
|
import { type FC } from "react";
|
|
177
175
|
|
|
178
|
-
|
|
176
|
+
|
|
179
177
|
|
|
180
178
|
const getDeviceLocale = () => getLocales()[0]?.languageTag;
|
|
181
179
|
|
|
182
180
|
const RootLayout: FC = () => {
|
|
183
181
|
return (
|
|
184
|
-
<
|
|
182
|
+
<IntlayerProvider defaultLocale={getDeviceLocale()}>
|
|
185
183
|
<Stack>
|
|
186
184
|
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
187
185
|
</Stack>
|
|
188
|
-
</
|
|
186
|
+
</IntlayerProvider>
|
|
189
187
|
);
|
|
190
188
|
};
|
|
191
189
|
|
|
@@ -195,20 +193,17 @@ export default RootLayout;
|
|
|
195
193
|
```jsx fileName="app/_layout.mjx" codeFormat="esm"
|
|
196
194
|
import { Stack } from "expo-router";
|
|
197
195
|
import { getLocales } from "expo-localization";
|
|
198
|
-
import {
|
|
199
|
-
import { intlayerPolyfill } from "react-native-intlayer";
|
|
200
|
-
|
|
201
|
-
intlayerPolyfill();
|
|
196
|
+
import { IntlayerProvider } from "react-native-intlayer";
|
|
202
197
|
|
|
203
198
|
const getDeviceLocale = () => getLocales()[0]?.languageTag;
|
|
204
199
|
|
|
205
200
|
const RootLayout = () => {
|
|
206
201
|
return (
|
|
207
|
-
<
|
|
202
|
+
<IntlayerProvider defaultLocale={getDeviceLocale()}>
|
|
208
203
|
<Stack>
|
|
209
204
|
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
210
205
|
</Stack>
|
|
211
|
-
</
|
|
206
|
+
</IntlayerProvider>
|
|
212
207
|
);
|
|
213
208
|
};
|
|
214
209
|
|
|
@@ -218,20 +213,17 @@ export default RootLayout;
|
|
|
218
213
|
```jsx fileName="app/_layout.cjx" codeFormat="commonjs"
|
|
219
214
|
const { Stack } = require("expo-router");
|
|
220
215
|
const { getLocales } = require("expo-localization");
|
|
221
|
-
const {
|
|
222
|
-
const { intlayerPolyfill } = require("react-native-intlayer");
|
|
223
|
-
|
|
224
|
-
intlayerPolyfill();
|
|
216
|
+
const { IntlayerProvider } = require("react-native-intlayer");
|
|
225
217
|
|
|
226
218
|
const getDeviceLocale = () => getLocales()[0]?.languageTag;
|
|
227
219
|
|
|
228
220
|
const RootLayout = () => {
|
|
229
221
|
return (
|
|
230
|
-
<
|
|
222
|
+
<IntlayerProvider defaultLocale={getDeviceLocale()}>
|
|
231
223
|
<Stack>
|
|
232
224
|
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
233
225
|
</Stack>
|
|
234
|
-
</
|
|
226
|
+
</IntlayerProvider>
|
|
235
227
|
);
|
|
236
228
|
};
|
|
237
229
|
|
|
@@ -243,20 +235,17 @@ module.exports = RootLayout;
|
|
|
243
235
|
```jsx fileName="app/_layout.cjx" codeFormat="commonjs"
|
|
244
236
|
const { Stack } = require("expo-router");
|
|
245
237
|
const { getLocales } = require("expo-localization");
|
|
246
|
-
const {
|
|
247
|
-
const { intlayerPolyfill } = require("react-native-intlayer");
|
|
248
|
-
|
|
249
|
-
intlayerPolyfill();
|
|
238
|
+
const { IntlayerProvider } = require("react-native-intlayer");
|
|
250
239
|
|
|
251
240
|
const getDeviceLocale = () => getLocales()[0]?.languageTag;
|
|
252
241
|
|
|
253
242
|
const RootLayout = () => {
|
|
254
243
|
return (
|
|
255
|
-
<
|
|
244
|
+
<IntlayerProvider defaultLocale={getDeviceLocale()}>
|
|
256
245
|
<Stack>
|
|
257
246
|
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
|
258
247
|
</Stack>
|
|
259
|
-
</
|
|
248
|
+
</IntlayerProvider>
|
|
260
249
|
);
|
|
261
250
|
};
|
|
262
251
|
|