fix(persons): localize validation error messages via Paraglide i18n
validatePersonFields now returns a PersonValidationKey instead of a hardcoded German string. resolveValidationMessage() translates the key through Paraglide so English and Spanish locale users no longer see German error text. Adds validation_last_name_required and validation_first_name_required to all three message files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,22 +6,24 @@ describe('validatePersonFields', () => {
|
||||
expect(validatePersonFields('PERSON', 'Hans', 'Müller')).toBeNull();
|
||||
});
|
||||
|
||||
it('returns lastName error when lastName is missing', () => {
|
||||
expect(validatePersonFields('PERSON', 'Hans', '')).toBe('Nachname ist Pflichtfeld.');
|
||||
it('returns lastName error key when lastName is missing', () => {
|
||||
expect(validatePersonFields('PERSON', 'Hans', '')).toBe('validation_last_name_required');
|
||||
});
|
||||
|
||||
it('returns lastName error when lastName is undefined', () => {
|
||||
it('returns lastName error key when lastName is undefined', () => {
|
||||
expect(validatePersonFields('INSTITUTION', undefined, undefined)).toBe(
|
||||
'Nachname ist Pflichtfeld.'
|
||||
'validation_last_name_required'
|
||||
);
|
||||
});
|
||||
|
||||
it('returns firstName error when type is PERSON and firstName is missing', () => {
|
||||
expect(validatePersonFields('PERSON', '', 'Müller')).toBe('Vorname ist Pflichtfeld.');
|
||||
it('returns firstName error key when type is PERSON and firstName is missing', () => {
|
||||
expect(validatePersonFields('PERSON', '', 'Müller')).toBe('validation_first_name_required');
|
||||
});
|
||||
|
||||
it('returns firstName error when type is PERSON and firstName is undefined', () => {
|
||||
expect(validatePersonFields('PERSON', undefined, 'Müller')).toBe('Vorname ist Pflichtfeld.');
|
||||
it('returns firstName error key when type is PERSON and firstName is undefined', () => {
|
||||
expect(validatePersonFields('PERSON', undefined, 'Müller')).toBe(
|
||||
'validation_first_name_required'
|
||||
);
|
||||
});
|
||||
|
||||
it('returns null for INSTITUTION without firstName', () => {
|
||||
|
||||
Reference in New Issue
Block a user