Skip to content

Commit

Permalink
Merge pull request #43933 from nkdengineer/fix/42970-regression
Browse files Browse the repository at this point in the history
Add missing translation

(cherry picked from commit 2ee7c52)
  • Loading branch information
bondydaa authored and OSBotify committed Jun 18, 2024
1 parent 0f37a1d commit 7991387
Showing 1 changed file with 4 additions and 5 deletions.
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

0 comments on commit 7991387

Please sign in to comment.