Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing translation #43933

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/components/Form/FormProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import * as ValidationUtils from '@libs/ValidationUtils';
import Visibility from '@libs/Visibility';
import * as FormActions from '@userActions/FormActions';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import type {OnyxFormKey} from '@src/ONYXKEYS';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Form} from '@src/types/form';
Expand All @@ -25,7 +24,7 @@ import type {FormInputErrors, FormOnyxValues, FormProps, FormRef, InputComponent
// More details: https://github.com/Expensify/App/pull/16444#issuecomment-1482983426
const VALIDATE_DELAY = 200;

type GenericFormInputErrors = Partial<Record<string, TranslationPaths>>;
type GenericFormInputErrors = Partial<Record<string, string>>;
type InitialDefaultValue = false | Date | '';

function getInitialValueByType(valueType?: ValueTypeKey): InitialDefaultValue {
Expand Down Expand Up @@ -93,7 +92,7 @@ function FormProvider(
}: FormProviderProps,
forwardedRef: ForwardedRef<FormRef>,
) {
const {preferredLocale} = useLocalize();
const {preferredLocale, translate} = useLocalize();
const inputRefs = useRef<InputRefs>({});
const touchedInputs = useRef<Record<string, boolean>>({});
const [inputValues, setInputValues] = useState<Form>(() => ({...draftValues}));
Expand Down Expand Up @@ -143,7 +142,7 @@ function FormProvider(
}

// Add a validation error here because it is a string value that contains HTML characters
validateErrors[inputID] = 'common.error.invalidCharacter';
validateErrors[inputID] = translate('common.error.invalidCharacter');
});

if (typeof validateErrors !== 'object') {
Expand All @@ -158,7 +157,7 @@ function FormProvider(

return touchedInputErrors;
},
[errors, formID, validate, shouldTrimValues],
[shouldTrimValues, formID, validate, errors, translate],
);

// When locales change from another session of the same account,
Expand Down
Loading