Progress on translations (#10142)
This commit is contained in:
@ -8,6 +8,7 @@ import { TextArea } from '@/ui/input/components/TextArea';
|
||||
import { TextInput } from '@/ui/input/components/TextInput';
|
||||
import { useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { plural } from 'pluralize';
|
||||
import { Controller, useFormContext } from 'react-hook-form';
|
||||
import { isDefined } from 'twenty-shared';
|
||||
@ -95,6 +96,8 @@ export const SettingsDataModelObjectAboutForm = ({
|
||||
objectMetadataItem,
|
||||
onBlur,
|
||||
}: SettingsDataModelObjectAboutFormProps) => {
|
||||
const { t } = useLingui();
|
||||
|
||||
const { control, watch, setValue } =
|
||||
useFormContext<SettingsDataModelObjectAboutFormValues>();
|
||||
const theme = useTheme();
|
||||
@ -111,8 +114,8 @@ export const SettingsDataModelObjectAboutForm = ({
|
||||
watch('description');
|
||||
watch('icon');
|
||||
const apiNameTooltipText = isLabelSyncedWithName
|
||||
? 'Deactivate "Synchronize Objects Labels and API Names" to set a custom API name'
|
||||
: 'Input must be in camel case and cannot start with a number';
|
||||
? t`Deactivate "Synchronize Objects Labels and API Names" to set a custom API name`
|
||||
: t`Input must be in camel case and cannot start with a number`;
|
||||
|
||||
const fillLabelPlural = (labelSingular: string) => {
|
||||
const newLabelPluralValue = isDefined(labelSingular)
|
||||
@ -192,8 +195,8 @@ export const SettingsDataModelObjectAboutForm = ({
|
||||
defaultValue={objectMetadataItem?.labelPlural}
|
||||
render={({ field: { onChange, value } }) => (
|
||||
<TextInput
|
||||
label={'Plural'}
|
||||
placeholder={'Listings'}
|
||||
label={t`Plural`}
|
||||
placeholder={t`Listings`}
|
||||
value={value}
|
||||
onChange={(value) => {
|
||||
onChange(value);
|
||||
@ -214,7 +217,7 @@ export const SettingsDataModelObjectAboutForm = ({
|
||||
defaultValue={objectMetadataItem?.description ?? null}
|
||||
render={({ field: { onChange, value } }) => (
|
||||
<TextArea
|
||||
placeholder="Write a description"
|
||||
placeholder={t`Write a description`}
|
||||
minRows={4}
|
||||
value={value ?? undefined}
|
||||
onChange={(nextValue) => onChange(nextValue ?? null)}
|
||||
@ -228,17 +231,17 @@ export const SettingsDataModelObjectAboutForm = ({
|
||||
<StyledAdvancedSettingsSectionInputWrapper>
|
||||
{[
|
||||
{
|
||||
label: 'API Name (Singular)',
|
||||
label: t`API Name (Singular)`,
|
||||
fieldName: 'nameSingular' as const,
|
||||
placeholder: 'listing',
|
||||
placeholder: `listing`,
|
||||
defaultValue: objectMetadataItem?.nameSingular,
|
||||
disableEdition: disableEdition || isLabelSyncedWithName,
|
||||
tooltip: apiNameTooltipText,
|
||||
},
|
||||
{
|
||||
label: 'API Name (Plural)',
|
||||
label: t`API Name (Plural)`,
|
||||
fieldName: 'namePlural' as const,
|
||||
placeholder: 'listings',
|
||||
placeholder: `listings`,
|
||||
defaultValue: objectMetadataItem?.namePlural,
|
||||
disableEdition: disableEdition || isLabelSyncedWithName,
|
||||
tooltip: apiNameTooltipText,
|
||||
@ -307,8 +310,8 @@ export const SettingsDataModelObjectAboutForm = ({
|
||||
<Card rounded>
|
||||
<SettingsOptionCardContentToggle
|
||||
Icon={IconRefresh}
|
||||
title="Synchronize Objects Labels and API Names"
|
||||
description="Should changing an object's label also change the API?"
|
||||
title={t`Synchronize Objects Labels and API Names`}
|
||||
description={t`Should changing an object's label also change the API?`}
|
||||
checked={value ?? true}
|
||||
disabled={
|
||||
isDefined(objectMetadataItem) &&
|
||||
|
||||
@ -5,6 +5,7 @@ import { ComponentDecorator } from 'twenty-ui';
|
||||
import { FormProviderDecorator } from '~/testing/decorators/FormProviderDecorator';
|
||||
import { IconsProviderDecorator } from '~/testing/decorators/IconsProviderDecorator';
|
||||
|
||||
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
|
||||
import { generatedMockObjectMetadataItems } from '~/testing/mock-data/generatedMockObjectMetadataItems';
|
||||
import { SettingsDataModelObjectAboutForm } from '../SettingsDataModelObjectAboutForm';
|
||||
const mockedCompanyObjectMetadataItem = generatedMockObjectMetadataItems.find(
|
||||
@ -25,6 +26,7 @@ const meta: Meta<typeof SettingsDataModelObjectAboutForm> = {
|
||||
<Story />
|
||||
</StyledContainer>
|
||||
),
|
||||
I18nFrontDecorator,
|
||||
FormProviderDecorator,
|
||||
IconsProviderDecorator,
|
||||
ComponentDecorator,
|
||||
|
||||
Reference in New Issue
Block a user