🌐 Add theme tab translation keys (#1119)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Implemented internationalization across various components, enabling
dynamic language translation for UI elements.

- **Enhancements**
	- Improved accessibility with translated `aria-label` attributes.
	- Enhanced user interface with translated button texts and labels.

- **Refactor**
	- Streamlined translation handling with the `useTranslate` hook.

- **Bug Fixes**
	- Corrected tooltip label for better clarity.

- **Style**
	- Updated visual elements to reflect changes in language settings.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Baptiste Arnaud <baptiste.arnaud95@gmail.com>
This commit is contained in:
Gabriel Pavão
2023-12-29 08:02:14 -03:00
committed by GitHub
parent f26eafd26f
commit 5fbbe9d86e
23 changed files with 186 additions and 62 deletions

View File

@@ -13,6 +13,7 @@ import {
ModalOverlay,
} from '@chakra-ui/react'
import { createId } from '@paralleldrive/cuid2'
import { useTranslate } from '@tolgee/react'
import { ThemeTemplate } from '@typebot.io/schemas'
import { FormEvent, useRef, useState } from 'react'
@@ -31,6 +32,7 @@ export const SaveThemeModal = ({
selectedTemplate,
theme,
}: Props) => {
const { t } = useTranslate()
const { showToast } = useToast()
const [isSaving, setIsSaving] = useState(false)
const inputRef = useRef<HTMLInputElement>(null)
@@ -80,15 +82,19 @@ export const SaveThemeModal = ({
<Modal isOpen={isOpen} onClose={onClose} initialFocusRef={inputRef}>
<ModalOverlay />
<ModalContent as="form" onSubmit={updateExistingTemplate}>
<ModalHeader>Save theme</ModalHeader>
<ModalHeader>
{t('theme.sideMenu.template.myTemplates.saveTheme.title')}
</ModalHeader>
<ModalCloseButton />
<ModalBody>
<TextInput
ref={inputRef}
label="Name:"
label={t('theme.sideMenu.template.myTemplates.saveTheme.name')}
defaultValue={selectedTemplate?.name}
withVariableButton={false}
placeholder="My template"
placeholder={t(
'theme.sideMenu.template.myTemplates.saveTheme.myTemplate'
)}
isRequired
/>
</ModalBody>
@@ -96,11 +102,11 @@ export const SaveThemeModal = ({
<ModalFooter as={HStack}>
{selectedTemplate?.id && (
<Button isLoading={isSaving} onClick={saveNewTemplate}>
Save as new template
{t('theme.sideMenu.template.myTemplates.saveTheme.saveAsNew')}
</Button>
)}
<Button type="submit" colorScheme="blue" isLoading={isSaving}>
{selectedTemplate?.id ? 'Update' : 'Save'}
{selectedTemplate?.id ? t('update') : t('save')}
</Button>
</ModalFooter>
</ModalContent>