-
Notifications
You must be signed in to change notification settings - Fork 318
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
Get i18n error messages on @aws-amplify/ui-react #255
Comments
In aws-amplify/amplify-js#4979 Eric explained why he did not do translation at that time in his PR. Maybe now is time to finish the job? |
Is this the list of possible translations which you would like better-documented? |
I am not sure for that one. And the second ask is a translation of the error from Cognito. |
I'm facing similar issues with translations. A complete list wouldn't be enough for covering all the cases because the error messages can also include input values. E.g.
In above case email is used as a userName value. |
This remains an issue, even in the new version of the authenticator. Cognito error messages do not get translated. Since user input is often included in the message, I'm guessing what we would have to hook in to is the error type. Off the top of my head, I'm not sure if Cognito reuses error types, though. If they do, then that would not be a reliable solution. |
This is also a short-coming of Previous implementations relied on pattern-matching to translate errors: |
Is your feature request related to a problem? Please describe.
Error message are not translated when i18n lang changes when using UI from @aws-amplify/ui-react.
Plus there is no reliable list to know what possible message has to be translated.
There is an old list in packages/aws-amplify-react/src/AmplifyI18n.tsx but it was for the legacy aws-amplify-react package.
The list is incomplete (Eric said):
Additionally errors from Cognito should have a way to be translated.
Example:
1 validation error detected: Value at 'password' failed to satisfy constraint: Member must have length greater than or equal to 6
This type of message is complicated to translate.
Describe the solution you'd like
I like to have the full list of Translation string somewhere. (like amplify-ui-compomnents/src/common/Translation.tsx).
Having translation ready (like it was the case on aws-amplify-react on AmplifyI18n.tsx) will be ideal.
And documenting the supported languages will be great.
Having error messages from Cognito reliably translated. Not directly displayed to user. Why not asking Cognito to return an error code and use that fro English and non English translation with string controlled on Amplify side
Describe alternatives you've considered
Painfully looking in the code and testing. Then adding translations.
So far I added:
The text was updated successfully, but these errors were encountered: