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

How to localize DataAnnotiations? #29

Open
HolyOne opened this issue Oct 16, 2019 · 2 comments
Open

How to localize DataAnnotiations? #29

HolyOne opened this issue Oct 16, 2019 · 2 comments

Comments

@HolyOne
Copy link

HolyOne commented Oct 16, 2019

How do you localize text in data annotiations with ngettext?
Is that possible?

@VitaliiTsilnyk
Copy link
Owner

You can only use literals and constants in attribute arguments, so you can't wrap the text in the gettext call there.
I'm not sure what system uses your data annotations, but probably you can intercept the text before it gets displayed and do the gettext call there. But in this case you would have to configure your translatable text extractor tool (like xgettext or Poedit) to also handle the data annotation attributes.

@VitaliiTsilnyk
Copy link
Owner

Sorry for late reply, I've been very busy lately.

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

No branches or pull requests

2 participants