From a0845b37c92f57fab2c804e75d20533e6c224b6e Mon Sep 17 00:00:00 2001 From: yangdx Date: Mon, 24 Mar 2025 17:04:31 +0800 Subject: [PATCH] Add translations for API Key Alert component --- lightrag_webui/src/components/ApiKeyAlert.tsx | 10 ++++++---- lightrag_webui/src/locales/ar.json | 6 ++++++ lightrag_webui/src/locales/en.json | 6 ++++++ lightrag_webui/src/locales/fr.json | 6 ++++++ lightrag_webui/src/locales/zh.json | 6 ++++++ 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/lightrag_webui/src/components/ApiKeyAlert.tsx b/lightrag_webui/src/components/ApiKeyAlert.tsx index 99a1098b..bbbce1bb 100644 --- a/lightrag_webui/src/components/ApiKeyAlert.tsx +++ b/lightrag_webui/src/components/ApiKeyAlert.tsx @@ -1,4 +1,5 @@ import { useState, useCallback, useEffect } from 'react' +import { useTranslation } from 'react-i18next' import { AlertDialog, AlertDialogContent, @@ -18,6 +19,7 @@ interface ApiKeyAlertProps { } const ApiKeyAlert = ({ open: opened, onOpenChange: setOpened }: ApiKeyAlertProps) => { + const { t } = useTranslation() const apiKey = useSettingsStore.use.apiKey() const [tempApiKey, setTempApiKey] = useState('') const message = useBackendState.use.message() @@ -50,9 +52,9 @@ const ApiKeyAlert = ({ open: opened, onOpenChange: setOpened }: ApiKeyAlertProps - API Key is required + {t('apiKeyAlert.title')} - Please enter your API key to access the service + {t('apiKeyAlert.description')}
@@ -61,13 +63,13 @@ const ApiKeyAlert = ({ open: opened, onOpenChange: setOpened }: ApiKeyAlertProps type="password" value={tempApiKey} onChange={handleTempApiKeyChange} - placeholder="Enter your API key" + placeholder={t('apiKeyAlert.placeholder')} className="max-h-full w-full min-w-0" autoComplete="off" /> {message && ( diff --git a/lightrag_webui/src/locales/ar.json b/lightrag_webui/src/locales/ar.json index 9205aa5a..dc0cb9bb 100644 --- a/lightrag_webui/src/locales/ar.json +++ b/lightrag_webui/src/locales/ar.json @@ -259,5 +259,11 @@ }, "apiSite": { "loading": "جارٍ تحميل وثائق واجهة برمجة التطبيقات..." + }, + "apiKeyAlert": { + "title": "مفتاح واجهة برمجة التطبيقات مطلوب", + "description": "الرجاء إدخال مفتاح واجهة برمجة التطبيقات للوصول إلى الخدمة", + "placeholder": "أدخل مفتاح واجهة برمجة التطبيقات", + "save": "حفظ" } } diff --git a/lightrag_webui/src/locales/en.json b/lightrag_webui/src/locales/en.json index 88840da3..dfca64d2 100644 --- a/lightrag_webui/src/locales/en.json +++ b/lightrag_webui/src/locales/en.json @@ -274,5 +274,11 @@ }, "apiSite": { "loading": "Loading API Documentation..." + }, + "apiKeyAlert": { + "title": "API Key is required", + "description": "Please enter your API key to access the service", + "placeholder": "Enter your API key", + "save": "Save" } } diff --git a/lightrag_webui/src/locales/fr.json b/lightrag_webui/src/locales/fr.json index 889f7f97..91fba43b 100644 --- a/lightrag_webui/src/locales/fr.json +++ b/lightrag_webui/src/locales/fr.json @@ -259,5 +259,11 @@ }, "apiSite": { "loading": "Chargement de la documentation de l'API..." + }, + "apiKeyAlert": { + "title": "Clé API requise", + "description": "Veuillez entrer votre clé API pour accéder au service", + "placeholder": "Entrez votre clé API", + "save": "Sauvegarder" } } diff --git a/lightrag_webui/src/locales/zh.json b/lightrag_webui/src/locales/zh.json index 6fabd392..07e34c50 100644 --- a/lightrag_webui/src/locales/zh.json +++ b/lightrag_webui/src/locales/zh.json @@ -259,5 +259,11 @@ }, "apiSite": { "loading": "正在加载 API 文档..." + }, + "apiKeyAlert": { + "title": "需要 API Key", + "description": "请输入您的 API Key 以访问服务", + "placeholder": "请输入 API Key", + "save": "保存" } }