From 2ca6a4dbfbfe446fa196e7781c213cac7d716ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=91=D0=B0=D0=B1?= =?UTF-8?q?=D1=83=D1=88=D0=BA=D0=B8=D0=BD?= Date: Thu, 5 Jun 2025 14:41:50 +0200 Subject: [PATCH] add locales --- .../app/components/Kai/components/ChatInput.tsx | 13 ++++++++----- frontend/app/components/Kai/components/Ideas.tsx | 8 ++++---- .../components/Kai/components/IntroSection.tsx | 4 +++- frontend/app/locales/en.json | 16 +++++++++++++++- frontend/app/locales/es.json | 16 +++++++++++++++- frontend/app/locales/fr.json | 16 +++++++++++++++- frontend/app/locales/ru.json | 16 +++++++++++++++- frontend/app/locales/zh.json | 16 +++++++++++++++- 8 files changed, 90 insertions(+), 15 deletions(-) diff --git a/frontend/app/components/Kai/components/ChatInput.tsx b/frontend/app/components/Kai/components/ChatInput.tsx index aa9fe7512..92bf0c7be 100644 --- a/frontend/app/components/Kai/components/ChatInput.tsx +++ b/frontend/app/components/Kai/components/ChatInput.tsx @@ -4,6 +4,7 @@ import { X, ArrowUp } from 'lucide-react'; import { kaiStore } from '../KaiStore'; import { observer } from 'mobx-react-lite'; import Usage from './Usage'; +import { useTranslation } from 'react-i18next'; function ChatInput({ isLoading, @@ -16,6 +17,7 @@ function ChatInput({ onCancel: () => void; isArea?: boolean; }) { + const { t } = useTranslation(); const inputRef = React.useRef(null); const usage = kaiStore.usage; const limited = usage.percent >= 100; @@ -54,8 +56,8 @@ function ChatInput({ const isReplacing = kaiStore.replacing !== null; const placeholder = limited - ? `You've reached the daily limit for queries, come again tomorrow!` - : 'Ask anything about your product and users...'; + ? t(`You've reached the daily limit for queries, come again tomorrow!`) + : t('Ask anything about your product and users...'); if (isArea) { return (
@@ -100,7 +102,7 @@ function ChatInput({ suffix={ <> {isReplacing ? ( - + ); diff --git a/frontend/app/components/Kai/components/Ideas.tsx b/frontend/app/components/Kai/components/Ideas.tsx index 771849423..289449c2d 100644 --- a/frontend/app/components/Kai/components/Ideas.tsx +++ b/frontend/app/components/Kai/components/Ideas.tsx @@ -25,9 +25,9 @@ function Ideas({ }); const ideas = React.useMemo(() => { const defaultPromptIdeas = [ - 'Top user journeys', - 'Where do users drop off', - 'Failed network requests today', + t('Top user journeys'), + t('Where do users drop off'), + t('Failed network requests today'), ]; const result = suggestedPromptIdeas; const targetSize = 3; @@ -39,7 +39,7 @@ function Ideas({ return (
- {inChat ? 'Suggested Follow-up Questions' : 'Suggested Ideas:'} + {inChat ? t('Suggested Follow-up Questions') : t('Suggested Ideas:')}
{isPending ? (
diff --git a/frontend/app/components/Kai/components/IntroSection.tsx b/frontend/app/components/Kai/components/IntroSection.tsx index 4afc7ed75..4fc455e02 100644 --- a/frontend/app/components/Kai/components/IntroSection.tsx +++ b/frontend/app/components/Kai/components/IntroSection.tsx @@ -1,6 +1,7 @@ import React from 'react'; import ChatInput from './ChatInput'; import Ideas from './Ideas'; +import { useTranslation } from 'react-i18next'; function IntroSection({ onAsk, @@ -15,12 +16,13 @@ function IntroSection({ userName: string; limited?: boolean; }) { + const { t } = useTranslation(); const isLoading = false; return ( <>
- Hey {userName}, how can I help you? + {`${t('Hey')} ${userName}, ${t('how can I help you?')}`}