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

One default message for multiple keys #490

Closed
filipcro opened this issue Apr 21, 2019 · 2 comments · Fixed by #502
Closed

One default message for multiple keys #490

filipcro opened this issue Apr 21, 2019 · 2 comments · Fixed by #502

Comments

@filipcro
Copy link
Contributor

Is your feature request related to a problem? Please describe.
I have many forms in my application. Some of them have email field. Now if I want to specify a default message and custom key I need to use <Trans id="auth.email">Email</Trans> every time.

If i use <Trans id="auth.email">Email</Trans>, I can't use <Trans id="auth.email" /> anymore because extract command will throw error:

Error: Encountered different defaults for message auth.email
src/components/auth/ForgottenPasswordForm.js:27 undefined
src/components/auth/LogInForm.js:36 Email
(...)

Describe the solution you'd like
I'd like that once default not-undefined value is specified, it overrides all undefined ones. This will simplify translations and minimize code repetition.

@tricoder42
Copy link
Contributor

Hi @filipcro, thank you for reporting. Indeed, there's a bug on this line:

if (prev.defaults !== next.defaults) {

Would you like to send a PR? Thank you 🙏

@filipcro
Copy link
Contributor Author

Sure, I'll fix it.

filipcro added a commit to filipcro/js-lingui that referenced this issue May 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants