From f9abcfd78936c31ac052227e937544c3dcd4126a Mon Sep 17 00:00:00 2001 From: lyzno1 <92089059+lyzno1@users.noreply.github.com> Date: Sat, 9 Aug 2025 16:31:24 +0800 Subject: [PATCH] fix: change i18n workflow trigger mechanism to run in main repository (#23662) --- .../translate-i18n-base-on-english.yml | 18 +++++++++++++----- web/i18n-config/auto-gen-i18n.js | 8 +++++--- web/i18n/de-DE/workflow.ts | 2 ++ web/i18n/es-ES/workflow.ts | 2 ++ web/i18n/fa-IR/workflow.ts | 2 ++ web/i18n/fr-FR/workflow.ts | 2 ++ web/i18n/hi-IN/workflow.ts | 2 ++ web/i18n/it-IT/workflow.ts | 2 ++ web/i18n/ko-KR/workflow.ts | 2 ++ web/i18n/pl-PL/workflow.ts | 2 ++ web/i18n/pt-BR/workflow.ts | 2 ++ web/i18n/ro-RO/workflow.ts | 2 ++ web/i18n/ru-RU/workflow.ts | 2 ++ web/i18n/sl-SI/workflow.ts | 2 ++ web/i18n/th-TH/workflow.ts | 2 ++ web/i18n/tr-TR/workflow.ts | 2 ++ web/i18n/uk-UA/workflow.ts | 2 ++ web/i18n/vi-VN/workflow.ts | 2 ++ web/i18n/zh-Hant/workflow.ts | 2 ++ 19 files changed, 52 insertions(+), 8 deletions(-) diff --git a/.github/workflows/translate-i18n-base-on-english.yml b/.github/workflows/translate-i18n-base-on-english.yml index 1cb9c0967..4b06174ee 100644 --- a/.github/workflows/translate-i18n-base-on-english.yml +++ b/.github/workflows/translate-i18n-base-on-english.yml @@ -1,9 +1,10 @@ name: Check i18n Files and Create PR on: - pull_request: - types: [closed] + push: branches: [main] + paths: + - 'web/i18n/en-US/*.ts' permissions: contents: write @@ -11,7 +12,7 @@ permissions: jobs: check-and-update: - if: github.event.pull_request.merged == true + if: github.repository == 'langgenius/dify' runs-on: ubuntu-latest defaults: run: @@ -19,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 2 # last 2 commits + fetch-depth: 2 token: ${{ secrets.GITHUB_TOKEN }} - name: Check for file changes in i18n/en-US @@ -31,6 +32,13 @@ jobs: echo "Changed files: $changed_files" if [ -n "$changed_files" ]; then echo "FILES_CHANGED=true" >> $GITHUB_ENV + file_args="" + for file in $changed_files; do + filename=$(basename "$file" .ts) + file_args="$file_args --file=$filename" + done + echo "FILE_ARGS=$file_args" >> $GITHUB_ENV + echo "File arguments: $file_args" else echo "FILES_CHANGED=false" >> $GITHUB_ENV fi @@ -55,7 +63,7 @@ jobs: - name: Generate i18n translations if: env.FILES_CHANGED == 'true' - run: pnpm run auto-gen-i18n + run: pnpm run auto-gen-i18n ${{ env.FILE_ARGS }} - name: Create Pull Request if: env.FILES_CHANGED == 'true' diff --git a/web/i18n-config/auto-gen-i18n.js b/web/i18n-config/auto-gen-i18n.js index 9a8e74106..8949a15e5 100644 --- a/web/i18n-config/auto-gen-i18n.js +++ b/web/i18n-config/auto-gen-i18n.js @@ -212,7 +212,9 @@ export default translation // Add command line argument support const isDryRun = process.argv.includes('--dry-run') -const targetFile = process.argv.find(arg => arg.startsWith('--file='))?.split('=')[1] +const targetFiles = process.argv + .filter(arg => arg.startsWith('--file=')) + .map(arg => arg.split('=')[1]) const targetLang = process.argv.find(arg => arg.startsWith('--lang='))?.split('=')[1] // Rate limiting helper @@ -230,8 +232,8 @@ async function main() { .map(file => file.replace(/\.ts$/, '')) // Removed app-debug exclusion, now only skip specific problematic keys - // Filter by target file if specified - const filesToProcess = targetFile ? files.filter(f => f === targetFile) : files + // Filter by target files if specified + const filesToProcess = targetFiles.length > 0 ? files.filter(f => targetFiles.includes(f)) : files const languagesToProcess = targetLang ? [targetLang] : Object.keys(languageKeyMap) console.log(`📁 Files to process: ${filesToProcess.join(', ')}`) diff --git a/web/i18n/de-DE/workflow.ts b/web/i18n/de-DE/workflow.ts index 639e47aa0..7dada3932 100644 --- a/web/i18n/de-DE/workflow.ts +++ b/web/i18n/de-DE/workflow.ts @@ -114,6 +114,8 @@ const translation = { needEndNode: 'Der Endknoten muss hinzugefügt werden.', needAnswerNode: 'Der Antwortknoten muss hinzugefügt werden.', tagBound: 'Anzahl der Apps, die dieses Tag verwenden', + currentWorkflow: 'Aktueller Arbeitsablauf', + currentView: 'Aktuelle Ansicht', }, env: { envPanelTitle: 'Umgebungsvariablen', diff --git a/web/i18n/es-ES/workflow.ts b/web/i18n/es-ES/workflow.ts index e5fd23158..cca0bd3e5 100644 --- a/web/i18n/es-ES/workflow.ts +++ b/web/i18n/es-ES/workflow.ts @@ -114,6 +114,8 @@ const translation = { needEndNode: 'Se debe agregar el nodo Final', addBlock: 'Agregar nodo', tagBound: 'Número de aplicaciones que utilizan esta etiqueta', + currentView: 'Vista actual', + currentWorkflow: 'Flujo de trabajo actual', }, env: { envPanelTitle: 'Variables de Entorno', diff --git a/web/i18n/fa-IR/workflow.ts b/web/i18n/fa-IR/workflow.ts index 982b32b01..04db159c3 100644 --- a/web/i18n/fa-IR/workflow.ts +++ b/web/i18n/fa-IR/workflow.ts @@ -114,6 +114,8 @@ const translation = { needAnswerNode: 'باید گره پاسخ اضافه شود', addBlock: 'نود اضافه کنید', tagBound: 'تعداد برنامه‌هایی که از این برچسب استفاده می‌کنند', + currentView: 'نمای فعلی', + currentWorkflow: 'گردش کار فعلی', }, env: { envPanelTitle: 'متغیرهای محیطی', diff --git a/web/i18n/fr-FR/workflow.ts b/web/i18n/fr-FR/workflow.ts index f75b11a80..ff414dd8d 100644 --- a/web/i18n/fr-FR/workflow.ts +++ b/web/i18n/fr-FR/workflow.ts @@ -114,6 +114,8 @@ const translation = { needAnswerNode: 'Le nœud de réponse doit être ajouté.', addBlock: 'Ajouter un nœud', tagBound: 'Nombre d\'applications utilisant cette étiquette', + currentView: 'Vue actuelle', + currentWorkflow: 'Flux de travail actuel', }, env: { envPanelTitle: 'Variables d\'Environnement', diff --git a/web/i18n/hi-IN/workflow.ts b/web/i18n/hi-IN/workflow.ts index 95a013057..1b113504c 100644 --- a/web/i18n/hi-IN/workflow.ts +++ b/web/i18n/hi-IN/workflow.ts @@ -117,6 +117,8 @@ const translation = { addBlock: 'नोड जोड़ें', needEndNode: 'अंत नोड जोड़ा जाना चाहिए', tagBound: 'इस टैग का उपयोग करने वाले ऐप्स की संख्या', + currentView: 'वर्तमान दृश्य', + currentWorkflow: 'वर्तमान कार्यप्रवाह', }, env: { envPanelTitle: 'पर्यावरण चर', diff --git a/web/i18n/it-IT/workflow.ts b/web/i18n/it-IT/workflow.ts index 98f7bd426..e939f65af 100644 --- a/web/i18n/it-IT/workflow.ts +++ b/web/i18n/it-IT/workflow.ts @@ -118,6 +118,8 @@ const translation = { addBlock: 'Aggiungi nodo', needAnswerNode: 'Deve essere aggiunto il nodo di risposta', tagBound: 'Numero di app che utilizzano questo tag', + currentWorkflow: 'Flusso di lavoro corrente', + currentView: 'Vista corrente', }, env: { envPanelTitle: 'Variabili d\'Ambiente', diff --git a/web/i18n/ko-KR/workflow.ts b/web/i18n/ko-KR/workflow.ts index 2afbc4bfc..bbe4c1de2 100644 --- a/web/i18n/ko-KR/workflow.ts +++ b/web/i18n/ko-KR/workflow.ts @@ -118,6 +118,8 @@ const translation = { needAnswerNode: '답변 노드를 추가해야 합니다.', needEndNode: '종단 노드를 추가해야 합니다.', tagBound: '이 태그를 사용하는 앱 수', + currentView: '현재 보기', + currentWorkflow: '현재 워크플로', }, env: { envPanelTitle: '환경 변수', diff --git a/web/i18n/pl-PL/workflow.ts b/web/i18n/pl-PL/workflow.ts index 468260bc9..c2de2786c 100644 --- a/web/i18n/pl-PL/workflow.ts +++ b/web/i18n/pl-PL/workflow.ts @@ -114,6 +114,8 @@ const translation = { needEndNode: 'Należy dodać węzeł końcowy', needAnswerNode: 'Węzeł odpowiedzi musi zostać dodany', tagBound: 'Liczba aplikacji korzystających z tego tagu', + currentWorkflow: 'Bieżący przepływ pracy', + currentView: 'Bieżący widok', }, env: { envPanelTitle: 'Zmienne Środowiskowe', diff --git a/web/i18n/pt-BR/workflow.ts b/web/i18n/pt-BR/workflow.ts index cc8c14c3b..9e217dd76 100644 --- a/web/i18n/pt-BR/workflow.ts +++ b/web/i18n/pt-BR/workflow.ts @@ -114,6 +114,8 @@ const translation = { needEndNode: 'O nó de Fim deve ser adicionado', needAnswerNode: 'O nó de resposta deve ser adicionado', tagBound: 'Número de aplicativos usando esta tag', + currentView: 'Visualização atual', + currentWorkflow: 'Fluxo de trabalho atual', }, env: { envPanelTitle: 'Variáveis de Ambiente', diff --git a/web/i18n/ro-RO/workflow.ts b/web/i18n/ro-RO/workflow.ts index e95b6e66c..07a2992ed 100644 --- a/web/i18n/ro-RO/workflow.ts +++ b/web/i18n/ro-RO/workflow.ts @@ -114,6 +114,8 @@ const translation = { needAnswerNode: 'Nodul de răspuns trebuie adăugat', needEndNode: 'Nodul de sfârșit trebuie adăugat', tagBound: 'Numărul de aplicații care folosesc acest tag', + currentView: 'Vizualizare curentă', + currentWorkflow: 'Flux de lucru curent', }, env: { envPanelTitle: 'Variabile de Mediu', diff --git a/web/i18n/ru-RU/workflow.ts b/web/i18n/ru-RU/workflow.ts index 0b36e680c..a9bd141c1 100644 --- a/web/i18n/ru-RU/workflow.ts +++ b/web/i18n/ru-RU/workflow.ts @@ -114,6 +114,8 @@ const translation = { needAnswerNode: 'В узел ответа необходимо добавить', needEndNode: 'Узел конца должен быть добавлен', tagBound: 'Количество приложений, использующих этот тег', + currentView: 'Текущий вид', + currentWorkflow: 'Текущий рабочий процесс', }, env: { envPanelTitle: 'Переменные среды', diff --git a/web/i18n/sl-SI/workflow.ts b/web/i18n/sl-SI/workflow.ts index df2b7b515..a77336575 100644 --- a/web/i18n/sl-SI/workflow.ts +++ b/web/i18n/sl-SI/workflow.ts @@ -114,6 +114,8 @@ const translation = { configure: 'Konfiguriraj', inRunMode: 'V načinu izvajanja', tagBound: 'Število aplikacij, ki uporabljajo to oznako', + currentView: 'Trenutni pogled', + currentWorkflow: 'Trenutni potek dela', }, env: { modal: { diff --git a/web/i18n/th-TH/workflow.ts b/web/i18n/th-TH/workflow.ts index 58f889e6b..b5ed9b53e 100644 --- a/web/i18n/th-TH/workflow.ts +++ b/web/i18n/th-TH/workflow.ts @@ -114,6 +114,8 @@ const translation = { addBlock: 'เพิ่มโนด', needEndNode: 'ต้องเพิ่มโหนดจบ', tagBound: 'จำนวนแอปพลิเคชันที่ใช้แท็กนี้', + currentWorkflow: 'เวิร์กโฟลว์ปัจจุบัน', + currentView: 'ปัจจุบัน View', }, env: { envPanelTitle: 'ตัวแปรสภาพแวดล้อม', diff --git a/web/i18n/tr-TR/workflow.ts b/web/i18n/tr-TR/workflow.ts index e66cf3556..3b36788a8 100644 --- a/web/i18n/tr-TR/workflow.ts +++ b/web/i18n/tr-TR/workflow.ts @@ -114,6 +114,8 @@ const translation = { needAnswerNode: 'Cevap düğümü eklenmelidir.', needEndNode: 'Son düğüm eklenmelidir', tagBound: 'Bu etiketi kullanan uygulama sayısı', + currentView: 'Geçerli Görünüm', + currentWorkflow: 'Mevcut İş Akışı', }, env: { envPanelTitle: 'Çevre Değişkenleri', diff --git a/web/i18n/uk-UA/workflow.ts b/web/i18n/uk-UA/workflow.ts index c0aee379d..5effad6b1 100644 --- a/web/i18n/uk-UA/workflow.ts +++ b/web/i18n/uk-UA/workflow.ts @@ -114,6 +114,8 @@ const translation = { needEndNode: 'Необхідно додати кінцевий вузол', needAnswerNode: 'Вузол Відповіді повинен бути доданий', tagBound: 'Кількість додатків, що використовують цей тег', + currentView: 'Поточний вигляд', + currentWorkflow: 'Поточний робочий процес', }, env: { envPanelTitle: 'Змінні середовища', diff --git a/web/i18n/vi-VN/workflow.ts b/web/i18n/vi-VN/workflow.ts index 0d34d7af3..cd3314258 100644 --- a/web/i18n/vi-VN/workflow.ts +++ b/web/i18n/vi-VN/workflow.ts @@ -114,6 +114,8 @@ const translation = { addBlock: 'Thêm Node', needEndNode: 'Nút Kết thúc phải được thêm vào', tagBound: 'Số lượng ứng dụng sử dụng thẻ này', + currentWorkflow: 'Quy trình làm việc hiện tại', + currentView: 'Hiện tại View', }, env: { envPanelTitle: 'Biến Môi Trường', diff --git a/web/i18n/zh-Hant/workflow.ts b/web/i18n/zh-Hant/workflow.ts index 311997769..fe703c7bc 100644 --- a/web/i18n/zh-Hant/workflow.ts +++ b/web/i18n/zh-Hant/workflow.ts @@ -114,6 +114,8 @@ const translation = { exportImage: '匯出圖像', exportJPEG: '匯出為 JPEG', tagBound: '使用此標籤的應用程式數量', + currentView: '當前檢視', + currentWorkflow: '當前工作流程', }, env: { envPanelTitle: '環境變數',