2
0

🧑‍💻 Migrate to Tolgee (#976)

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

### Summary by CodeRabbit

- Refactor: Transitioned to a new translation library (`@tolgee/react`)
across the application, enhancing the localization capabilities and
consistency.
- New Feature: Introduced a JSON configuration file for application
settings, improving customization and flexibility.
- Refactor: Updated SVG attribute naming convention in the
`WhatsAppLogo` component to align with React standards.
- Chore: Adjusted the `.gitignore` file and added a new line at the end.
- Documentation: Added instructions for setting up environment variables
for the Tolgee i18n contribution dev tool, improving the self-hosting
configuration guide.
- Style: Updated the `CollaborationMenuButton` to hide the
`PopoverContent` component by scaling it down to zero.
- Refactor: Simplified error handling logic for fetching and updating
typebots in `TypebotProvider.tsx`, improving code readability and
maintenance.
- Refactor: Removed the dependency on the `parseGroupTitle` function,
simplifying the code in several components.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Baptiste Arnaud
2023-10-27 09:23:50 +02:00
committed by GitHub
parent 31b3fc311e
commit bed8b42a2e
101 changed files with 2141 additions and 2210 deletions

21
packages/env/env.ts vendored
View File

@ -273,6 +273,25 @@ const posthogEnv = {
},
}
const tolgeeEnv = {
client: {
NEXT_PUBLIC_TOLGEE_API_KEY: z.string().min(1).optional(),
NEXT_PUBLIC_TOLGEE_API_URL: z
.string()
.url()
.optional()
.default('https://tolgee.server.baptistearno.com"'),
},
runtimeEnv: {
NEXT_PUBLIC_TOLGEE_API_KEY: getRuntimeVariable(
'NEXT_PUBLIC_TOLGEE_API_KEY'
),
NEXT_PUBLIC_TOLGEE_API_URL: getRuntimeVariable(
'NEXT_PUBLIC_TOLGEE_API_URL'
),
},
}
export const env = createEnv({
server: {
...baseEnv.server,
@ -302,6 +321,7 @@ export const env = createEnv({
...unsplashEnv.client,
...sentryEnv.client,
...posthogEnv.client,
...tolgeeEnv.client,
},
experimental__runtimeEnv: {
...baseEnv.runtimeEnv,
@ -313,6 +333,7 @@ export const env = createEnv({
...unsplashEnv.runtimeEnv,
...sentryEnv.runtimeEnv,
...posthogEnv.runtimeEnv,
...tolgeeEnv.runtimeEnv,
},
skipValidation:
process.env.SKIP_ENV_CHECK === 'true' ||

View File

@ -9,14 +9,7 @@ import {
InputBlockType,
AnswerInSessionState,
} from '@typebot.io/schemas'
import {
isInputBlock,
isDefined,
byId,
isNotEmpty,
parseGroupTitle,
isEmpty,
} from './utils'
import { isInputBlock, isDefined, byId, isNotEmpty, isEmpty } from './utils'
export const parseResultHeader = (
typebot: Pick<Typebot, 'groups' | 'variables'>,
@ -61,7 +54,7 @@ const parseInputsResultHeader = ({
.flatMap((group) =>
group.blocks.map((block) => ({
...block,
groupTitle: parseGroupTitle(group.title),
groupTitle: group.title,
}))
)
.filter((block) => isInputBlock(block)) as (InputBlock & {

View File

@ -244,8 +244,5 @@ export const getAtPath = <T>(obj: T, path: string): unknown => {
return current
}
export const parseGroupTitle = (title: string) =>
isEmpty(title) ? 'Untitled' : title
export const isSvgSrc = (src: string | undefined) =>
src?.startsWith('data:image/svg') || src?.endsWith('.svg')