Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add translation #1589

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions backend/chainlit/translations/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"logout": "লগআউট"
}
}
},
"clipboardCopy": {
"copy": "Copy",
"copied": "Copied to clipboard!"
}
},
"molecules": {
Expand Down Expand Up @@ -45,6 +49,13 @@
"took_one": "{{count}} পদক্ষেপ নিয়েছে",
"took_other": "{{count}}টি পদক্ষেপ নিয়েছে"
},
"feedback": {
"helpful": "Helpful",
"notHelpful": "Not helpful",
"feedback": "Feedback",
"addAComment": "Add a comment",
"submitFeedback": "Submit feedback"
},
"auth": {
"authLogin": {
"title": "অ্যাপটি অ্যাক্সেস করতে লগইন করুন।",
Expand Down
11 changes: 11 additions & 0 deletions backend/chainlit/translations/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"logout": "Logout"
}
}
},
"clipboardCopy": {
"copy": "Copy",
"copied": "Copied to clipboard!"
}
},
"molecules": {
Expand Down Expand Up @@ -43,6 +47,13 @@
"using": "Using",
"used": "Used"
},
"feedback": {
"helpful": "Helpful",
"notHelpful": "Not helpful",
"feedback": "Feedback",
"addAComment": "Add a comment",
"submitFeedback": "Submit feedback"
},
"auth": {
"authLogin": {
"title": "Login to access the app.",
Expand Down
11 changes: 11 additions & 0 deletions backend/chainlit/translations/gu.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"logout": "બહાર નીકળો"
}
}
},
"clipboardCopy": {
"copy": "Copy",
"copied": "Copied to clipboard!"
}
},
"molecules": {
Expand Down Expand Up @@ -45,6 +49,13 @@
"took_one": "{{count}} પગલું ભર્યું",
"took_other": "{{count}} પગલાંઓ લીધા"
},
"feedback": {
"helpful": "Helpful",
"notHelpful": "Not helpful",
"feedback": "Feedback",
"addAComment": "Add a comment",
"submitFeedback": "Submit feedback"
},
"auth": {
"authLogin": {
"title": "એપ્લિકેશનને ઍક્સેસ કરવા માટે લોગિન કરો.",
Expand Down
11 changes: 11 additions & 0 deletions backend/chainlit/translations/he-IL.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"logout": "התנתק"
}
}
},
"clipboardCopy": {
"copy": "Copy",
"copied": "Copied to clipboard!"
}
},
"molecules": {
Expand Down Expand Up @@ -45,6 +49,13 @@
"took_one": "לקח צעד {{count}}",
"took_other": "לקח צעדים {{count}}"
},
"feedback": {
"helpful": "Helpful",
"notHelpful": "Not helpful",
"feedback": "Feedback",
"addAComment": "Add a comment",
"submitFeedback": "Submit feedback"
},
"auth": {
"authLogin": {
"title": "התחבר כדי לגשת לאפליקציה.",
Expand Down
11 changes: 11 additions & 0 deletions backend/chainlit/translations/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"logout": "लॉगआउट"
}
}
},
"clipboardCopy": {
"copy": "Copy",
"copied": "Copied to clipboard!"
}
},
"molecules": {
Expand Down Expand Up @@ -45,6 +49,13 @@
"took_one": "{{count}} कदम उठाया",
"took_other": "{{count}} कदम उठाए"
},
"feedback": {
"helpful": "Helpful",
"notHelpful": "Not helpful",
"feedback": "Feedback",
"addAComment": "Add a comment",
"submitFeedback": "Submit feedback"
},
"auth": {
"authLogin": {
"title": "ऐप तक पहुंचने के लिए लॉगिन करें।",
Expand Down
11 changes: 11 additions & 0 deletions backend/chainlit/translations/kn.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"logout": "ಲಾಗ್ ಔಟ್"
}
}
},
"clipboardCopy": {
"copy": "Copy",
"copied": "Copied to clipboard!"
}
},
"molecules": {
Expand Down Expand Up @@ -45,6 +49,13 @@
"took_one": "{{count}} ಹೆಜ್ಜೆ ಇಟ್ಟಿದೆ",
"took_other": "{{count}} ಹೆಜ್ಜೆಗಳನ್ನು ತೆಗೆದುಕೊಂಡರು"
},
"feedback": {
"helpful": "Helpful",
"notHelpful": "Not helpful",
"feedback": "Feedback",
"addAComment": "Add a comment",
"submitFeedback": "Submit feedback"
},
"auth": {
"authLogin": {
"title": "ಅಪ್ಲಿಕೇಶನ್ ಪ್ರವೇಶಿಸಲು ಲಾಗಿನ್ ಮಾಡಿ.",
Expand Down
11 changes: 11 additions & 0 deletions backend/chainlit/translations/ml.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"logout": "ലോഗോട്ട്"
}
}
},
"clipboardCopy": {
"copy": "Copy",
"copied": "Copied to clipboard!"
}
},
"molecules": {
Expand Down Expand Up @@ -45,6 +49,13 @@
"took_one": "{{count}} സ്റ്റെപ്പ് എടുത്തു",
"took_other": "{{count}} സ്റ്റെപ്പുകൾ എടുത്തു"
},
"feedback": {
"helpful": "Helpful",
"notHelpful": "Not helpful",
"feedback": "Feedback",
"addAComment": "Add a comment",
"submitFeedback": "Submit feedback"
},
"auth": {
"authLogin": {
"title": "അപ്ലിക്കേഷൻ ആക്സസ് ചെയ്യാൻ ലോഗിൻ ചെയ്യുക.",
Expand Down
11 changes: 11 additions & 0 deletions backend/chainlit/translations/mr.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"logout": "Logout"
}
}
},
"clipboardCopy": {
"copy": "Copy",
"copied": "Copied to clipboard!"
}
},
"molecules": {
Expand Down Expand Up @@ -45,6 +49,13 @@
"took_one": "{{count}} पाऊल उचलले",
"took_other": "{{count}} पावले उचलली"
},
"feedback": {
"helpful": "Helpful",
"notHelpful": "Not helpful",
"feedback": "Feedback",
"addAComment": "Add a comment",
"submitFeedback": "Submit feedback"
},
"auth": {
"authLogin": {
"title": "अ ॅपमध्ये प्रवेश करण्यासाठी लॉगिन करा.",
Expand Down
11 changes: 11 additions & 0 deletions backend/chainlit/translations/nl-NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"logout": "Uitloggen"
}
}
},
"clipboardCopy": {
"copy": "Copy",
"copied": "Copied to clipboard!"
}
},
"molecules": {
Expand Down Expand Up @@ -43,6 +47,13 @@
"using": "Gebruikt",
"used": "Gebruikt"
},
"feedback": {
"helpful": "Helpful",
"notHelpful": "Not helpful",
"feedback": "Feedback",
"addAComment": "Add a comment",
"submitFeedback": "Submit feedback"
},
"auth": {
"authLogin": {
"title": "Log in om toegang te krijgen tot de app.",
Expand Down
11 changes: 11 additions & 0 deletions backend/chainlit/translations/ta.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"logout": "வெளியேறு"
}
}
},
"clipboardCopy": {
"copy": "Copy",
"copied": "Copied to clipboard!"
}
},
"molecules": {
Expand Down Expand Up @@ -45,6 +49,13 @@
"took_one": "{{count}} அடி எடுத்து வைத்தார்",
"took_other": "{{count}} படிகளை எடுத்தார்"
},
"feedback": {
"helpful": "Helpful",
"notHelpful": "Not helpful",
"feedback": "Feedback",
"addAComment": "Add a comment",
"submitFeedback": "Submit feedback"
},
"auth": {
"authLogin": {
"title": "பயன்பாட்டை அணுக உள்நுழைக.",
Expand Down
11 changes: 11 additions & 0 deletions backend/chainlit/translations/te.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"logout": "Logout"
}
}
},
"clipboardCopy": {
"copy": "Copy",
"copied": "Copied to clipboard!"
}
},
"molecules": {
Expand Down Expand Up @@ -45,6 +49,13 @@
"took_one": "{{count}} అడుగు వేసింది",
"took_other": "{{count}} అడుగులు వేసింది"
},
"feedback": {
"helpful": "Helpful",
"notHelpful": "Not helpful",
"feedback": "Feedback",
"addAComment": "Add a comment",
"submitFeedback": "Submit feedback"
},
"auth": {
"authLogin": {
"title": "యాప్ యాక్సెస్ చేసుకోవడానికి లాగిన్ అవ్వండి.",
Expand Down
11 changes: 11 additions & 0 deletions backend/chainlit/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
"logout": "登出"
}
}
},
"clipboardCopy": {
"copy": "Copy",
"copied": "Copied to clipboard!"
}
},
"molecules": {
Expand Down Expand Up @@ -43,6 +47,13 @@
"using": "使用",
"used": "已用"
},
"feedback": {
"helpful": "Helpful",
"notHelpful": "Not helpful",
"feedback": "Feedback",
"addAComment": "Add a comment",
"submitFeedback": "Submit feedback"
},
"auth": {
"authLogin": {
"title": "登录以访问应用。",
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/components/atoms/ClipboardCopy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { useCopyToClipboard } from 'usehooks-ts';
import IconButton, { IconButtonProps } from '@mui/material/IconButton';
import Tooltip from '@mui/material/Tooltip';

import { useTranslation } from 'components/i18n/Translator';

import CopyIcon from 'assets/copy';

interface ClipboardCopyProps {
Expand All @@ -15,6 +17,7 @@ interface ClipboardCopyProps {
const ClipboardCopy = ({ value, edge }: ClipboardCopyProps): JSX.Element => {
const [isCopied, setIsCopied] = useState(false);
const [_, copy] = useCopyToClipboard();
const { t } = useTranslation();

const handleCopy = () => {
copy(value)
Expand All @@ -30,7 +33,11 @@ const ClipboardCopy = ({ value, edge }: ClipboardCopyProps): JSX.Element => {

return (
<Tooltip
title={isCopied ? 'Copied to clipboard!' : 'Copy'}
title={
isCopied
? t('components.atoms.clipboardCopy.copied')
: t('components.atoms.clipboardCopy.copy')
}
onClose={handleTooltipClose}
sx={{ zIndex: 2 }}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
import Dialog from 'components/atoms/Dialog';
import { AccentButton } from 'components/atoms/buttons/AccentButton';
import { TextInput } from 'components/atoms/inputs';
import Translator, { useTranslation } from 'components/i18n/Translator';

import MessageBubbleIcon from 'assets/messageBubble';
import {
Expand All @@ -41,6 +42,8 @@ const FeedbackButtons = ({ message }: Props) => {
const firstInteraction = useRecoilValue(firstUserInteraction);
const { idToResume } = useChatSession();

const { t } = useTranslation();

const [feedback, setFeedback] = useState(message.feedback?.value);
const [comment, setComment] = useState(message.feedback?.comment);

Expand Down Expand Up @@ -102,7 +105,7 @@ const FeedbackButtons = ({ message }: Props) => {

const baseButtons = [
() => (
<Tooltip title="Helpful">
<Tooltip title={t('components.molecules.feedback.helpful')}>
<span>
<IconButton
color="inherit"
Expand All @@ -118,7 +121,7 @@ const FeedbackButtons = ({ message }: Props) => {
</Tooltip>
),
() => (
<Tooltip title="Not helpful">
<Tooltip title={t('components.molecules.feedback.notHelpful')}>
<span>
<IconButton
color="inherit"
Expand All @@ -137,7 +140,7 @@ const FeedbackButtons = ({ message }: Props) => {

if (comment) {
baseButtons.push(() => (
<Tooltip title="Feedback">
<Tooltip title={t('components.molecules.feedback.feedback')}>
<span>
<IconButton
color="inherit"
Expand Down Expand Up @@ -175,7 +178,7 @@ const FeedbackButtons = ({ message }: Props) => {
title={
<Stack direction="row" alignItems="center" gap={2}>
{showFeedbackDialog === 0 ? <DownIcon /> : <UpIcon />}
Add a comment
<Translator path="components.molecules.feedback.addAComment" />
</Stack>
}
content={
Expand Down Expand Up @@ -207,7 +210,7 @@ const FeedbackButtons = ({ message }: Props) => {
}}
autoFocus
>
Submit feedback
<Translator path="components.molecules.feedback.submitFeedback" />
</AccentButton>
}
/>
Expand Down