Skip to content

Commit

Permalink
🌐 Add pt_BR and more translations (#767)
Browse files Browse the repository at this point in the history
Original PR: #694

---------

Co-authored-by: Daniel Oliveira <daniel.oliveira@kununu.com>
Co-authored-by: Daniel Oliveira <daniel@headdev.com.br>
  • Loading branch information
3 people authored Sep 5, 2023
1 parent e4ece31 commit aaa208c
Show file tree
Hide file tree
Showing 34 changed files with 1,153 additions and 189 deletions.
2 changes: 1 addition & 1 deletion apps/builder/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const nextConfig = {
],
i18n: {
defaultLocale: 'en',
locales: ['en', 'fr', 'pt', 'de'],
locales: ['en', 'fr', 'pt', 'pt_BR', 'de'],
},
experimental: {
outputFileTracingRoot: join(__dirname, '../../'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ import { ChevronDownIcon } from '@/components/icons'
import { MoreInfoTooltip } from '@/components/MoreInfoTooltip'

const localeHumanReadable = {
en: 'English',
fr: 'Français',
de: 'Deutsch',
pt: 'Português',
en: 'English',
fr: 'Français',
de: 'Deutsch',
pt: 'Português',
pt_BR: 'Português (BR)'
} as const

export const UserPreferencesForm = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export const CurrentSubscriptionSummary = ({ workspace }: Props) => {
<PlanTag plan={workspace.plan} />
{data?.subscription?.cancelDate && (
<Text fontSize="sm">
(Will be cancelled on {data.subscription.cancelDate.toDateString()})
({scopedT('cancelDate')}{' '}
{data.subscription.cancelDate.toDateString()})
</Text>
)}
</HStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const UsageProgressBars = ({ workspace }: Props) => {
<Text>
/{' '}
{workspaceChatsLimit === -1
? 'Unlimited'
? scopedT('unlimited')
: parseNumberWithCommas(workspaceChatsLimit)}
</Text>
</HStack>
Expand Down Expand Up @@ -141,7 +141,7 @@ export const UsageProgressBars = ({ workspace }: Props) => {
<Text>
/{' '}
{workspaceStorageLimit === -1
? 'Unlimited'
? scopedT('unlimited')
: `${workspaceStorageLimit} GB`}
</Text>
</HStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { TextInput } from '@/components/inputs'
import { useState } from 'react'
import { UploadButton } from '@/components/ImageUploadContent/UploadButton'
import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel'
import { useScopedI18n } from '@/locales'

type Props = {
fileUploadPath: string
Expand All @@ -16,6 +17,7 @@ export const AudioBubbleForm = ({
content,
onContentChange,
}: Props) => {
const scopedT = useScopedI18n('editor.blocks.bubbles.audio.settings')
const [currentTab, setCurrentTab] = useState<'link' | 'upload'>('link')

const updateUrl = (url: string) => onContentChange({ ...content, url })
Expand All @@ -31,14 +33,14 @@ export const AudioBubbleForm = ({
onClick={() => setCurrentTab('upload')}
size="sm"
>
Upload
{scopedT('upload.label')}
</Button>
<Button
variant={currentTab === 'link' ? 'solid' : 'ghost'}
onClick={() => setCurrentTab('link')}
size="sm"
>
Embed link
{scopedT('embedLink.label')}
</Button>
</HStack>
<Stack p="2" spacing={4}>
Expand All @@ -51,25 +53,25 @@ export const AudioBubbleForm = ({
onFileUploaded={updateUrl}
colorScheme="blue"
>
Choose a file
{scopedT('chooseFile.label')}
</UploadButton>
</Flex>
)}
{currentTab === 'link' && (
<>
<TextInput
placeholder="Paste the audio file link..."
placeholder={scopedT('worksWith.placeholder')}
defaultValue={content.url ?? ''}
onChange={updateUrl}
/>
<Text fontSize="sm" color="gray.400" textAlign="center">
Works with .MP3s and .WAVs
{scopedT('worksWith.text')}
</Text>
</>
)}
</Stack>
<SwitchWithLabel
label={'Enable autoplay'}
label={scopedT('autoplay.label')}
initialValue={content.isAutoplayEnabled ?? true}
onCheckChange={updateAutoPlay}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { Text } from '@chakra-ui/react'
import { AudioBubbleContent } from '@typebot.io/schemas'
import { isDefined } from '@typebot.io/lib'
import { useScopedI18n } from '@/locales'

type Props = {
url: AudioBubbleContent['url']
}

export const AudioBubbleNode = ({ url }: Props) =>
isDefined(url) ? (
export const AudioBubbleNode = ({ url }: Props) => {
const scopedT = useScopedI18n('editor.blocks.bubbles.audio.node')
return isDefined(url) ? (
<audio src={url} controls />
) : (
<Text color={'gray.500'}>Click to edit...</Text>
<Text color={'gray.500'}>{scopedT('clickToEdit.text')}</Text>
)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { useScopedI18n } from '@/locales'
import { Text } from '@chakra-ui/react'
import { EmbedBubbleBlock } from '@typebot.io/schemas'

export const EmbedBubbleContent = ({ block }: { block: EmbedBubbleBlock }) => {
if (!block.content?.url) return <Text color="gray.500">Click to edit...</Text>
return <Text>Show embed</Text>
type Props = {
block: EmbedBubbleBlock
}

export const EmbedBubbleContent = ({ block }: Props) => {
const scopedT = useScopedI18n('editor.blocks.bubbles.embed.node')
if (!block.content?.url)
return <Text color="gray.500">{scopedT('clickToEdit.text')}</Text>
return <Text>{scopedT('show.text')}</Text>
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import { TextInput, NumberInput } from '@/components/inputs'
import { HStack, Stack, Text } from '@chakra-ui/react'
import { EmbedBubbleContent } from '@typebot.io/schemas'
import { sanitizeUrl } from '@typebot.io/lib'
import { useScopedI18n } from '@/locales'

type Props = {
content: EmbedBubbleContent
onSubmit: (content: EmbedBubbleContent) => void
}

export const EmbedUploadContent = ({ content, onSubmit }: Props) => {
const scopedT = useScopedI18n('editor.blocks.bubbles.embed.settings')
const handleUrlChange = (url: string) => {
const iframeUrl = sanitizeUrl(
url.trim().startsWith('<iframe') ? extractUrlFromIframe(url) : url
Expand All @@ -23,12 +25,12 @@ export const EmbedUploadContent = ({ content, onSubmit }: Props) => {
<Stack p="2" spacing={6}>
<Stack>
<TextInput
placeholder="Paste the link or code..."
placeholder={scopedT('worksWith.placeholder')}
defaultValue={content?.url ?? ''}
onChange={handleUrlChange}
/>
<Text fontSize="sm" color="gray.400" textAlign="center">
Works with PDFs, iframes, websites...
{scopedT('worksWith.text')}
</Text>
</Stack>

Expand All @@ -38,7 +40,7 @@ export const EmbedUploadContent = ({ content, onSubmit }: Props) => {
defaultValue={content?.height}
onValueChange={handleHeightChange}
/>
<Text>px</Text>
<Text>{scopedT('numberInput.unit')}</Text>
</HStack>
</Stack>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { useScopedI18n } from '@/locales'
import { Box, Text, Image } from '@chakra-ui/react'
import { ImageBubbleBlock } from '@typebot.io/schemas'

export const ImageBubbleContent = ({ block }: { block: ImageBubbleBlock }) => {
type Props = {
block: ImageBubbleBlock
}

export const ImageBubbleContent = ({ block }: Props) => {
const scopedT = useScopedI18n('editor.blocks.bubbles.image.node')
const containsVariables =
block.content?.url?.includes('{{') && block.content.url.includes('}}')
return !block.content?.url ? (
<Text color={'gray.500'}>Click to edit...</Text>
<Text color={'gray.500'}>{scopedT('clickToEdit.text')}</Text>
) : (
<Box w="full">
<Image
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ImageUploadContent } from '@/components/ImageUploadContent'
import { TextInput } from '@/components/inputs'
import { SwitchWithLabel } from '@/components/inputs/SwitchWithLabel'
import { useScopedI18n } from '@/locales'
import { Stack } from '@chakra-ui/react'
import { isDefined, isNotEmpty } from '@typebot.io/lib'
import { ImageBubbleBlock } from '@typebot.io/schemas'
Expand All @@ -17,6 +18,9 @@ export const ImageBubbleSettings = ({
block,
onContentChange,
}: Props) => {
const scopedT = useScopedI18n(
'editor.blocks.bubbles.image.switchWithLabel.onClick'
)
const [showClickLinkInput, setShowClickLinkInput] = useState(
isNotEmpty(block.content.clickLink?.url)
)
Expand Down Expand Up @@ -55,7 +59,7 @@ export const ImageBubbleSettings = ({
/>
<Stack>
<SwitchWithLabel
label={'On click link'}
label={scopedT('label')}
initialValue={showClickLinkInput}
onCheckChange={toggleClickLink}
/>
Expand All @@ -68,7 +72,7 @@ export const ImageBubbleSettings = ({
defaultValue={block.content.clickLink?.url}
/>
<TextInput
placeholder="Link alt text (description)"
placeholder={scopedT('placeholder')}
onChange={updateClickLinkAltText}
defaultValue={block.content.clickLink?.alt}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { colors } from '@/lib/theme'
import { useOutsideClick } from '@/hooks/useOutsideClick'
import { selectEditor, TElement } from '@udecode/plate-common'
import { TextEditorToolBar } from './TextEditorToolBar'
import { useScopedI18n } from '@/locales'

type TextBubbleEditorContentProps = {
id: string
Expand All @@ -30,6 +31,7 @@ const TextBubbleEditorContent = ({
textEditorValue,
onClose,
}: TextBubbleEditorContentProps) => {
const scopedT = useScopedI18n('editor.blocks.bubbles')
const editor = usePlateEditorRef()
const varDropdownRef = useRef<HTMLDivElement | null>(null)
const rememberedSelection = useRef<BaseSelection | null>(null)
Expand Down Expand Up @@ -108,7 +110,7 @@ const TextBubbleEditorContent = ({
backgroundColor: useColorModeValue('white', 'gray.800'),
borderRadius: 'md',
transitionProperty: 'background-color',
transitionDuration: 'normal'
transitionDuration: 'normal',
},
'[class^="FloatingVerticalDivider___"]': {
'--tw-bg-opacity': useColorModeValue('1', '.4') + '!important',
Expand All @@ -135,7 +137,7 @@ const TextBubbleEditorContent = ({
})
setIsFirstFocus(false)
},
'aria-label': 'Text editor',
'aria-label': `${scopedT('textEditor.plate.label')}`,
onBlur: () => {
rememberedSelection.current = editor?.selection
},
Expand All @@ -154,7 +156,7 @@ const TextBubbleEditorContent = ({
<VariableSearchInput
initialVariableId={undefined}
onSelectVariable={handleVariableSelected}
placeholder="Search for a variable"
placeholder={scopedT('textEditor.searchVariable.placeholder')}
autoFocus
/>
</PopoverContent>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { useScopedI18n } from '@/locales'
import { Box, Text } from '@chakra-ui/react'
import { VideoBubbleBlock, VideoBubbleContentType } from '@typebot.io/schemas'

export const VideoBubbleContent = ({ block }: { block: VideoBubbleBlock }) => {
type Props = {
block: VideoBubbleBlock
}

export const VideoBubbleContent = ({ block }: Props) => {
const scopedT = useScopedI18n('editor.blocks.bubbles.video.node')
if (!block.content?.url || !block.content.type)
return <Text color="gray.500">Click to edit...</Text>
return <Text color="gray.500">{scopedT('clickToEdit.text')}</Text>
switch (block.content.type) {
case VideoBubbleContentType.URL:
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Stack, Text } from '@chakra-ui/react'
import { VideoBubbleContent, VideoBubbleContentType } from '@typebot.io/schemas'
import { TextInput } from '@/components/inputs'
import { useScopedI18n } from '@/locales'

const vimeoRegex = /vimeo\.com\/(\d+)/
const youtubeRegex = /youtube\.com\/(watch\?v=|shorts\/)(\w+)|youtu\.be\/(\w+)/
Expand All @@ -11,6 +12,7 @@ type Props = {
}

export const VideoUploadContent = ({ content, onSubmit }: Props) => {
const scopedT = useScopedI18n('editor.blocks.bubbles.video.settings')
const handleUrlChange = (url: string) => {
const info = parseVideoUrl(url)
return onSubmit({
Expand All @@ -22,12 +24,12 @@ export const VideoUploadContent = ({ content, onSubmit }: Props) => {
return (
<Stack p="2">
<TextInput
placeholder="Paste the video link..."
placeholder={scopedT('worksWith.placeholder')}
defaultValue={content?.url ?? ''}
onChange={handleUrlChange}
/>
<Text fontSize="sm" color="gray.400" textAlign="center">
Works with Youtube, Vimeo and others
{scopedT('worksWith.text')}
</Text>
</Stack>
)
Expand Down
Loading

4 comments on commit aaa208c

@vercel
Copy link

@vercel vercel bot commented on aaa208c Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./apps/docs

docs-typebot-io.vercel.app
docs-git-main-typebot-io.vercel.app
docs.typebot.io

@vercel
Copy link

@vercel vercel bot commented on aaa208c Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on aaa208c Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
app.typebot.io
builder-v2-typebot-io.vercel.app

@vercel
Copy link

@vercel vercel bot commented on aaa208c Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

viewer-v2 – ./apps/viewer

83242573.actualizar.xyz
87656003.actualizar.xyz
88152257.actualizar.xyz
app.youvisitedthis.site
bot.conquistadoralpha.site
bot.desafiode15dias.online
bot.descobrindotraicao.top
bot2.fusionstarreviews.com
casestudyemb.wpwakanda.com
chat.atlasoutfittersk9.com
configurator.bouclidom.com
demo.virtuesocialmedia.com
descobrincomeufilho.com.br
descobrindomeufilho.com.br
gabinete.baleia.formulario
help.atlasoutfittersk9.com
homepageonly.wpwakanda.com
internal.adleradvisors.com
liveconvert.kandalearn.com
mainmenu1one.wpwakanda.com
newsletter.itshcormeos.com
osimplesquefunciona.com.br
protocolosecabarriga.store
robertosanchesoficial.site
rsvp.virtuesocialmedia.com
tarian.theiofoundation.org
ted.meujalecobrasil.com.br
type.dericsoncalari.com.br
zap.primewealthfinserv.com
baleia.eventos.progenbr.com
bot.desafioserrabarriga.fit
bot.educacaopelodigital.com
bot.pinpointinteractive.com
bot.polychromes-project.com
bot.relacionesaludables.com
chat.semanalimpanome.com.br
designguide.techyscouts.com
drayuminakamuraoficial.site
liveconvert2.kandalearn.com
presente.empresarias.com.mx
register.algorithmpress.com
revelacaoastral.utuahub.com
sell.sellthemotorhome.co.uk
teste.captacao.progenbr.com
webwhatsapp.laconteudos.com
ajuda.meujalecobrasil.com.br
alavancagem.horadelucrar.com
anamnese.odontopavani.com.br
austin.channelautomation.com
bot.marketingplusmindset.com
desabafe.sergiolimajr.com.br
detective.chatvirtual.online
download.venturemarketing.in
mdb.gabinete.rp.progenbr.com
viewer-v2-typebot-io.vercel.app
download.thailandmicespecialist.com
mdb.assessoria.aloisio.progenbr.com
mdb.assessoria.girotto.progenbr.com
mdb.assessoria.marinho.progenbr.com
mdb.assessoria.rodrigo.progenbr.com
register.thailandmicespecialist.com
mdb.assessoria.desideri.progenbr.com
mdb.assessoria.fernanda.progenbr.com
mdb.assessoria.jbatista.progenbr.com
mdb.assessoria.mauricio.progenbr.com
mdb.evento.autocadastro.progenbr.com
form.shopmercedesbenzsouthorlando.com
mdb.evento.equipeinterna.progenbr.com
bot.studiotecnicoimmobiliaremerelli.it
mdb.assessoria.boaventura.progenbr.com
mdb.assessoria.jtrebesqui.progenbr.com
pesquisa.escolamodacomproposito.com.br
anamnese.clinicaramosodontologia.com.br
gabinete.baleia.formulario.progenbr.com
mdb.assessoria.carreirinha.progenbr.com
chrome-os-inquiry-system.itschromeos.com
mdb.assessoria.paulomarques.progenbr.com
viewer-v2-git-main-typebot-io.vercel.app
main-menu-for-itschromeos.itschromeos.com
mdb.assessoria.qrcode.ademir.progenbr.com
mdb.assessoria.qrcode.arthur.progenbr.com
mdb.assessoria.qrcode.danilo.progenbr.com
mdb.assessoria.qrcode.marcao.progenbr.com
mdb.assessoria.qrcode.marcio.progenbr.com
mdb.assessoria.qrcode.aloisio.progenbr.com
mdb.assessoria.qrcode.girotto.progenbr.com
mdb.assessoria.qrcode.marinho.progenbr.com
mdb.assessoria.qrcode.rodrigo.progenbr.com
mdb.assessoria.carlosalexandre.progenbr.com
mdb.assessoria.qrcode.desideri.progenbr.com
mdb.assessoria.qrcode.fernanda.progenbr.com
mdb.assessoria.qrcode.jbatista.progenbr.com
mdb.assessoria.qrcode.mauricio.progenbr.com
mdb.assessoria.fernanda.regional.progenbr.com
mdb.assessoria.qrcode.boaventura.progenbr.com
mdb.assessoria.qrcode.jtrebesqui.progenbr.com
mdb.assessoria.qrcode.carreirinha.progenbr.com
mdb.assessoria.qrcode.paulomarques.progenbr.com
mdb.assessoria.qrcode.carlosalexandre.progenbr.com
mdb.assessoria.qrcode.fernanda.regional.progenbr.com

Please sign in to comment.