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

[FEAT] Antd | Allow translation for required field messages #5855

Open
oscarviq opened this issue Apr 16, 2024 · 2 comments · Fixed by #5868
Open

[FEAT] Antd | Allow translation for required field messages #5855

oscarviq opened this issue Apr 16, 2024 · 2 comments · Fixed by #5868
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@oscarviq
Copy link

Is your feature request related to a problem? Please describe.

Looks like the rules for form validation in the auth page component's do not allow for setting translated messages to the auth components. This is also true for the register, forgot password, etc. pages.

<Form.Item
            name="email"
            label={translate("pages.login.fields.email", "Email")}
            rules={[
              { required: true },
              {
                type: "email",
                message: translate(
                  "pages.login.errors.validEmail",
                  "Invalid email address",
                ),
              },
            ]}
          >

Screenshot 2024-04-15 at 5 27 32 PM

Describe alternatives you've considered

No response

Additional context

No response

Describe the thing to improve

From the looks of Antd's documentation, you can also pass a message property to the "required" rule:

https://ant.design/components/form#components-form-demo-normal-login

@oscarviq oscarviq added the enhancement New feature or request label Apr 16, 2024
@omeraplak omeraplak added the good first issue Good for newcomers label Apr 17, 2024
@omeraplak omeraplak added this to the May Release milestone Apr 17, 2024
@alicanerdurmaz
Copy link
Member

alicanerdurmaz commented Apr 17, 2024

Hello @oscarviq, thanks for the issue. As you said, we need to give the message prop to the required prop.

I will write what needs to be done step by step. please let me know if I missed anything.

Implementation details

code example:

{
  required: translate(
    "pages.login.errors.requiredEmail",
    "Email is required",
  ),
},

@0xJaskeerat
Copy link

Hey @oscarviq I wish to contribute to this
Please assign the issue to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants