[FEAT] Antd | Allow translation for required field messages
oscarviq opened this issue · 2 comments
oscarviq commented
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",
),
},
]}
>
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
alicanerdurmaz commented
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
message
prop should be added torequired
rule of form items of all<AuthPage />
(login, register, etc.). login page code is here
code example:
{
required: translate(
"pages.login.errors.requiredEmail",
"Email is required",
),
},
- translation keys added to form items of all
<AuthPage />
should also be added to documentation
0xJaskeerat commented
Hey @oscarviq I wish to contribute to this
Please assign the issue to me