From 8152bc6fbfd933841a92164b3a42dd35af880eb6 Mon Sep 17 00:00:00 2001 From: crazywoola <100913391+crazywoola@users.noreply.github.com> Date: Mon, 27 May 2024 10:36:34 +0800 Subject: [PATCH] Feat/upgrade check i18n scripts (#4671) --- web/i18n/de-DE/workflow.ts | 18 +++++ web/i18n/fr-FR/workflow.ts | 15 +++++ web/i18n/ja-JP/workflow.ts | 15 +++++ web/i18n/ko-KR/workflow.ts | 5 ++ web/i18n/language.ts | 123 +---------------------------------- web/i18n/languages.json | 123 +++++++++++++++++++++++++++++++++++ web/i18n/pl-PL/workflow.ts | 10 +++ web/i18n/pt-BR/workflow.ts | 15 +++++ web/i18n/ro-RO/workflow.ts | 11 ++++ web/i18n/script.js | 3 +- web/i18n/uk-UA/workflow.ts | 15 +++++ web/i18n/vi-VN/workflow.ts | 16 +++++ web/i18n/zh-Hant/workflow.ts | 23 +++++++ 13 files changed, 270 insertions(+), 122 deletions(-) create mode 100644 web/i18n/languages.json diff --git a/web/i18n/de-DE/workflow.ts b/web/i18n/de-DE/workflow.ts index e044d1fd6f..eeda34f57f 100644 --- a/web/i18n/de-DE/workflow.ts +++ b/web/i18n/de-DE/workflow.ts @@ -46,6 +46,20 @@ const translation = { content: 'Die Variable wird in anderen Knoten verwendet. Möchten Sie sie trotzdem entfernen?', }, insertVarTip: 'Drücken Sie die \'/\' Taste, um schnell einzufügen', + processData: 'Daten verarbeiten', + input: 'Eingabe', + output: 'Ausgabe', + jinjaEditorPlaceholder: 'Tippen Sie \'/\' oder \'{\' um eine Variable einzufügen', + viewOnly: 'Nur Ansicht', + showRunHistory: 'Ausführungsverlauf anzeigen', + enableJinja: 'Jinja-Template-Unterstützung aktivieren', + learnMore: 'Mehr erfahren', + copy: 'Kopieren', + duplicate: 'Duplizieren', + addBlock: 'Block hinzufügen', + pasteHere: 'Hier einfügen', + pointerMode: 'Zeigermodus', + handMode: 'Handmodus', }, errorMsg: { fieldRequired: '{{field}} wird benötigt', @@ -201,6 +215,7 @@ const translation = { singleRun: { variable: 'Variable', }, + sysQueryInUser: 'sys.query in der Benutzeranfrage ist erforderlich', }, knowledgeRetrieval: { queryVariable: 'Abfragevariable', @@ -258,6 +273,9 @@ const translation = { code: { inputVars: 'Eingabevariablen', outputVars: 'Ausgabevariablen', + advancedDependencies: 'Erweiterte Abhängigkeiten', + advancedDependenciesTip: 'Fügen Sie einige vorab geladene Abhängigkeiten hinzu, die mehr Zeit benötigen oder hier nicht standardmäßig integriert sind', + searchDependencies: 'Abhängigkeiten suchen', }, templateTransform: { inputVars: 'Eingabevariablen', diff --git a/web/i18n/fr-FR/workflow.ts b/web/i18n/fr-FR/workflow.ts index ad7b64bfff..721f27a446 100644 --- a/web/i18n/fr-FR/workflow.ts +++ b/web/i18n/fr-FR/workflow.ts @@ -49,6 +49,17 @@ const translation = { processData: 'Traiter les données', input: 'Entrée', output: 'Sortie', + jinjaEditorPlaceholder: 'Tapez \'/\' ou \'{\' pour insérer une variable', + viewOnly: 'Vue Seulement', + showRunHistory: 'Afficher l\'Historique des Exécutions', + enableJinja: 'Activer le support des modèles Jinja', + learnMore: 'En Savoir Plus', + copy: 'Copier', + duplicate: 'Dupliquer', + addBlock: 'Ajouter un Bloc', + pasteHere: 'Coller Ici', + pointerMode: 'Mode Pointeur', + handMode: 'Mode Main', }, errorMsg: { fieldRequired: '{{field}} est requis', @@ -204,6 +215,7 @@ const translation = { singleRun: { variable: 'Variable', }, + sysQueryInUser: 'sys.query dans l\'entrée utilisateur', }, knowledgeRetrieval: { queryVariable: 'Variable de requête', @@ -261,6 +273,9 @@ const translation = { code: { inputVars: 'Variables d\'entrée', outputVars: 'Variables de sortie', + advancedDependencies: 'Dépendances Avancées', + advancedDependenciesTip: 'Ajoutez ici des dépendances préchargées qui prennent plus de temps à consommer ou qui ne sont pas intégrées par défaut', + searchDependencies: 'Rechercher des Dépendances', }, templateTransform: { inputVars: 'Variables d\'entrée', diff --git a/web/i18n/ja-JP/workflow.ts b/web/i18n/ja-JP/workflow.ts index 1d61a26642..5e549dbf88 100644 --- a/web/i18n/ja-JP/workflow.ts +++ b/web/i18n/ja-JP/workflow.ts @@ -49,6 +49,17 @@ const translation = { processData: 'データ処理', input: '入力', output: '出力', + jinjaEditorPlaceholder: '変数を挿入するには「/」または「{」を入力してください', + viewOnly: '表示のみ', + showRunHistory: '実行履歴を表示', + enableJinja: 'Jinjaテンプレートのサポートを有効にする', + learnMore: '詳細を学ぶ', + copy: 'コピー', + duplicate: '複製', + addBlock: 'ブロックを追加', + pasteHere: 'ここに貼り付け', + pointerMode: 'ポインターモード', + handMode: 'ハンドモード', }, errorMsg: { fieldRequired: '{{field}}は必須です', @@ -204,6 +215,7 @@ const translation = { singleRun: { variable: '変数', }, + sysQueryInUser: 'ユーザーメッセージにsys.queryが必要です', }, knowledgeRetrieval: { queryVariable: 'クエリ変数', @@ -261,6 +273,9 @@ const translation = { code: { inputVars: '入力変数', outputVars: '出力変数', + advancedDependencies: '高度な依存関係', + advancedDependenciesTip: '消費に時間がかかる、またはデフォルトで組み込まれていない事前ロードされた依存関係を追加します', + searchDependencies: '依存関係を検索', }, templateTransform: { inputVars: '入力変数', diff --git a/web/i18n/ko-KR/workflow.ts b/web/i18n/ko-KR/workflow.ts index fbf5ad954e..b6d8d0066d 100644 --- a/web/i18n/ko-KR/workflow.ts +++ b/web/i18n/ko-KR/workflow.ts @@ -49,6 +49,8 @@ const translation = { processData: '데이터 처리', input: '입력', output: '출력', + enableJinja: 'Jinja 템플릿 지원 활성화', + learnMore: '더 알아보기', jinjaEditorPlaceholder: '\'/\' 또는 \'{\'를 입력하여 변수를 삽입하세요.', viewOnly: '보기 모드', showRunHistory: '실행 기록 보기', @@ -271,6 +273,9 @@ const translation = { code: { inputVars: '입력 변수', outputVars: '출력 변수', + advancedDependencies: '고급 종속성', + advancedDependenciesTip: '소비하는 데 시간이 더 걸리거나 기본 내장되지 않은 일부 사전 로드된 종속성을 추가하십시오', + searchDependencies: '종속성 검색', }, templateTransform: { inputVars: '입력 변수', diff --git a/web/i18n/language.ts b/web/i18n/language.ts index a0fc64ecc3..e510369a44 100644 --- a/web/i18n/language.ts +++ b/web/i18n/language.ts @@ -1,3 +1,4 @@ +import data from './languages.json' export type Item = { value: number | string name: string @@ -23,127 +24,7 @@ export type I18nText = { 'pl-PL': string } -export const languages = [ - { - value: 'en-US', - name: 'English (United States)', - prompt_name: 'English', - example: 'Hello, Dify!', - supported: true, - }, - { - value: 'zh-Hans', - name: '简体中文', - prompt_name: 'Chinese Simplified', - example: '你好,Dify!', - supported: true, - }, - { - value: 'zh-Hant', - name: '繁體中文', - prompt_name: 'Chinese Traditional', - example: '你好,Dify!', - supported: true, - }, - { - value: 'pt-BR', - name: 'Português (Brasil)', - prompt_name: 'Portuguese', - example: 'Olá, Dify!', - supported: true, - }, - { - value: 'es-ES', - name: 'Español (España)', - prompt_name: 'Spanish', - example: 'Saluton, Dify!', - supported: false, - }, - { - value: 'fr-FR', - name: 'Français (France)', - prompt_name: 'French', - example: 'Bonjour, Dify!', - supported: true, - }, - { - value: 'de-DE', - name: 'Deutsch (Deutschland)', - prompt_name: 'German', - example: 'Hallo, Dify!', - supported: true, - }, - { - value: 'ja-JP', - name: '日本語 (日本)', - prompt_name: 'Japanese', - example: 'こんにちは、Dify!', - supported: true, - }, - { - value: 'ko-KR', - name: '한국어 (대한민국)', - prompt_name: 'Korean', - example: '안녕하세요, Dify!', - supported: true, - }, - { - value: 'ru-RU', - name: 'Русский (Россия)', - prompt_name: 'Russian', - example: ' Привет, Dify!', - supported: false, - }, - { - value: 'it-IT', - name: 'Italiano (Italia)', - prompt_name: 'Italian', - example: 'Ciao, Dify!', - supported: false, - }, - { - value: 'th-TH', - name: 'ไทย (ประเทศไทย)', - prompt_name: 'Thai', - example: 'สวัสดี Dify!', - supported: false, - }, - { - value: 'id-ID', - name: 'Bahasa Indonesia', - prompt_name: 'Indonesian', - example: 'Saluto, Dify!', - supported: false, - }, - { - value: 'uk-UA', - name: 'Українська (Україна)', - prompt_name: 'Ukrainian', - example: 'Привет, Dify!', - supported: true, - }, - { - value: 'vi-VN', - name: 'Tiếng Việt (Việt Nam)', - prompt_name: 'Vietnamese', - example: 'Xin chào, Dify!', - supported: true, - }, - { - value: 'ro-RO', - name: 'Română (România)', - prompt_name: 'Romanian', - example: 'Salut, Dify!', - supported: true, - }, - { - value: 'pl-PL', - name: 'Polski (Polish)', - prompt_name: 'Polish', - example: 'Cześć, Dify!', - supported: true, - }, -] +export const languages = data.languages export const LanguagesSupported = languages.filter(item => item.supported).map(item => item.value) diff --git a/web/i18n/languages.json b/web/i18n/languages.json new file mode 100644 index 0000000000..2cab7e9703 --- /dev/null +++ b/web/i18n/languages.json @@ -0,0 +1,123 @@ +{ + "languages": [ + { + "value": "en-US", + "name": "English (United States)", + "prompt_name": "English", + "example": "Hello, Dify!", + "supported": true + }, + { + "value": "zh-Hans", + "name": "简体中文", + "prompt_name": "Chinese Simplified", + "example": "你好,Dify!", + "supported": true + }, + { + "value": "zh-Hant", + "name": "繁體中文", + "prompt_name": "Chinese Traditional", + "example": "你好,Dify!", + "supported": true + }, + { + "value": "pt-BR", + "name": "Português (Brasil)", + "prompt_name": "Portuguese", + "example": "Olá, Dify!", + "supported": true + }, + { + "value": "es-ES", + "name": "Español (España)", + "prompt_name": "Spanish", + "example": "Saluton, Dify!", + "supported": false + }, + { + "value": "fr-FR", + "name": "Français (France)", + "prompt_name": "French", + "example": "Bonjour, Dify!", + "supported": true + }, + { + "value": "de-DE", + "name": "Deutsch (Deutschland)", + "prompt_name": "German", + "example": "Hallo, Dify!", + "supported": true + }, + { + "value": "ja-JP", + "name": "日本語 (日本)", + "prompt_name": "Japanese", + "example": "こんにちは、Dify!", + "supported": true + }, + { + "value": "ko-KR", + "name": "한국어 (대한민국)", + "prompt_name": "Korean", + "example": "안녕하세요, Dify!", + "supported": true + }, + { + "value": "ru-RU", + "name": "Русский (Россия)", + "prompt_name": "Russian", + "example": " Привет, Dify!", + "supported": false + }, + { + "value": "it-IT", + "name": "Italiano (Italia)", + "prompt_name": "Italian", + "example": "Ciao, Dify!", + "supported": false + }, + { + "value": "th-TH", + "name": "ไทย (ประเทศไทย)", + "prompt_name": "Thai", + "example": "สวัสดี Dify!", + "supported": false + }, + { + "value": "id-ID", + "name": "Bahasa Indonesia", + "prompt_name": "Indonesian", + "example": "Saluto, Dify!", + "supported": false + }, + { + "value": "uk-UA", + "name": "Українська (Україна)", + "prompt_name": "Ukrainian", + "example": "Привет, Dify!", + "supported": true + }, + { + "value": "vi-VN", + "name": "Tiếng Việt (Việt Nam)", + "prompt_name": "Vietnamese", + "example": "Xin chào, Dify!", + "supported": true + }, + { + "value": "ro-RO", + "name": "Română (România)", + "prompt_name": "Romanian", + "example": "Salut, Dify!", + "supported": true + }, + { + "value": "pl-PL", + "name": "Polski (Polish)", + "prompt_name": "Polish", + "example": "Cześć, Dify!", + "supported": true + } + ] +} diff --git a/web/i18n/pl-PL/workflow.ts b/web/i18n/pl-PL/workflow.ts index c408575840..0d608f03bd 100644 --- a/web/i18n/pl-PL/workflow.ts +++ b/web/i18n/pl-PL/workflow.ts @@ -54,6 +54,12 @@ const translation = { showRunHistory: 'Pokaż Historię Uruchomień', enableJinja: 'Włącz wsparcie dla szablonów Jinja', learnMore: 'Czytaj więcej', + copy: 'Kopiuj', + duplicate: 'Duplikuj', + addBlock: 'Dodaj Blok', + pasteHere: 'Wklej Tutaj', + pointerMode: 'Tryb Wskaźnika', + handMode: 'Tryb Ręczny', }, errorMsg: { fieldRequired: '{{field}} jest wymagane', @@ -267,6 +273,10 @@ const translation = { code: { inputVars: 'Zmienne Wejściowe', outputVars: 'Zmienne Wyjściowe', + advancedDependencies: 'Zaawansowane Zależności', + advancedDependenciesTip: 'Dodaj tutaj niektóre wstępnie załadowane zależności, które wymagają więcej czasu na załadowanie lub nie są domyślnie wbudowane', + searchDependencies: 'Wyszukaj Zależności', + }, templateTransform: { inputVars: 'Zmienne Wejściowe', diff --git a/web/i18n/pt-BR/workflow.ts b/web/i18n/pt-BR/workflow.ts index 57da67fd01..782478c058 100644 --- a/web/i18n/pt-BR/workflow.ts +++ b/web/i18n/pt-BR/workflow.ts @@ -49,6 +49,17 @@ const translation = { processData: 'Processar dados', input: 'Entrada', output: 'Saída', + jinjaEditorPlaceholder: 'Digite \'/\' ou \'{\' para inserir variável', + viewOnly: 'Apenas Visualização', + showRunHistory: 'Mostrar Histórico de Execuções', + enableJinja: 'Ativar suporte a templates Jinja', + learnMore: 'Saiba Mais', + copy: 'Copiar', + duplicate: 'Duplicar', + addBlock: 'Adicionar Bloco', + pasteHere: 'Colar Aqui', + pointerMode: 'Modo Ponteiro', + handMode: 'Modo Manual', }, errorMsg: { fieldRequired: '{{field}} é obrigatório', @@ -204,6 +215,7 @@ const translation = { singleRun: { variable: 'Variável', }, + sysQueryInUser: 'sys.query em user é inválido', }, knowledgeRetrieval: { queryVariable: 'Variável de consulta', @@ -261,6 +273,9 @@ const translation = { code: { inputVars: 'Variáveis de entrada', outputVars: 'Variáveis de saída', + advancedDependencies: 'Dependências Avançadas', + advancedDependenciesTip: 'Adicione algumas dependências pré-carregadas que demoram mais para serem consumidas ou que não são padrão aqui', + searchDependencies: 'Pesquisar Dependências', }, templateTransform: { inputVars: 'Variáveis de entrada', diff --git a/web/i18n/ro-RO/workflow.ts b/web/i18n/ro-RO/workflow.ts index f7069bff9a..9bad48f3fa 100644 --- a/web/i18n/ro-RO/workflow.ts +++ b/web/i18n/ro-RO/workflow.ts @@ -52,6 +52,14 @@ const translation = { jinjaEditorPlaceholder: 'Tastați \'/\' sau \'{\' pentru a insera variabila', viewOnly: 'Doar vizualizare', showRunHistory: 'Afișează istoricul de rulare', + enableJinja: 'Activează suportul pentru șabloane Jinja', + learnMore: 'Află mai multe', + copy: 'Copiază', + duplicate: 'Duplică', + addBlock: 'Adaugă Bloc', + pasteHere: 'Lipește Aici', + pointerMode: 'Mod Indicator', + handMode: 'Mod Manual', }, errorMsg: { fieldRequired: '{{field}} este obligatoriu', @@ -265,6 +273,9 @@ const translation = { code: { inputVars: 'Variabile de intrare', outputVars: 'Variabile de ieșire', + advancedDependencies: 'Dependențe Avansate', + advancedDependenciesTip: 'Adăugați aici unele dependențe preîncărcate care necesită mai mult timp pentru a fi utilizate sau care nu sunt în mod implicit integrate', + searchDependencies: 'Căutați Dependențe', }, templateTransform: { inputVars: 'Variabile de intrare', diff --git a/web/i18n/script.js b/web/i18n/script.js index ee5ae3124d..5af8f466ff 100644 --- a/web/i18n/script.js +++ b/web/i18n/script.js @@ -4,7 +4,8 @@ const path = require('node:path') const transpile = require('typescript').transpile const targetLanguage = 'en-US' -const languages = ['zh-Hans', 'fr-FR', 'ja-JP', 'pt-BR', 'uk-UA', 'vi-VN', 'zh-Hant'] +const data = require('./languages.json') +const languages = data.languages.filter(language => language.supported).map(language => language.value) async function getKeysFromLanuage(language) { return new Promise((resolve, reject) => { diff --git a/web/i18n/uk-UA/workflow.ts b/web/i18n/uk-UA/workflow.ts index 0d7bd8dcbb..524a08bc79 100644 --- a/web/i18n/uk-UA/workflow.ts +++ b/web/i18n/uk-UA/workflow.ts @@ -49,6 +49,17 @@ const translation = { processData: 'Обробка даних', input: 'Вхід', output: 'Вихід', + jinjaEditorPlaceholder: 'Введіть \'/\' або \'{\' щоб вставити змінну', + viewOnly: 'Тільки перегляд', + showRunHistory: 'Показати історію запусків', + enableJinja: 'Увімкнути підтримку шаблонів Jinja', + learnMore: 'Дізнатися більше', + copy: 'Копіювати', + duplicate: 'Дублювати', + addBlock: 'Додати блок', + pasteHere: 'Вставити тут', + pointerMode: 'Режим вказівника', + handMode: 'Режим руки', }, errorMsg: { fieldRequired: '{{field}} є обов\'язковим', @@ -204,6 +215,7 @@ const translation = { singleRun: { variable: 'Змінна', }, + sysQueryInUser: 'sys.query потрібно в повідомленні користувача.', }, knowledgeRetrieval: { queryVariable: 'Запит змінної', @@ -261,6 +273,9 @@ const translation = { code: { inputVars: 'Вхідні змінні', outputVars: 'Вихідні змінні', + advancedDependencies: 'Розширені залежності', + advancedDependenciesTip: 'Додайте деякі попередньо завантажені залежності, які потребують більше часу для використання або не є вбудованими за замовчуванням', + searchDependencies: 'Шукати залежності', }, templateTransform: { inputVars: 'Вхідні змінні', diff --git a/web/i18n/vi-VN/workflow.ts b/web/i18n/vi-VN/workflow.ts index e9e031164e..89b86fc480 100644 --- a/web/i18n/vi-VN/workflow.ts +++ b/web/i18n/vi-VN/workflow.ts @@ -49,6 +49,17 @@ const translation = { processData: 'Xử lý dữ liệu', input: 'Nhập', output: 'Đầu ra', + jinjaEditorPlaceholder: 'Nhập \'/\' hoặc \'{\' để chèn biến', + viewOnly: 'Chỉ Xem', + showRunHistory: 'Hiển Thị Lịch Sử Chạy', + enableJinja: 'Kích Hoạt Hỗ Trợ Mẫu Jinja', + learnMore: 'Tìm Hiểu Thêm', + copy: 'Sao Chép', + duplicate: 'Nhân Bản', + addBlock: 'Thêm Khối', + pasteHere: 'Dán Vào Đây', + pointerMode: 'Chế Độ Con Trỏ', + handMode: 'Chế Độ Tay', }, errorMsg: { fieldRequired: '{{field}} là bắt buộc', @@ -204,6 +215,7 @@ const translation = { singleRun: { variable: 'Biến', }, + sysQueryInUser: 'sys.query được yêu cầu trong tin nhắn người dùng.', }, knowledgeRetrieval: { queryVariable: 'Biến Truy vấn', @@ -261,6 +273,10 @@ const translation = { code: { inputVars: 'Biến đầu vào', outputVars: 'Biến đầu ra', + advancedDependencies: 'Phụ thuộc Nâng cao', + advancedDependenciesTip: 'Thêm một số phụ thuộc đã được tải sẵn cần nhiều thời gian hơn để sử dụng hoặc không được tích hợp sẵn tại đây', + searchDependencies: 'Tìm Kiếm Phụ Thuộc', + }, templateTransform: { inputVars: 'Biến đầu vào', diff --git a/web/i18n/zh-Hant/workflow.ts b/web/i18n/zh-Hant/workflow.ts index 91d4f8b563..0f44902652 100644 --- a/web/i18n/zh-Hant/workflow.ts +++ b/web/i18n/zh-Hant/workflow.ts @@ -49,6 +49,17 @@ const translation = { processData: '資料處理', input: '輸入', output: '輸出', + jinjaEditorPlaceholder: '输入 “/” 或 “{” 插入变量', + viewOnly: '只读', + showRunHistory: '显示运行历史', + enableJinja: '开启支持 Jinja 模板', + learnMore: '了解更多', + copy: '拷贝', + duplicate: '复制', + addBlock: '添加节点', + pasteHere: '粘贴到这里', + pointerMode: '指针模式', + handMode: '手模式', }, errorMsg: { fieldRequired: '{{field}} 不能為空', @@ -249,10 +260,22 @@ const translation = { 'header': 'Header', }, insertVarPlaceholder: '鍵入 \'/\' 鍵快速插入變數', + timeout: { + title: '超时设置', + connectLabel: '连接超时', + connectPlaceholder: '输入连接超时(以秒为单位)', + readLabel: '读取超时', + readPlaceholder: '输入读取超时(以秒为单位)', + writeLabel: '写入超时', + writePlaceholder: '输入写入超时(以秒为单位)', + }, }, code: { inputVars: '輸入變數', outputVars: '輸出變數', + advancedDependencies: '高级依赖', + advancedDependenciesTip: '在这里添加一些预加载需要消耗较多时间或非默认内置的依赖包', + searchDependencies: '搜索依赖', }, templateTransform: { inputVars: '輸入變數',