@intlayer/docs 5.7.7 → 5.7.8

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/ja/CI_CD.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2025-05-20
3
- updatedAt: 2025-06-29
3
+ updatedAt: 2025-08-13
4
4
  title: CI/CD 統合
5
5
  description: Intlayer を CI/CD パイプラインに統合して、自動化されたコンテンツ管理とデプロイメントを実現する方法を学びます。
6
6
  keywords:
@@ -19,11 +19,11 @@ slugs:
19
19
 
20
20
  # CI/CD パイプラインでの翻訳の自動生成
21
21
 
22
- Intlayer は、コンテンツ宣言ファイルの翻訳を自動的に生成することを可能にします。ワークフローに応じて、これを実現する複数の方法があります。
22
+ Intlayer は、コンテンツ宣言ファイルの翻訳を自動生成することを可能にします。ワークフローに応じて、これを実現する複数の方法があります。
23
23
 
24
24
  ## CMS の利用
25
25
 
26
- Intlayer を使用すると、ローカルでは単一のロケールのみを宣言し、すべての翻訳を CMS を通じてリモートで管理するワークフローを採用できます。これにより、コンテンツと翻訳がコードベースから完全に切り離され、コンテンツ編集者にとってより柔軟性が高まり、ホットコンテンツリロード(変更を適用するためにアプリケーションを再ビルドする必要なし)が可能になります。
26
+ Intlayer を使用すると、ローカルでは単一のロケールのみを宣言し、すべての翻訳は CMS を通じてリモートで管理するワークフローを採用できます。これにより、コンテンツと翻訳がコードベースから完全に切り離され、コンテンツ編集者にとってより柔軟性が提供され、ホットコンテンツリロード(変更を適用するためにアプリケーションを再ビルドする必要なし)が可能になります。
27
27
 
28
28
  ### 設定例
29
29
 
@@ -54,7 +54,7 @@ export default config;
54
54
 
55
55
  CMSの詳細については、[公式ドキュメント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_CMS.md)を参照してください。
56
56
 
57
- ## Huskyの使用方法
57
+ ## Huskyの使用
58
58
 
59
59
  [Husky](https://typicode.github.io/husky/)を使用して、ローカルのGitワークフローに翻訳生成を統合できます。
60
60
 
@@ -77,7 +77,7 @@ const config: IntlayerConfig = {
77
77
  provider: "openai",
78
78
  apiKey: process.env.OPENAI_API_KEY, // ご自身のAPIキーを使用してください
79
79
 
80
- applicationContext: "これはテストアプリケーションです", // 一貫した翻訳生成を確保するのに役立ちます
80
+ applicationContext: "This is a test application", // 一貫した翻訳生成を支援します
81
81
  },
82
82
  };
83
83
 
@@ -89,7 +89,7 @@ npx intlayer build # 辞書が最新であることを
89
89
  npx intlayer fill --unpushed --mode fill # 欠落しているコンテンツのみを埋め、既存のものは更新しません
90
90
  ```
91
91
 
92
- > IntlayerCLIコマンドとその使用方法の詳細については、[CLIドキュメント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_cli.md)を参照してください。
92
+ > Intlayer CLIコマンドとその使用方法の詳細については、[CLIドキュメント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_cli.md)を参照してください。
93
93
 
94
94
  > リポジトリ内に複数のアプリがあり、それぞれ別のintlayerインスタンスを使用している場合は、次のように`--base-dir`引数を使用できます。
95
95
 
@@ -103,70 +103,96 @@ npx intlayer build --base-dir ./app2
103
103
  npx intlayer fill --base-dir ./app2 --unpushed --mode fill
104
104
  ```
105
105
 
106
- ## GitHub Actionsの使用方法
106
+ ## GitHub Actionsの使用
107
107
 
108
- Intlayerは、辞書の内容を自動入力およびレビューするためのCLIコマンドを提供しています。これはGitHub Actionsを使用してCI/CDワークフローに統合することができます。
108
+ Intlayerは辞書コンテンツの自動入力およびレビューを行うCLIコマンドを提供しています。これはGitHub Actionsを使用してCI/CDワークフローに統合することができます。
109
109
 
110
110
  ```yaml fileName=".github/workflows/intlayer-translate.yml"
111
111
  name: Intlayer 自動入力
112
+ # このワークフローのトリガー条件
112
113
  on:
113
- push:
114
- branches: [ main ]
115
- paths:
116
- - 'src/**'
117
114
  pull_request:
118
- branches: [ main ]
119
- paths:
120
- - 'src/**'
121
- workflow_dispatch: {}
115
+ branches:
116
+ - "main"
117
+
118
+ permissions:
119
+ contents: write
120
+ pull-requests: write
122
121
 
123
122
  concurrency:
124
- group: 'autofill-${{ github.ref }}'
123
+ group: "autofill-${{ github.ref }}"
125
124
  cancel-in-progress: true
126
125
 
127
126
  jobs:
128
127
  autofill:
129
128
  runs-on: ubuntu-latest
130
129
  env:
131
- INTLAYER_CLIENT_ID: ${{ secrets.INTLAYER_CLIENT_ID }}
132
- INTLAYER_CLIENT_SECRET: ${{ secrets.INTLAYER_CLIENT_SECRET }}
133
- OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
130
+ # OpenAI
131
+ AI_MODEL: openai
132
+ AI_PROVIDER: gpt-5-mini
133
+ AI_API_KEY: ${{ secrets.AI_API_KEY }}
134
134
 
135
135
  steps:
136
+ # ステップ1: リポジトリから最新コードを取得
136
137
  - name: ⬇️ リポジトリをチェックアウト
137
- uses: actions/checkout@v3
138
+ uses: actions/checkout@v4
138
139
  with:
139
- persist-credentials: true
140
+ persist-credentials: true # PR作成のための認証情報を保持
141
+ fetch-depth: 0 # 差分解析のために完全なGit履歴を取得
140
142
 
141
- - name: 🟢 Node.js のセットアップ
142
- uses: actions/setup-node@v3
143
+ # ステップ 2: Node.js環境のセットアップ
144
+ - name: 🟢 Node.jsをセットアップ
145
+ uses: actions/setup-node@v4
143
146
  with:
144
- node-version: 20
147
+ node-version: 20 # 安定性のためNode.js 20 LTSを使用
145
148
 
146
- - name: 📦 依存関係のインストール
147
- run: npm ci
149
+ # ステップ 3: プロジェクト依存関係のインストール
150
+ - name: 📦 依存関係をインストール
151
+ run: npm install
148
152
 
149
- - name: ⚙️ Intlayer プロジェクトのビルド
150
- run: npx intlayer build
153
+ # ステップ 4: 翻訳管理のためにIntlayer CLIをグローバルインストール
154
+ - name: 📦 Intlayerをインストール
155
+ run: npm install -g intlayer-cli
151
156
 
152
- - name: 🤖 欠落している翻訳の自動補完
153
- run: npx intlayer fill --git-diff --mode fill
157
+ # ステップ 5: 翻訳ファイルを生成するためにIntlayerプロジェクトをビルド
158
+ - name: ⚙️ Intlayerプロジェクトをビルド
159
+ run: npx intlayer build
154
160
 
155
- - name: 📤 翻訳プルリクエストの作成または更新
156
- uses: peter-evans/create-pull-request@v4
157
- with:
158
- commit-message: chore: auto-fill missing translations [skip ci]
159
- branch: auto-translations
160
- title: chore: update missing translations
161
- labels: translation, automated
161
+ # ステップ 6: AIを使って不足している翻訳を自動で埋める
162
+ - name: 🤖 欠落している翻訳を自動入力
163
+ run: npx intlayer fill --git-diff --mode fill --provider $AI_PROVIDER --model $AI_MODEL --api-key $AI_API_KEY
164
+
165
+ # ステップ7: 変更があるか確認し、あればコミットする
166
+ - name: 変更を確認
167
+ id: check-changes
168
+ run: |
169
+ if [ -n "$(git status --porcelain)" ]; then
170
+ echo "has-changes=true" >> $GITHUB_OUTPUT
171
+ else
172
+ echo "has-changes=false" >> $GITHUB_OUTPUT
173
+ fi
174
+
175
+ # ステップ8: 変更があればコミットしてプッシュする
176
+ - name: 📤 変更をコミットしてプッシュ
177
+ if: steps.check-changes.outputs.has-changes == 'true'
178
+ run: |
179
+ git config --local user.email "action@github.com"
180
+ git config --local user.name "GitHub Action"
181
+ git add .
182
+ git commit -m "chore: auto-fill missing translations [skip ci]"
183
+ git push origin HEAD:${{ github.head_ref }}
162
184
  ```
163
185
 
164
- > Huskyの場合と同様に、モノレポの場合は `--base-dir` 引数を使用して各アプリを順次処理することができます。
186
+ 環境変数を設定するには、GitHub 設定 → Secrets and variables → Actions に移動し、シークレット(API_KEY)を追加してください。
187
+
188
+ > Huskyの場合と同様に、モノレポの場合は `--base-dir` 引数を使用して各アプリを順番に処理できます。
165
189
 
166
190
  > デフォルトでは、`--git-diff` 引数はベース(デフォルトは `origin/main`)から現在のブランチ(デフォルトは `HEAD`)への変更を含む辞書をフィルタリングします。
167
191
 
168
- > Intlayer CLI コマンドとその使用方法の詳細については、[CLIドキュメント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_cli.md)を参照してください。
192
+ > Intlayer CLIコマンドとその使用方法の詳細については、[CLIドキュメント](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ja/intlayer_cli.md)を参照してください。
169
193
 
170
194
  ## ドキュメント履歴
171
195
 
172
- - 5.5.10 - 2025-06-29: 履歴の初期化
196
+ | バージョン | 日付 | 変更内容 |
197
+ | ---------- | ---------- | ------------ |
198
+ | 5.5.10 | 2025-06-29 | 履歴の初期化 |
package/docs/ko/CI_CD.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2025-05-20
3
- updatedAt: 2025-06-29
3
+ updatedAt: 2025-08-13
4
4
  title: CI/CD 통합
5
5
  description: 자동화된 콘텐츠 관리 및 배포를 위해 Intlayer를 CI/CD 파이프라인에 통합하는 방법을 알아보세요.
6
6
  keywords:
@@ -23,7 +23,7 @@ Intlayer는 콘텐츠 선언 파일에 대한 번역을 자동으로 생성할
23
23
 
24
24
  ## CMS 사용하기
25
25
 
26
- Intlayer를 사용하면 로컬에서는 단일 로케일만 선언하고 모든 번역은 CMS를 통해 원격으로 관리하는 워크플로우를 채택할 수 있습니다. 이를 통해 콘텐츠와 번역이 코드베이스와 완전히 분리되어 콘텐츠 편집자에게 더 많은 유연성을 제공하며, 변경 사항을 적용하기 위해 애플리케이션을 다시 빌드할 필요 없이 핫 콘텐츠 리로딩이 가능합니다.
26
+ Intlayer를 사용하면 로컬에서는 단일 로케일만 선언하고 모든 번역은 CMS를 통해 원격으로 관리하는 워크플로우를 채택할 수 있습니다. 이를 통해 콘텐츠와 번역이 코드베이스와 완전히 분리되어 콘텐츠 편집자에게 더 많은 유연성을 제공하며, 핫 콘텐츠 리로딩이 가능해져(변경 사항 적용을 위해 애플리케이션을 다시 빌드할 필요 없음) 편리합니다.
27
27
 
28
28
  ### 예제 구성
29
29
 
@@ -37,7 +37,7 @@ const config: IntlayerConfig = {
37
37
  defaultLocale: Locales.ENGLISH,
38
38
  },
39
39
  editor: {
40
- dictionaryPriorityStrategy: "distant_first", // 원격 콘텐츠가 우선권을 가짐
40
+ dictionaryPriorityStrategy: "distant_first", // 원격 콘텐츠가 우선순위를 가집니다
41
41
 
42
42
  applicationURL: process.env.APPLICATION_URL, // CMS에서 사용하는 애플리케이션 URL
43
43
 
@@ -56,7 +56,7 @@ CMS에 대해 더 알아보려면 [공식 문서](https://github.com/aymericzip/
56
56
 
57
57
  ## Husky 사용하기
58
58
 
59
- [Husky](https://typicode.github.io/husky/)를 사용하여 로컬 Git 워크플로우에 번역 생성 기능을 통합할 수 있습니다.
59
+ [Husky](https://typicode.github.io/husky/)를 사용하여 로컬 Git 워크플로우에 번역 생성 과정을 통합할 수 있습니다.
60
60
 
61
61
  ### 예제 구성
62
62
 
@@ -77,7 +77,7 @@ const config: IntlayerConfig = {
77
77
  provider: "openai",
78
78
  apiKey: process.env.OPENAI_API_KEY, // 자신의 API 키를 사용하세요
79
79
 
80
- applicationContext: "This is a test application", // 일관된 번역 생성을 보장하는 데 도움을 줍니다
80
+ applicationContext: "This is a test application", // 일관된 번역 생성을 돕습니다
81
81
  },
82
82
  };
83
83
 
@@ -85,13 +85,13 @@ export default config;
85
85
  ```
86
86
 
87
87
  ```bash fileName=".husky/pre-push"
88
- npx intlayer build # 사전이 최신 상태인지 확인하기 위해
89
- npx intlayer fill --unpushed --mode fill # 누락된 내용만 채우며, 기존 내용을 업데이트하지 않습니다.
88
+ npx intlayer build # 사전이 최신 상태인지 확인합니다
89
+ npx intlayer fill --unpushed --mode fill # 누락된 내용만 채우며, 기존 내용을 업데이트하지 않습니다
90
90
  ```
91
91
 
92
92
  > Intlayer CLI 명령어 및 사용법에 대한 자세한 내용은 [CLI 문서](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ko/intlayer_cli.md)를 참조하세요.
93
93
 
94
- > 저장소에 여러 앱이 있고 각각 별도의 intlayer 인스턴스를 사용하는 경우, 다음과 같이 `--base-dir` 인수를 사용할 수 있습니다:
94
+ > 저장소에 여러 앱이 있고 각각 별도의 intlayer 인스턴스를 사용하는 경우, `--base-dir` 인수를 다음과 같이 사용할 수 있습니다:
95
95
 
96
96
  ```bash fileName=".husky/pre-push"
97
97
  # 앱 1
@@ -105,68 +105,94 @@ npx intlayer fill --base-dir ./app2 --unpushed --mode fill
105
105
 
106
106
  ## GitHub Actions 사용하기
107
107
 
108
- Intlayer는 사전 내용을 자동 채우기 검토할 수 있는 CLI 명령어를 제공합니다. 이는 GitHub Actions를 사용하여 CI/CD 워크플로우에 통합할 수 있습니다.
108
+ Intlayer는 사전 내용을 자동으로 채우고 검토할 수 있는 CLI 명령어를 제공합니다. 이는 GitHub Actions를 사용하여 CI/CD 워크플로우에 통합할 수 있습니다.
109
109
 
110
110
  ```yaml fileName=".github/workflows/intlayer-translate.yml"
111
111
  name: Intlayer 자동 채우기
112
+ # 이 워크플로우의 트리거 조건
112
113
  on:
113
- push:
114
- branches: [ main ]
115
- paths:
116
- - 'src/**'
117
114
  pull_request:
118
- branches: [ main ]
119
- paths:
120
- - 'src/**'
121
- workflow_dispatch: {}
115
+ branches:
116
+ - "main"
117
+
118
+ permissions:
119
+ contents: write
120
+ pull-requests: write
122
121
 
123
122
  concurrency:
124
- group: 'autofill-${{ github.ref }}'
123
+ group: "autofill-${{ github.ref }}"
125
124
  cancel-in-progress: true
126
125
 
127
126
  jobs:
128
127
  autofill:
129
128
  runs-on: ubuntu-latest
130
129
  env:
131
- INTLAYER_CLIENT_ID: ${{ secrets.INTLAYER_CLIENT_ID }}
132
- INTLAYER_CLIENT_SECRET: ${{ secrets.INTLAYER_CLIENT_SECRET }}
133
- OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
130
+ # OpenAI
131
+ AI_MODEL: openai
132
+ AI_PROVIDER: gpt-5-mini
133
+ AI_API_KEY: ${{ secrets.AI_API_KEY }}
134
134
 
135
135
  steps:
136
+ # 1단계: 저장소에서 최신 코드 가져오기
136
137
  - name: ⬇️ 저장소 체크아웃
137
- uses: actions/checkout@v3
138
+ uses: actions/checkout@v4
138
139
  with:
139
- persist-credentials: true
140
+ persist-credentials: true # PR 생성을 위한 자격 증명 유지
141
+ fetch-depth: 0 # 차이 분석을 위한 전체 git 히스토리 가져오기
140
142
 
143
+ # 2단계: Node.js 환경 설정
141
144
  - name: 🟢 Node.js 설정
142
- uses: actions/setup-node@v3
145
+ uses: actions/setup-node@v4
143
146
  with:
144
- node-version: 20
147
+ node-version: 20 # 안정성을 위해 Node.js 20 LTS 사용
145
148
 
149
+ # 3단계: 프로젝트 의존성 설치
146
150
  - name: 📦 의존성 설치
147
- run: npm ci
151
+ run: npm install
152
+
153
+ # 4단계: 번역 관리를 위해 Intlayer CLI 전역 설치
154
+ - name: 📦 Intlayer 설치
155
+ run: npm install -g intlayer-cli
148
156
 
157
+ # 5단계: 번역 파일 생성을 위해 Intlayer 프로젝트 빌드
149
158
  - name: ⚙️ Intlayer 프로젝트 빌드
150
159
  run: npx intlayer build
151
160
 
161
+ # 6단계: AI를 사용하여 누락된 번역 자동 채우기
152
162
  - name: 🤖 누락된 번역 자동 채우기
153
- run: npx intlayer fill --git-diff --mode fill
154
-
155
- - name: 📤 번역 PR 생성 또는 업데이트
156
- uses: peter-evans/create-pull-request@v4
157
- with:
158
- commit-message: chore: auto-fill missing translations [skip ci]
159
- branch: auto-translations
160
- title: chore: update missing translations
161
- labels: translation, automated
163
+ run: npx intlayer fill --git-diff --mode fill --provider $AI_PROVIDER --model $AI_MODEL --api-key $AI_API_KEY
164
+
165
+ # 7단계: 변경 사항이 있는지 확인하고 커밋하기
166
+ - name: � 변경 사항 확인
167
+ id: check-changes
168
+ run: |
169
+ if [ -n "$(git status --porcelain)" ]; then
170
+ echo "has-changes=true" >> $GITHUB_OUTPUT
171
+ else
172
+ echo "has-changes=false" >> $GITHUB_OUTPUT
173
+ fi
174
+
175
+ # 8단계: 변경 사항이 있으면 커밋하고 푸시하기
176
+ - name: 📤 변경 사항 커밋 및 푸시
177
+ if: steps.check-changes.outputs.has-changes == 'true'
178
+ run: |
179
+ git config --local user.email "action@github.com"
180
+ git config --local user.name "GitHub Action"
181
+ git add .
182
+ git commit -m "chore: 누락된 번역 자동 채우기 [skip ci]"
183
+ git push origin HEAD:${{ github.head_ref }}
162
184
  ```
163
185
 
186
+ 환경 변수를 설정하려면 GitHub → 설정 → Secrets and variables → Actions로 이동하여 비밀을 추가하세요.
187
+
164
188
  > Husky와 마찬가지로, 모노레포의 경우 `--base-dir` 인수를 사용하여 각 앱을 순차적으로 처리할 수 있습니다.
165
189
 
166
- > 기본적으로 `--git-diff` 인수는 기본 브랜치(기본값 `origin/main`)에서 현재 브랜치(기본값 `HEAD`)까지의 변경 사항을 포함하는 사전만 필터링합니다.
190
+ > 기본적으로 `--git-diff` 인수는 기본 브랜치(기본값 `origin/main`)에서 현재 브랜치(기본값: `HEAD`) 변경된 사전을 필터링합니다.
167
191
 
168
192
  > Intlayer CLI 명령어 및 사용법에 대한 자세한 내용은 [CLI 문서](https://github.com/aymericzip/intlayer/blob/main/docs/docs/ko/intlayer_cli.md)를 참조하세요.
169
193
 
170
194
  ## 문서 이력
171
195
 
172
- - 5.5.10 - 2025-06-29: 이력 초기화
196
+ | 버전 | 날짜 | 변경 사항 |
197
+ | ------ | ---------- | --------- |
198
+ | 5.5.10 | 2025-06-29 | 초기 기록 |
package/docs/pt/CI_CD.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  createdAt: 2025-05-20
3
- updatedAt: 2025-06-29
3
+ updatedAt: 2025-08-13
4
4
  title: Integração CI/CD
5
5
  description: Aprenda como integrar o Intlayer em seu pipeline CI/CD para gerenciamento e implantação automatizados de conteúdo.
6
6
  keywords:
@@ -19,13 +19,13 @@ slugs:
19
19
 
20
20
  # Geração Automática de Traduções em um Pipeline CI/CD
21
21
 
22
- O Intlayer permite a geração automática de traduções para seus arquivos de declaração de conteúdo. Existem várias maneiras de alcançar isso dependendo do seu fluxo de trabalho.
22
+ O Intlayer permite a geração automática de traduções para seus arquivos de declaração de conteúdo. Existem várias maneiras de realizar isso dependendo do seu fluxo de trabalho.
23
23
 
24
24
  ## Usando o CMS
25
25
 
26
- Com o Intlayer, você pode adotar um fluxo de trabalho onde apenas um único idioma é declarado localmente, enquanto todas as traduções são gerenciadas remotamente através do CMS. Isso permite que o conteúdo e as traduções fiquem completamente desacoplados da base de código, oferecendo mais flexibilidade para os editores de conteúdo e possibilitando recarregamento dinâmico do conteúdo (sem necessidade de reconstruir a aplicação para aplicar as mudanças).
26
+ Com o Intlayer, você pode adotar um fluxo de trabalho onde apenas um único idioma é declarado localmente, enquanto todas as traduções são gerenciadas remotamente através do CMS. Isso permite que o conteúdo e as traduções fiquem completamente desacoplados da base de código, oferecendo mais flexibilidade para os editores de conteúdo e possibilitando o recarregamento dinâmico do conteúdo (sem necessidade de reconstruir a aplicação para aplicar as alterações).
27
27
 
28
- ### Exemplo de Configuração
28
+ ### Configuração de Exemplo
29
29
 
30
30
  ```ts fileName="intlayer.config.ts"
31
31
  import { Locales, type IntlayerConfig } from "intlayer";
@@ -37,7 +37,7 @@ const config: IntlayerConfig = {
37
37
  defaultLocale: Locales.ENGLISH,
38
38
  },
39
39
  editor: {
40
- dictionaryPriorityStrategy: "distant_first", // O conteúdo remoto tem prioridade
40
+ dictionaryPriorityStrategy: "distant_first", // Conteúdo remoto tem prioridade
41
41
 
42
42
  applicationURL: process.env.APPLICATION_URL, // URL da aplicação usada pelo CMS
43
43
 
@@ -45,7 +45,7 @@ const config: IntlayerConfig = {
45
45
  clientSecret: process.env.INTLAYER_CLIENT_SECRET,
46
46
  },
47
47
  ai: {
48
- applicationContext: "Esta é uma aplicação de teste", // Ajuda a garantir a geração consistente de traduções
48
+ applicationContext: "This is a test application", // Ajuda a garantir a geração consistente de traduções
49
49
  },
50
50
  };
51
51
 
@@ -56,9 +56,9 @@ Para saber mais sobre o CMS, consulte a [documentação oficial](https://github.
56
56
 
57
57
  ## Usando Husky
58
58
 
59
- Você pode integrar a geração de traduções ao seu fluxo de trabalho Git local usando o [Husky](https://typicode.github.io/husky/).
59
+ Você pode integrar a geração de traduções no seu fluxo de trabalho local do Git usando o [Husky](https://typicode.github.io/husky/).
60
60
 
61
- ### Exemplo de Configuração
61
+ ### Configuração de Exemplo
62
62
 
63
63
  ```ts fileName="intlayer.config.ts"
64
64
  import { Locales, type IntlayerConfig } from "intlayer";
@@ -77,7 +77,7 @@ const config: IntlayerConfig = {
77
77
  provider: "openai",
78
78
  apiKey: process.env.OPENAI_API_KEY, // Use sua própria chave API
79
79
 
80
- applicationContext: "Esta é uma aplicação de teste", // Ajuda a garantir a geração consistente de traduções
80
+ applicationContext: "This is a test application", // Ajuda a garantir a geração consistente de traduções
81
81
  },
82
82
  };
83
83
 
@@ -86,7 +86,7 @@ export default config;
86
86
 
87
87
  ```bash fileName=".husky/pre-push"
88
88
  npx intlayer build # Para garantir que os dicionários estejam atualizados
89
- npx intlayer fill --unpushed --mode fill # Preenche apenas o conteúdo faltante, não atualiza os existentes
89
+ npx intlayer fill --unpushed --mode fill # Apenas preenche o conteúdo faltante, não atualiza os existentes
90
90
  ```
91
91
 
92
92
  > Para mais informações sobre os comandos CLI do Intlayer e seu uso, consulte a [documentação CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/intlayer_cli.md).
@@ -105,68 +105,94 @@ npx intlayer fill --base-dir ./app2 --unpushed --mode fill
105
105
 
106
106
  ## Usando GitHub Actions
107
107
 
108
- Intlayer fornece um comando CLI para preenchimento automático e revisão do conteúdo do dicionário. Isso pode ser integrado ao seu fluxo de trabalho CI/CD usando GitHub Actions.
108
+ O Intlayer fornece um comando CLI para preenchimento automático e revisão do conteúdo do dicionário. Isso pode ser integrado ao seu fluxo de trabalho CI/CD usando GitHub Actions.
109
109
 
110
110
  ```yaml fileName=".github/workflows/intlayer-translate.yml"
111
- name: Intlayer Auto-Fill
111
+ name: Preenchimento Automático Intlayer
112
+ # Condições de gatilho para este fluxo de trabalho
112
113
  on:
113
- push:
114
- branches: [ main ]
115
- paths:
116
- - 'src/**'
117
114
  pull_request:
118
- branches: [ main ]
119
- paths:
120
- - 'src/**'
121
- workflow_dispatch: {}
115
+ branches:
116
+ - "main"
117
+
118
+ permissions:
119
+ contents: write
120
+ pull-requests: write
122
121
 
123
122
  concurrency:
124
- group: 'autofill-${{ github.ref }}'
123
+ group: "autofill-${{ github.ref }}"
125
124
  cancel-in-progress: true
126
125
 
127
126
  jobs:
128
127
  autofill:
129
128
  runs-on: ubuntu-latest
130
129
  env:
131
- INTLAYER_CLIENT_ID: ${{ secrets.INTLAYER_CLIENT_ID }}
132
- INTLAYER_CLIENT_SECRET: ${{ secrets.INTLAYER_CLIENT_SECRET }}
133
- OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
130
+ # OpenAI
131
+ AI_MODEL: openai
132
+ AI_PROVIDER: gpt-5-mini
133
+ AI_API_KEY: ${{ secrets.AI_API_KEY }}
134
134
 
135
135
  steps:
136
- - name: ⬇️ Fazer checkout do repositório
137
- uses: actions/checkout@v3
136
+ # Passo 1: Obter o código mais recente do repositório
137
+ - name: ⬇️ Checkout do repositório
138
+ uses: actions/checkout@v4
138
139
  with:
139
- persist-credentials: true
140
+ persist-credentials: true # Manter credenciais para criação de PRs
141
+ fetch-depth: 0 # Obter histórico completo do git para análise de diferenças
140
142
 
143
+ # Passo 2: Configurar ambiente Node.js
141
144
  - name: 🟢 Configurar Node.js
142
- uses: actions/setup-node@v3
145
+ uses: actions/setup-node@v4
143
146
  with:
144
- node-version: 20
147
+ node-version: 20 # Usar Node.js 20 LTS para estabilidade
145
148
 
149
+ # Passo 3: Instalar dependências do projeto
146
150
  - name: 📦 Instalar dependências
147
- run: npm ci
151
+ run: npm install
152
+
153
+ # Passo 4: Instalar Intlayer CLI globalmente para gerenciamento de traduções
154
+ - name: 📦 Instalar Intlayer
155
+ run: npm install -g intlayer-cli
148
156
 
157
+ # Passo 5: Construir o projeto Intlayer para gerar arquivos de tradução
149
158
  - name: ⚙️ Construir projeto Intlayer
150
159
  run: npx intlayer build
151
160
 
161
+ # Passo 6: Usar IA para preencher automaticamente traduções faltantes
152
162
  - name: 🤖 Preencher automaticamente traduções faltantes
153
- run: npx intlayer fill --git-diff --mode fill
154
-
155
- - name: 📤 Criar ou atualizar PR de tradução
156
- uses: peter-evans/create-pull-request@v4
157
- with:
158
- commit-message: chore: auto-fill missing translations [skip ci]
159
- branch: auto-translations
160
- title: chore: update missing translations
161
- labels: translation, automated
163
+ run: npx intlayer fill --git-diff --mode fill --provider $AI_PROVIDER --model $AI_MODEL --api-key $AI_API_KEY
164
+
165
+ # Passo 7: Verificar se alterações e comitá-las
166
+ - name: � Verificar alterações
167
+ id: check-changes
168
+ run: |
169
+ if [ -n "$(git status --porcelain)" ]; then
170
+ echo "has-changes=true" >> $GITHUB_OUTPUT
171
+ else
172
+ echo "has-changes=false" >> $GITHUB_OUTPUT
173
+ fi
174
+
175
+ # Passo 8: Comitar e enviar alterações se existirem
176
+ - name: 📤 Comitar e enviar alterações
177
+ if: steps.check-changes.outputs.has-changes == 'true'
178
+ run: |
179
+ git config --local user.email "action@github.com"
180
+ git config --local user.name "GitHub Action"
181
+ git add .
182
+ git commit -m "chore: auto-fill missing translations [skip ci]"
183
+ git push origin HEAD:${{ github.head_ref }}
162
184
  ```
163
185
 
186
+ Para configurar as variáveis de ambiente, vá para GitHub → Configurações → Segredos e variáveis → Ações e adicione o segredo .
187
+
164
188
  > Assim como para o Husky, no caso de um monorepo, você pode usar o argumento `--base-dir` para tratar sequencialmente cada app.
165
189
 
166
190
  > Por padrão, o argumento `--git-diff` filtra os dicionários que incluem alterações da base (padrão `origin/main`) para o branch atual (padrão: `HEAD`).
167
191
 
168
192
  > Para mais informações sobre os comandos do Intlayer CLI e seu uso, consulte a [documentação do CLI](https://github.com/aymericzip/intlayer/blob/main/docs/docs/pt/intlayer_cli.md).
169
193
 
170
- ## Histórico da Documentação
194
+ ## Histórico do Documento
171
195
 
172
- - 5.5.10 - 2025-06-29: Histórico inicial
196
+ | Versão | Data | Alterações |
197
+ | ------ | ---------- | ----------------- |
198
+ | 5.5.10 | 2025-06-29 | Histórico inicial |