add locales

This commit is contained in:
Андрей Бабушкин 2025-06-05 14:41:50 +02:00
parent d4193bcbd3
commit 2ca6a4dbfb
8 changed files with 90 additions and 15 deletions

View file

@ -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<typeof Input>(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 (
<div className="relative">
@ -100,7 +102,7 @@ function ChatInput({
suffix={
<>
{isReplacing ? (
<Tooltip title={'Cancel Editing'}>
<Tooltip title={t('Cancel Editing')}>
<Button
onClick={cancelReplace}
icon={<X className="reset" size={16} />}
@ -137,8 +139,9 @@ function SendButton({
limited: boolean;
isProcessing?: boolean;
}) {
const { t } = useTranslation();
return (
<Tooltip title={isProcessing ? 'Cancel processing' : 'Send message'}>
<Tooltip title={isProcessing ? t('Cancel processing') : t('Send message')}>
<Button
loading={isLoading}
onClick={submit}
@ -158,7 +161,7 @@ function SendButton({
iconPosition={'end'}
className="font-semibold text-[#fff]"
>
{isProcessing ? null : 'Ask'}
{isProcessing ? null : t('Ask')}
</Button>
</Tooltip>
);

View file

@ -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 (
<div>
<div className={'flex items-center gap-2 mb-1 text-gray-dark'}>
<b>{inChat ? 'Suggested Follow-up Questions' : 'Suggested Ideas:'}</b>
<b>{inChat ? t('Suggested Follow-up Questions') : t('Suggested Ideas:')}</b>
</div>
{isPending ? (
<div className="animate-pulse text-disabled-text">

View file

@ -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 (
<>
<div className={'relative w-2/3 flex flex-col gap-4'}>
<div className="font-semibold text-lg">
Hey {userName}, how can I help you?
{`${t('Hey')} ${userName}, ${t('how can I help you?')}`}
</div>
<ChatInput
onCancel={onCancel}

View file

@ -1501,5 +1501,19 @@
"Include rage clicks": "Include rage clicks",
"Interface Language": "Interface Language",
"Select the language in which OpenReplay will appear.": "Select the language in which OpenReplay will appear.",
"Language": "Language"
"Language": "Language",
"Top user journeys": "Top user journeys",
"Where do users drop off": "Where do users drop off",
"Failed network requests today": "Failed network requests today",
"Suggested Follow-up Questions": "Suggested Follow-up Questions",
"Suggested Ideas:": "Suggested Ideas:",
"Generating ideas": "Generating ideas",
"You've reached the daily limit for queries, come again tomorrow!": "You've reached the daily limit for queries, come again tomorrow!",
"Ask anything about your product and users...": "Ask anything about your product and users...",
"Cancel Editing": "Cancel Editing",
"Cancel processing": "Cancel processing",
"Send message": "Send message",
"Hey": "Hey",
"how can I help you?": "how can I help you?",
"Ask": "Ask"
}

View file

@ -1501,5 +1501,19 @@
"Include rage clicks": "Incluir clics de ira",
"Interface Language": "Idioma de la interfaz",
"Select the language in which OpenReplay will appear.": "Selecciona el idioma en el que aparecerá OpenReplay.",
"Language": "Idioma"
"Language": "Idioma",
"Top user journeys": "Principales recorridos de usuario",
"Where do users drop off": "Dónde abandonan los usuarios",
"Failed network requests today": "Solicitudes de red fallidas hoy",
"Suggested Follow-up Questions": "Preguntas de seguimiento sugeridas",
"Suggested Ideas:": "Ideas sugeridas:",
"Generating ideas": "Generando ideas",
"You've reached the daily limit for queries, come again tomorrow!": "Has alcanzado el límite diario de consultas, ¡vuelve mañana!",
"Ask anything about your product and users...": "Pregunta cualquier cosa sobre tu producto y usuarios...",
"Cancel Editing": "Cancelar edición",
"Cancel processing": "Cancelar procesamiento",
"Send message": "Enviar mensaje",
"Hey": "¿Hola",
"how can I help you?": "cómo puedo ayudarte?",
"Ask": "Preguntar"
}

View file

@ -1501,5 +1501,19 @@
"Include rage clicks": "Inclure les clics de rage",
"Interface Language": "Langue de l'interface",
"Select the language in which OpenReplay will appear.": "Sélectionnez la langue dans laquelle OpenReplay apparaîtra.",
"Language": "Langue"
"Language": "Langue",
"Top user journeys": "Parcours utilisateur principaux",
"Where do users drop off": "Où les utilisateurs abandonnent-ils",
"Failed network requests today": "Requêtes réseau échouées aujourdhui",
"Suggested Follow-up Questions": "Questions de suivi suggérées",
"Suggested Ideas:": "Idées suggérées :",
"Generating ideas": "Génération didées",
"You've reached the daily limit for queries, come again tomorrow!": "Vous avez atteint la limite quotidienne de requêtes, revenez demain !",
"Ask anything about your product and users...": "Posez une question sur votre produit et vos utilisateurs...",
"Cancel Editing": "Annuler la modification",
"Cancel processing": "Annuler le traitement",
"Send message": "Envoyer le message",
"Hey": "Salut",
"how can I help you?": "comment puis-je vous aider?",
"Ask": "Demander"
}

View file

@ -1501,5 +1501,19 @@
"Include rage clicks": "Включить невыносимые клики",
"Interface Language": "Язык интерфейса",
"Select the language in which OpenReplay will appear.": "Выберите язык, на котором будет отображаться OpenReplay.",
"Language": "Язык"
"Language": "Язык",
"Top user journeys": "Основные пользовательские сценарии",
"Where do users drop off": "Где пользователи покидают процесс",
"Failed network requests today": "Неудачные сетевые запросы сегодня",
"Suggested Follow-up Questions": "Рекомендуемые дополнительные вопросы",
"Suggested Ideas:": "Предложенные идеи:",
"Generating ideas": "Генерация идей",
"You've reached the daily limit for queries, come again tomorrow!": "Вы достигли дневного лимита запросов, приходите завтра!",
"Ask anything about your product and users...": "Спросите что угодно о вашем продукте и пользователях...",
"Cancel Editing": "Отменить редактирование",
"Cancel processing": "Отменить обработку",
"Send message": "Отправить сообщение",
"Hey": "Привет",
"how can I help you?": "чем могу помочь?",
"Ask": "Спросить"
}

View file

@ -1501,5 +1501,19 @@
"Include rage clicks": "包括点击狂怒",
"Interface Language": "界面语言",
"Select the language in which OpenReplay will appear.": "选择 OpenReplay 将显示的语言。",
"Language": "语言"
"Language": "语言",
"Top user journeys": "用户主要路径",
"Where do users drop off": "用户在哪些环节流失",
"Failed network requests today": "今日网络请求失败次数",
"Suggested Follow-up Questions": "建议的后续问题",
"Suggested Ideas:": "建议的想法:",
"Generating ideas": "正在生成想法",
"You've reached the daily limit for queries, come again tomorrow!": "您已达到今日查询次数上限,请明天再来!",
"Ask anything about your product and users...": "询问有关您的产品和用户的任何问题...",
"Cancel Editing": "取消编辑",
"Cancel processing": "取消处理",
"Send message": "发送消息",
"Hey": "你好",
"how can I help you?": "我能帮您做些什么",
"Ask": "询问"
}