Skip to content

Commit f9abcfd

Browse files
authored
fix: change i18n workflow trigger mechanism to run in main repository (langgenius#23662)
1 parent 5a0a2b7 commit f9abcfd

19 files changed

Lines changed: 52 additions & 8 deletions

File tree

.github/workflows/translate-i18n-base-on-english.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
name: Check i18n Files and Create PR
22

33
on:
4-
pull_request:
5-
types: [closed]
4+
push:
65
branches: [main]
6+
paths:
7+
- 'web/i18n/en-US/*.ts'
78

89
permissions:
910
contents: write
1011
pull-requests: write
1112

1213
jobs:
1314
check-and-update:
14-
if: github.event.pull_request.merged == true
15+
if: github.repository == 'langgenius/dify'
1516
runs-on: ubuntu-latest
1617
defaults:
1718
run:
1819
working-directory: web
1920
steps:
2021
- uses: actions/checkout@v4
2122
with:
22-
fetch-depth: 2 # last 2 commits
23+
fetch-depth: 2
2324
token: ${{ secrets.GITHUB_TOKEN }}
2425

2526
- name: Check for file changes in i18n/en-US
@@ -31,6 +32,13 @@ jobs:
3132
echo "Changed files: $changed_files"
3233
if [ -n "$changed_files" ]; then
3334
echo "FILES_CHANGED=true" >> $GITHUB_ENV
35+
file_args=""
36+
for file in $changed_files; do
37+
filename=$(basename "$file" .ts)
38+
file_args="$file_args --file=$filename"
39+
done
40+
echo "FILE_ARGS=$file_args" >> $GITHUB_ENV
41+
echo "File arguments: $file_args"
3442
else
3543
echo "FILES_CHANGED=false" >> $GITHUB_ENV
3644
fi
@@ -55,7 +63,7 @@ jobs:
5563

5664
- name: Generate i18n translations
5765
if: env.FILES_CHANGED == 'true'
58-
run: pnpm run auto-gen-i18n
66+
run: pnpm run auto-gen-i18n ${{ env.FILE_ARGS }}
5967

6068
- name: Create Pull Request
6169
if: env.FILES_CHANGED == 'true'

web/i18n-config/auto-gen-i18n.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ export default translation
212212

213213
// Add command line argument support
214214
const isDryRun = process.argv.includes('--dry-run')
215-
const targetFile = process.argv.find(arg => arg.startsWith('--file='))?.split('=')[1]
215+
const targetFiles = process.argv
216+
.filter(arg => arg.startsWith('--file='))
217+
.map(arg => arg.split('=')[1])
216218
const targetLang = process.argv.find(arg => arg.startsWith('--lang='))?.split('=')[1]
217219

218220
// Rate limiting helper
@@ -230,8 +232,8 @@ async function main() {
230232
.map(file => file.replace(/\.ts$/, ''))
231233
// Removed app-debug exclusion, now only skip specific problematic keys
232234

233-
// Filter by target file if specified
234-
const filesToProcess = targetFile ? files.filter(f => f === targetFile) : files
235+
// Filter by target files if specified
236+
const filesToProcess = targetFiles.length > 0 ? files.filter(f => targetFiles.includes(f)) : files
235237
const languagesToProcess = targetLang ? [targetLang] : Object.keys(languageKeyMap)
236238

237239
console.log(`📁 Files to process: ${filesToProcess.join(', ')}`)

web/i18n/de-DE/workflow.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ const translation = {
114114
needEndNode: 'Der Endknoten muss hinzugefügt werden.',
115115
needAnswerNode: 'Der Antwortknoten muss hinzugefügt werden.',
116116
tagBound: 'Anzahl der Apps, die dieses Tag verwenden',
117+
currentWorkflow: 'Aktueller Arbeitsablauf',
118+
currentView: 'Aktuelle Ansicht',
117119
},
118120
env: {
119121
envPanelTitle: 'Umgebungsvariablen',

web/i18n/es-ES/workflow.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ const translation = {
114114
needEndNode: 'Se debe agregar el nodo Final',
115115
addBlock: 'Agregar nodo',
116116
tagBound: 'Número de aplicaciones que utilizan esta etiqueta',
117+
currentView: 'Vista actual',
118+
currentWorkflow: 'Flujo de trabajo actual',
117119
},
118120
env: {
119121
envPanelTitle: 'Variables de Entorno',

web/i18n/fa-IR/workflow.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ const translation = {
114114
needAnswerNode: 'باید گره پاسخ اضافه شود',
115115
addBlock: 'نود اضافه کنید',
116116
tagBound: 'تعداد برنامه‌هایی که از این برچسب استفاده می‌کنند',
117+
currentView: 'نمای فعلی',
118+
currentWorkflow: 'گردش کار فعلی',
117119
},
118120
env: {
119121
envPanelTitle: 'متغیرهای محیطی',

web/i18n/fr-FR/workflow.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ const translation = {
114114
needAnswerNode: 'Le nœud de réponse doit être ajouté.',
115115
addBlock: 'Ajouter un nœud',
116116
tagBound: 'Nombre d\'applications utilisant cette étiquette',
117+
currentView: 'Vue actuelle',
118+
currentWorkflow: 'Flux de travail actuel',
117119
},
118120
env: {
119121
envPanelTitle: 'Variables d\'Environnement',

web/i18n/hi-IN/workflow.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ const translation = {
117117
addBlock: 'नोड जोड़ें',
118118
needEndNode: 'अंत नोड जोड़ा जाना चाहिए',
119119
tagBound: 'इस टैग का उपयोग करने वाले ऐप्स की संख्या',
120+
currentView: 'वर्तमान दृश्य',
121+
currentWorkflow: 'वर्तमान कार्यप्रवाह',
120122
},
121123
env: {
122124
envPanelTitle: 'पर्यावरण चर',

web/i18n/it-IT/workflow.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ const translation = {
118118
addBlock: 'Aggiungi nodo',
119119
needAnswerNode: 'Deve essere aggiunto il nodo di risposta',
120120
tagBound: 'Numero di app che utilizzano questo tag',
121+
currentWorkflow: 'Flusso di lavoro corrente',
122+
currentView: 'Vista corrente',
121123
},
122124
env: {
123125
envPanelTitle: 'Variabili d\'Ambiente',

web/i18n/ko-KR/workflow.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ const translation = {
118118
needAnswerNode: '답변 노드를 추가해야 합니다.',
119119
needEndNode: '종단 노드를 추가해야 합니다.',
120120
tagBound: '이 태그를 사용하는 앱 수',
121+
currentView: '현재 보기',
122+
currentWorkflow: '현재 워크플로',
121123
},
122124
env: {
123125
envPanelTitle: '환경 변수',

web/i18n/pl-PL/workflow.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ const translation = {
114114
needEndNode: 'Należy dodać węzeł końcowy',
115115
needAnswerNode: 'Węzeł odpowiedzi musi zostać dodany',
116116
tagBound: 'Liczba aplikacji korzystających z tego tagu',
117+
currentWorkflow: 'Bieżący przepływ pracy',
118+
currentView: 'Bieżący widok',
117119
},
118120
env: {
119121
envPanelTitle: 'Zmienne Środowiskowe',

0 commit comments

Comments
 (0)