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

Issue/intl form implementation #101

Merged
merged 4 commits into from
Jun 27, 2024
Merged

Issue/intl form implementation #101

merged 4 commits into from
Jun 27, 2024

Conversation

Xaohs
Copy link
Contributor

@Xaohs Xaohs commented Jun 27, 2024

No description provided.

@Xaohs Xaohs requested a review from svenvandescheur June 27, 2024 12:15
Copy link
Collaborator

@svenvandescheur svenvandescheur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're nearly there, some small remarks though. After fixing:

  • Can you run npm run compilemessages (don't forget to add the english translation first)
  • Can you investigate how to test this in Storybook?

@@ -205,11 +217,16 @@ export const Form: React.FC<FormProps> = ({
getValueFromFormData(fields, valuesState, field);

const error = getErrorFromErrors(fields, errorsState, field);
const message =
error === 'Veld "{name}" is verplicht'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this to a constants somwhere next to the validator? And us it a much as possible (except for the useInt.formatMessage call which needs to be a string literal)?

@@ -18,7 +18,7 @@ export type Validator = (
export const validateRequired: Validator = (
value,
field,
message = 'Field "{name}" is required',
message = 'Veld "{name}" is verplicht',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this can be a constant, optionally document form behaviour overriding the final label

@@ -104,6 +104,11 @@
"description": "mykn.components.Form: The submit form label",
"originalDefault": "verzenden"
},
"mykn.components.Form.labelValidationErrorRequired": {
"defaultMessage": "Veld {name} is verplicht",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one needs to be translated

@Xaohs Xaohs requested a review from svenvandescheur June 27, 2024 12:58
@Xaohs Xaohs merged commit 28a193d into main Jun 27, 2024
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants