replace t` with msg` to fix labels not being translated correctly

This commit is contained in:
Athou
2024-08-03 12:59:51 +02:00
parent 6c7e2ea847
commit de80aa6bb3
13 changed files with 69 additions and 40 deletions

View File

@@ -1,4 +1,5 @@
import { Trans, t } from "@lingui/macro"
import { Trans, msg } from "@lingui/macro"
import { useLingui } from "@lingui/react"
import { Divider, Group, Radio, Select, SimpleGrid, Stack, Switch } from "@mantine/core"
import type { ComboboxData } from "@mantine/core/lib/components/Combobox/Combobox.types"
import { Constants } from "app/constants"
@@ -33,6 +34,7 @@ export function DisplaySettings() {
const mobileFooter = useAppSelector(state => state.user.settings?.mobileFooter)
const sharingSettings = useAppSelector(state => state.user.settings?.sharingSettings)
const dispatch = useAppDispatch()
const { _ } = useLingui()
const scrollModeOptions: Record<ScrollMode, ReactNode> = {
always: <Trans>Always</Trans>,
@@ -43,19 +45,19 @@ export function DisplaySettings() {
const displayModeData: ComboboxData = [
{
value: "always",
label: t`Always`,
label: _(msg`Always`),
},
{
value: "on_desktop",
label: t`On desktop`,
label: _(msg`On desktop`),
},
{
value: "on_mobile",
label: t`On mobile`,
label: _(msg`On mobile`),
},
{
value: "never",
label: t`Never`,
label: _(msg`Never`),
},
]

View File

@@ -1,4 +1,5 @@
import { Trans, t } from "@lingui/macro"
import { Trans, msg } from "@lingui/macro"
import { useLingui } from "@lingui/react"
import { Anchor, Box, Button, Checkbox, Divider, Group, Input, PasswordInput, Stack, Text, TextInput } from "@mantine/core"
import { useForm } from "@mantine/form"
import { openConfirmModal } from "@mantine/modals"
@@ -19,10 +20,11 @@ interface FormData extends ProfileModificationRequest {
export function ProfileSettings() {
const profile = useAppSelector(state => state.user.profile)
const dispatch = useAppDispatch()
const { _ } = useLingui()
const form = useForm<FormData>({
validate: {
newPasswordConfirmation: (value, values) => (value !== values.newPassword ? t`Passwords do not match` : null),
newPasswordConfirmation: (value, values) => (value !== values.newPassword ? _(msg`Passwords do not match`) : null),
},
})
const { setValues } = form