@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/ar/CI_CD.md +67 -41
- package/docs/de/CI_CD.md +63 -37
- package/docs/en/CI_CD.md +51 -27
- package/docs/en-GB/CI_CD.md +58 -32
- package/docs/es/CI_CD.md +68 -42
- package/docs/hi/CI_CD.md +69 -44
- package/docs/it/CI_CD.md +67 -41
- package/docs/ja/CI_CD.md +67 -41
- package/docs/ko/CI_CD.md +63 -37
- package/docs/pt/CI_CD.md +67 -41
- package/docs/ru/CI_CD.md +70 -44
- package/docs/zh/CI_CD.md +62 -36
- package/package.json +8 -8
package/docs/ar/CI_CD.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-05-20
|
|
3
|
-
updatedAt: 2025-
|
|
3
|
+
updatedAt: 2025-08-13
|
|
4
4
|
title: تكامل CI/CD
|
|
5
|
-
description: تعلّم كيفية دمج Intlayer في خط أنابيب CI/CD الخاص بك لإدارة المحتوى والنشر
|
|
5
|
+
description: تعلّم كيفية دمج Intlayer في خط أنابيب CI/CD الخاص بك لإدارة المحتوى والنشر بشكل آلي.
|
|
6
6
|
keywords:
|
|
7
7
|
- CI/CD
|
|
8
8
|
- التكامل المستمر
|
|
@@ -23,7 +23,7 @@ slugs:
|
|
|
23
23
|
|
|
24
24
|
## استخدام نظام إدارة المحتوى (CMS)
|
|
25
25
|
|
|
26
|
-
مع Intlayer، يمكنك اعتماد سير عمل حيث يتم إعلان لغة واحدة فقط محليًا، بينما تتم إدارة جميع الترجمات عن بُعد من خلال نظام إدارة المحتوى (CMS). يتيح
|
|
26
|
+
مع Intlayer، يمكنك اعتماد سير عمل حيث يتم إعلان لغة واحدة فقط محليًا، بينما تتم إدارة جميع الترجمات عن بُعد من خلال نظام إدارة المحتوى (CMS). يتيح هذا فصل المحتوى والترجمات تمامًا عن قاعدة الشيفرة، مما يوفر مزيدًا من المرونة لمحرري المحتوى ويمكّن من إعادة تحميل المحتوى الحي (دون الحاجة إلى إعادة بناء التطبيق لتطبيق التغييرات).
|
|
27
27
|
|
|
28
28
|
### مثال على التكوين
|
|
29
29
|
|
|
@@ -33,13 +33,13 @@ import { Locales, type IntlayerConfig } from "intlayer";
|
|
|
33
33
|
const config: IntlayerConfig = {
|
|
34
34
|
internationalization: {
|
|
35
35
|
locales: [Locales.ENGLISH, Locales.SPANISH, Locales.FRENCH],
|
|
36
|
-
requiredLocales: [Locales.ENGLISH], // اللغات الاختيارية
|
|
36
|
+
requiredLocales: [Locales.ENGLISH], // سيتم إدارة اللغات الاختيارية عن بُعد
|
|
37
37
|
defaultLocale: Locales.ENGLISH,
|
|
38
38
|
},
|
|
39
39
|
editor: {
|
|
40
40
|
dictionaryPriorityStrategy: "distant_first", // المحتوى البعيد له الأولوية
|
|
41
41
|
|
|
42
|
-
applicationURL: process.env.APPLICATION_URL, // عنوان URL
|
|
42
|
+
applicationURL: process.env.APPLICATION_URL, // عنوان URL الخاص بالتطبيق المستخدم من قبل نظام إدارة المحتوى
|
|
43
43
|
|
|
44
44
|
clientId: process.env.INTLAYER_CLIENT_ID, // بيانات اعتماد نظام إدارة المحتوى
|
|
45
45
|
clientSecret: process.env.INTLAYER_CLIENT_SECRET,
|
|
@@ -56,7 +56,7 @@ export default config;
|
|
|
56
56
|
|
|
57
57
|
## استخدام Husky
|
|
58
58
|
|
|
59
|
-
يمكنك دمج توليد
|
|
59
|
+
يمكنك دمج توليد الترجمات في سير عمل Git المحلي الخاص بك باستخدام [Husky](https://typicode.github.io/husky/).
|
|
60
60
|
|
|
61
61
|
### مثال على التكوين
|
|
62
62
|
|
|
@@ -70,7 +70,7 @@ const config: IntlayerConfig = {
|
|
|
70
70
|
defaultLocale: Locales.ENGLISH,
|
|
71
71
|
},
|
|
72
72
|
editor: {
|
|
73
|
-
clientId: process.env.INTLAYER_CLIENT_ID,
|
|
73
|
+
clientId: process.env.INTLAYER_CLIENT_ID,
|
|
74
74
|
clientSecret: process.env.INTLAYER_CLIENT_SECRET,
|
|
75
75
|
},
|
|
76
76
|
ai: {
|
|
@@ -86,12 +86,12 @@ export default config;
|
|
|
86
86
|
|
|
87
87
|
```bash fileName=".husky/pre-push"
|
|
88
88
|
npx intlayer build # لضمان تحديث القواميس
|
|
89
|
-
npx intlayer fill --unpushed --mode fill # ملء المحتوى المفقود فقط، لا
|
|
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/ar/intlayer_cli.md).
|
|
93
93
|
|
|
94
|
-
> إذا كان لديك عدة تطبيقات في مستودعك تستخدم نسخ منفصلة من intlayer، يمكنك استخدام
|
|
94
|
+
> إذا كان لديك عدة تطبيقات في مستودعك تستخدم نسخ منفصلة من intlayer، يمكنك استخدام الوسيط `--base-dir` كما يلي:
|
|
95
95
|
|
|
96
96
|
```bash fileName=".husky/pre-push"
|
|
97
97
|
# التطبيق 1
|
|
@@ -105,63 +105,87 @@ npx intlayer fill --base-dir ./app2 --unpushed --mode fill
|
|
|
105
105
|
|
|
106
106
|
## استخدام GitHub Actions
|
|
107
107
|
|
|
108
|
-
توفر Intlayer أمر CLI لملء محتوى القاموس
|
|
108
|
+
توفر Intlayer أمر CLI لملء ومراجعة محتوى القاموس تلقائيًا. يمكن دمج هذا في سير عمل CI/CD الخاص بك باستخدام GitHub Actions.
|
|
109
109
|
|
|
110
110
|
```yaml fileName=".github/workflows/intlayer-translate.yml"
|
|
111
|
-
name:
|
|
111
|
+
name: تعبئة Intlayer تلقائيًا
|
|
112
|
+
# شروط تشغيل هذا سير العمل
|
|
112
113
|
on:
|
|
113
|
-
push:
|
|
114
|
-
branches: [ main ]
|
|
115
|
-
paths:
|
|
116
|
-
- 'src/**'
|
|
117
114
|
pull_request:
|
|
118
|
-
branches:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
branches:
|
|
116
|
+
- "main"
|
|
117
|
+
|
|
118
|
+
permissions:
|
|
119
|
+
contents: write
|
|
120
|
+
pull-requests: write
|
|
122
121
|
|
|
123
122
|
concurrency:
|
|
124
|
-
group:
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
|
|
137
|
-
|
|
136
|
+
# الخطوة 1: جلب أحدث كود من المستودع
|
|
137
|
+
- name: ⬇️ سحب المستودع
|
|
138
|
+
uses: actions/checkout@v4
|
|
138
139
|
with:
|
|
139
|
-
persist-credentials: true
|
|
140
|
+
persist-credentials: true # الاحتفاظ بالاعتمادات لإنشاء طلبات السحب
|
|
141
|
+
fetch-depth: 0 # الحصول على كامل تاريخ git لتحليل الفروقات
|
|
140
142
|
|
|
143
|
+
# الخطوة 2: إعداد بيئة Node.js
|
|
141
144
|
- name: 🟢 إعداد Node.js
|
|
142
|
-
uses: actions/setup-node@
|
|
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
|
|
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
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
161
|
+
# الخطوة 6: استخدام الذكاء الاصطناعي لملء الترجمات الناقصة تلقائيًا
|
|
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: ملء تلقائي للترجمات المفقودة [تخطي CI]"
|
|
183
|
+
git push origin HEAD:${{ github.head_ref }}
|
|
162
184
|
```
|
|
163
185
|
|
|
164
|
-
|
|
186
|
+
لإعداد متغيرات البيئة، انتقل إلى GitHub → الإعدادات → الأسرار والمتغيرات → الإجراءات وأضف السر .
|
|
187
|
+
|
|
188
|
+
> كما هو الحال مع Husky، في حالة وجود مستودع أحادي (monorepo)، يمكنك استخدام الوسيطة `--base-dir` لمعالجة كل تطبيق بالتتابع.
|
|
165
189
|
|
|
166
190
|
> بشكل افتراضي، تقوم الوسيطة `--git-diff` بتصفية القواميس التي تتضمن تغييرات من القاعدة (الافتراضية `origin/main`) إلى الفرع الحالي (الافتراضي: `HEAD`).
|
|
167
191
|
|
|
@@ -169,4 +193,6 @@ jobs:
|
|
|
169
193
|
|
|
170
194
|
## تاريخ الوثيقة
|
|
171
195
|
|
|
172
|
-
|
|
196
|
+
| الإصدار | التاريخ | التغييرات |
|
|
197
|
+
| ------- | ---------- | --------- |
|
|
198
|
+
| 5.5.10 | 2025-06-29 | بدء السجل |
|
package/docs/de/CI_CD.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-05-20
|
|
3
|
-
updatedAt: 2025-
|
|
3
|
+
updatedAt: 2025-08-13
|
|
4
4
|
title: CI/CD-Integration
|
|
5
5
|
description: Erfahren Sie, wie Sie Intlayer in Ihre CI/CD-Pipeline für automatisiertes Content-Management und Deployment integrieren.
|
|
6
6
|
keywords:
|
|
@@ -19,11 +19,11 @@ slugs:
|
|
|
19
19
|
|
|
20
20
|
# Automatische Generierung von Übersetzungen in einer CI/CD-Pipeline
|
|
21
21
|
|
|
22
|
-
Intlayer ermöglicht die automatische Generierung von Übersetzungen für Ihre Content-Deklarationsdateien. Es gibt verschiedene Möglichkeiten, dies je nach Ihrem Workflow zu
|
|
22
|
+
Intlayer ermöglicht die automatische Generierung von Übersetzungen für Ihre Content-Deklarationsdateien. Es gibt verschiedene Möglichkeiten, dies je nach Ihrem Workflow zu realisieren.
|
|
23
23
|
|
|
24
24
|
## Verwendung des CMS
|
|
25
25
|
|
|
26
|
-
Mit Intlayer können Sie einen Workflow
|
|
26
|
+
Mit Intlayer können Sie einen Workflow verwenden, bei dem nur eine einzige Locale lokal deklariert wird, während alle Übersetzungen remote über das CMS verwaltet werden. Dies ermöglicht es, Inhalte und Übersetzungen vollständig von der Codebasis zu trennen, bietet mehr Flexibilität für Content-Editoren und ermöglicht ein Hot Content Reloading (kein erneutes Bauen der Anwendung erforderlich, um Änderungen anzuwenden).
|
|
27
27
|
|
|
28
28
|
### Beispielkonfiguration
|
|
29
29
|
|
|
@@ -52,7 +52,7 @@ const config: IntlayerConfig = {
|
|
|
52
52
|
export default config;
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
Um mehr über das CMS zu erfahren,
|
|
55
|
+
Um mehr über das CMS zu erfahren, lesen Sie die [offizielle Dokumentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/intlayer_CMS.md).
|
|
56
56
|
|
|
57
57
|
## Verwendung von Husky
|
|
58
58
|
|
|
@@ -85,11 +85,11 @@ export default config;
|
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
```bash fileName=".husky/pre-push"
|
|
88
|
-
npx intlayer build # Um sicherzustellen, dass die Wörterbücher
|
|
89
|
-
npx intlayer fill --unpushed --mode fill #
|
|
88
|
+
npx intlayer build # Um sicherzustellen, dass die Wörterbücher auf dem neuesten Stand sind
|
|
89
|
+
npx intlayer fill --unpushed --mode fill # Nur fehlende Inhalte ausfüllen, bestehende nicht aktualisieren
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
> Für weitere Informationen zu den Intlayer
|
|
92
|
+
> Für weitere Informationen zu den Intlayer CLI-Befehlen und deren Verwendung siehe die [CLI-Dokumentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/intlayer_cli.md).
|
|
93
93
|
|
|
94
94
|
> Wenn Sie mehrere Apps in Ihrem Repository haben, die separate Intlayer-Instanzen verwenden, können Sie das Argument `--base-dir` wie folgt verwenden:
|
|
95
95
|
|
|
@@ -105,68 +105,94 @@ npx intlayer fill --base-dir ./app2 --unpushed --mode fill
|
|
|
105
105
|
|
|
106
106
|
## Verwendung von GitHub Actions
|
|
107
107
|
|
|
108
|
-
Intlayer
|
|
108
|
+
Intlayer bietet einen CLI-Befehl zum automatischen Ausfüllen und Überprüfen von Wörterbuchinhalten. Dies kann in Ihren CI/CD-Workflow mit GitHub Actions integriert werden.
|
|
109
109
|
|
|
110
110
|
```yaml fileName=".github/workflows/intlayer-translate.yml"
|
|
111
111
|
name: Intlayer Auto-Fill
|
|
112
|
+
# Auslöserbedingungen für diesen Workflow
|
|
112
113
|
on:
|
|
113
|
-
push:
|
|
114
|
-
branches: [ main ]
|
|
115
|
-
paths:
|
|
116
|
-
- 'src/**'
|
|
117
114
|
pull_request:
|
|
118
|
-
branches:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
branches:
|
|
116
|
+
- "main"
|
|
117
|
+
|
|
118
|
+
permissions:
|
|
119
|
+
contents: write
|
|
120
|
+
pull-requests: write
|
|
122
121
|
|
|
123
122
|
concurrency:
|
|
124
|
-
group:
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
+
# Schritt 1: Hole den neuesten Code aus dem Repository
|
|
136
137
|
- name: ⬇️ Repository auschecken
|
|
137
|
-
uses: actions/checkout@
|
|
138
|
+
uses: actions/checkout@v4
|
|
138
139
|
with:
|
|
139
|
-
persist-credentials: true
|
|
140
|
+
persist-credentials: true # Anmeldeinformationen zum Erstellen von PRs beibehalten
|
|
141
|
+
fetch-depth: 0 # Vollständige Git-Historie für Differenzanalyse abrufen
|
|
140
142
|
|
|
143
|
+
# Schritt 2: Node.js-Umgebung einrichten
|
|
141
144
|
- name: 🟢 Node.js einrichten
|
|
142
|
-
uses: actions/setup-node@
|
|
145
|
+
uses: actions/setup-node@v4
|
|
143
146
|
with:
|
|
144
|
-
node-version: 20
|
|
147
|
+
node-version: 20 # Node.js 20 LTS für Stabilität verwenden
|
|
145
148
|
|
|
149
|
+
# Schritt 3: Projektabhängigkeiten installieren
|
|
146
150
|
- name: 📦 Abhängigkeiten installieren
|
|
147
|
-
run: npm
|
|
151
|
+
run: npm install
|
|
152
|
+
|
|
153
|
+
# Schritt 4: Intlayer CLI global für Übersetzungsmanagement installieren
|
|
154
|
+
- name: 📦 Intlayer installieren
|
|
155
|
+
run: npm install -g intlayer-cli
|
|
148
156
|
|
|
157
|
+
# Schritt 5: Intlayer-Projekt bauen, um Übersetzungsdateien zu generieren
|
|
149
158
|
- name: ⚙️ Intlayer-Projekt bauen
|
|
150
159
|
run: npx intlayer build
|
|
151
160
|
|
|
161
|
+
# Schritt 6: KI verwenden, um fehlende Übersetzungen automatisch auszufüllen
|
|
152
162
|
- name: 🤖 Fehlende Übersetzungen automatisch ausfüllen
|
|
153
|
-
run: npx intlayer fill --git-diff --mode fill
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
run: npx intlayer fill --git-diff --mode fill --provider $AI_PROVIDER --model $AI_MODEL --api-key $AI_API_KEY
|
|
164
|
+
|
|
165
|
+
# Schritt 7: Prüfen, ob Änderungen vorliegen und diese committen
|
|
166
|
+
- name: � Auf Änderungen prüfen
|
|
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
|
+
# Schritt 8: Änderungen committen und pushen, falls vorhanden
|
|
176
|
+
- name: 📤 Änderungen committen und pushen
|
|
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: fehlende Übersetzungen automatisch ausfüllen [skip ci]"
|
|
183
|
+
git push origin HEAD:${{ github.head_ref }}
|
|
162
184
|
```
|
|
163
185
|
|
|
186
|
+
Um die Umgebungsvariablen einzurichten, gehen Sie zu GitHub → Einstellungen → Geheimnisse und Variablen → Aktionen und fügen Sie das Geheimnis hinzu.
|
|
187
|
+
|
|
164
188
|
> Wie bei Husky können Sie im Fall eines Monorepos das Argument `--base-dir` verwenden, um jede App nacheinander zu behandeln.
|
|
165
189
|
|
|
166
190
|
> Standardmäßig filtert das Argument `--git-diff` Wörterbücher, die Änderungen vom Basiszweig (Standard `origin/main`) zum aktuellen Zweig (Standard: `HEAD`) enthalten.
|
|
167
191
|
|
|
168
|
-
> Für weitere Informationen zu den Intlayer
|
|
192
|
+
> Für weitere Informationen zu den Intlayer CLI-Befehlen und deren Verwendung lesen Sie bitte die [CLI-Dokumentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/de/intlayer_cli.md).
|
|
169
193
|
|
|
170
|
-
##
|
|
194
|
+
## Dokumentationshistorie
|
|
171
195
|
|
|
172
|
-
|
|
196
|
+
| Version | Datum | Änderungen |
|
|
197
|
+
| ------- | ---------- | ----------------------- |
|
|
198
|
+
| 5.5.10 | 2025-06-29 | Historie initialisieren |
|
package/docs/en/CI_CD.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-05-20
|
|
3
|
-
updatedAt: 2025-
|
|
3
|
+
updatedAt: 2025-08-13
|
|
4
4
|
title: CI/CD Integration
|
|
5
5
|
description: Learn how to integrate Intlayer into your CI/CD pipeline for automated content management and deployment.
|
|
6
6
|
keywords:
|
|
@@ -109,58 +109,82 @@ Intlayer provides a CLI command to autofill and review dictionary content. This
|
|
|
109
109
|
|
|
110
110
|
```yaml fileName=".github/workflows/intlayer-translate.yml"
|
|
111
111
|
name: Intlayer Auto-Fill
|
|
112
|
+
# Trigger conditions for this workflow
|
|
112
113
|
on:
|
|
113
|
-
push:
|
|
114
|
-
branches: [ main ]
|
|
115
|
-
paths:
|
|
116
|
-
- 'src/**'
|
|
117
114
|
pull_request:
|
|
118
|
-
branches:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
branches:
|
|
116
|
+
- "main"
|
|
117
|
+
|
|
118
|
+
permissions:
|
|
119
|
+
contents: write
|
|
120
|
+
pull-requests: write
|
|
122
121
|
|
|
123
122
|
concurrency:
|
|
124
|
-
group:
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
+
# Step 1: Get the latest code from the repository
|
|
136
137
|
- name: ⬇️ Checkout repository
|
|
137
|
-
uses: actions/checkout@
|
|
138
|
+
uses: actions/checkout@v4
|
|
138
139
|
with:
|
|
139
|
-
persist-credentials: true
|
|
140
|
+
persist-credentials: true # Keep credentials for creating PRs
|
|
141
|
+
fetch-depth: 0 # Get full git history for diff analysis
|
|
140
142
|
|
|
143
|
+
# Step 2: Set up Node.js environment
|
|
141
144
|
- name: 🟢 Set up Node.js
|
|
142
|
-
uses: actions/setup-node@
|
|
145
|
+
uses: actions/setup-node@v4
|
|
143
146
|
with:
|
|
144
|
-
node-version: 20
|
|
147
|
+
node-version: 20 # Use Node.js 20 LTS for stability
|
|
145
148
|
|
|
149
|
+
# Step 3: Install project dependencies
|
|
146
150
|
- name: 📦 Install dependencies
|
|
147
|
-
run: npm
|
|
151
|
+
run: npm install
|
|
152
|
+
|
|
153
|
+
# Step 4: Install Intlayer CLI globally for translation management
|
|
154
|
+
- name: 📦 Install Intlayer
|
|
155
|
+
run: npm install -g intlayer-cli
|
|
148
156
|
|
|
157
|
+
# Step 5: Build the Intlayer project to generate translation files
|
|
149
158
|
- name: ⚙️ Build Intlayer project
|
|
150
159
|
run: npx intlayer build
|
|
151
160
|
|
|
161
|
+
# Step 6: Use AI to automatically fill missing translations
|
|
152
162
|
- name: 🤖 Auto-fill missing translations
|
|
153
|
-
run: npx intlayer fill --git-diff --mode fill
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
run: npx intlayer fill --git-diff --mode fill --provider $AI_PROVIDER --model $AI_MODEL --api-key $AI_API_KEY
|
|
164
|
+
|
|
165
|
+
# Step 7: Check if there are changes and commit them
|
|
166
|
+
- name: � Check for changes
|
|
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
|
+
# Step 8: Commit and push changes if any exist
|
|
176
|
+
- name: 📤 Commit and push changes
|
|
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
|
+
To set up the environment variables, go to GitHub → Settings → Secrets and variables → Actions and add the secret .
|
|
187
|
+
|
|
164
188
|
> Same as for Husky, in the case of a monorepo, you can use the `--base-dir` argument to sequentially treat each app.
|
|
165
189
|
|
|
166
190
|
> By default, the `--git-diff` argument filters dictionaries that include changes from base (default `origin/main`) to current branch (default: `HEAD`).
|
package/docs/en-GB/CI_CD.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
createdAt: 2025-05-20
|
|
3
|
-
updatedAt: 2025-
|
|
3
|
+
updatedAt: 2025-08-13
|
|
4
4
|
title: CI/CD Integration
|
|
5
5
|
description: Learn how to integrate Intlayer into your CI/CD pipeline for automated content management and deployment.
|
|
6
6
|
keywords:
|
|
@@ -8,7 +8,7 @@ keywords:
|
|
|
8
8
|
- Continuous Integration
|
|
9
9
|
- Continuous Deployment
|
|
10
10
|
- Automation
|
|
11
|
-
-
|
|
11
|
+
- Internationalisation
|
|
12
12
|
- Documentation
|
|
13
13
|
- Intlayer
|
|
14
14
|
slugs:
|
|
@@ -64,7 +64,7 @@ You can integrate translation generation into your local Git workflow using [Hus
|
|
|
64
64
|
import { Locales, type IntlayerConfig } from "intlayer";
|
|
65
65
|
|
|
66
66
|
const config: IntlayerConfig = {
|
|
67
|
-
|
|
67
|
+
internationalisation: {
|
|
68
68
|
locales: [Locales.ENGLISH, Locales.SPANISH, Locales.FRENCH],
|
|
69
69
|
requiredLocales: [Locales.ENGLISH], // Optional locales are handled remotely
|
|
70
70
|
defaultLocale: Locales.ENGLISH,
|
|
@@ -109,64 +109,90 @@ Intlayer provides a CLI command to autofill and review dictionary content. This
|
|
|
109
109
|
|
|
110
110
|
```yaml fileName=".github/workflows/intlayer-translate.yml"
|
|
111
111
|
name: Intlayer Auto-Fill
|
|
112
|
+
# Trigger conditions for this workflow
|
|
112
113
|
on:
|
|
113
|
-
push:
|
|
114
|
-
branches: [ main ]
|
|
115
|
-
paths:
|
|
116
|
-
- 'src/**'
|
|
117
114
|
pull_request:
|
|
118
|
-
branches:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
branches:
|
|
116
|
+
- "main"
|
|
117
|
+
|
|
118
|
+
permissions:
|
|
119
|
+
contents: write
|
|
120
|
+
pull-requests: write
|
|
122
121
|
|
|
123
122
|
concurrency:
|
|
124
|
-
group:
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
+
# Step 1: Get the latest code from the repository
|
|
136
137
|
- name: ⬇️ Checkout repository
|
|
137
|
-
uses: actions/checkout@
|
|
138
|
+
uses: actions/checkout@v4
|
|
138
139
|
with:
|
|
139
|
-
persist-credentials: true
|
|
140
|
+
persist-credentials: true # Keep credentials for creating PRs
|
|
141
|
+
fetch-depth: 0 # Get full git history for diff analysis
|
|
140
142
|
|
|
143
|
+
# Step 2: Set up Node.js environment
|
|
141
144
|
- name: 🟢 Set up Node.js
|
|
142
|
-
uses: actions/setup-node@
|
|
145
|
+
uses: actions/setup-node@v4
|
|
143
146
|
with:
|
|
144
|
-
node-version: 20
|
|
147
|
+
node-version: 20 # Use Node.js 20 LTS for stability
|
|
145
148
|
|
|
149
|
+
# Step 3: Install project dependencies
|
|
146
150
|
- name: 📦 Install dependencies
|
|
147
|
-
run: npm
|
|
151
|
+
run: npm install
|
|
152
|
+
|
|
153
|
+
# Step 4: Install Intlayer CLI globally for translation management
|
|
154
|
+
- name: 📦 Install Intlayer
|
|
155
|
+
run: npm install -g intlayer-cli
|
|
148
156
|
|
|
157
|
+
# Step 5: Build the Intlayer project to generate translation files
|
|
149
158
|
- name: ⚙️ Build Intlayer project
|
|
150
159
|
run: npx intlayer build
|
|
151
160
|
|
|
161
|
+
# Step 6: Use AI to automatically fill missing translations
|
|
152
162
|
- name: 🤖 Auto-fill missing translations
|
|
153
|
-
run: npx intlayer fill --git-diff --mode fill
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
run: npx intlayer fill --git-diff --mode fill --provider $AI_PROVIDER --model $AI_MODEL --api-key $AI_API_KEY
|
|
164
|
+
|
|
165
|
+
# Step 7: Check if there are changes and commit them
|
|
166
|
+
- name: � Check for changes
|
|
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
|
+
# Step 8: Commit and push changes if any exist
|
|
176
|
+
- name: 📤 Commit and push changes
|
|
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
|
-
|
|
186
|
+
To set up the environment variables, go to GitHub → Settings → Secrets and variables → Actions and add the secret .
|
|
187
|
+
|
|
188
|
+
> Same as for Husky, in the case of a monorepo, you can use the `--base-dir` argument to sequentially process each app.
|
|
165
189
|
|
|
166
|
-
> By default, the `--git-diff` argument filters dictionaries that include changes from base (default `origin/main`) to current branch (default: `HEAD`).
|
|
190
|
+
> By default, the `--git-diff` argument filters dictionaries that include changes from the base (default `origin/main`) to the current branch (default: `HEAD`).
|
|
167
191
|
|
|
168
192
|
> For more information about Intlayer CLI commands and their usage, refer to the [CLI documentation](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en-GB/intlayer_cli.md).
|
|
169
193
|
|
|
170
194
|
## Doc History
|
|
171
195
|
|
|
172
|
-
|
|
196
|
+
| Version | Date | Changes |
|
|
197
|
+
| ------- | ---------- | --------------- |
|
|
198
|
+
| 5.5.10 | 2025-06-29 | Initial history |
|