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

translations #25

Open
ReinierGielen opened this issue Jan 16, 2015 · 5 comments
Open

translations #25

ReinierGielen opened this issue Jan 16, 2015 · 5 comments

Comments

@ReinierGielen
Copy link

The new override possibility for the error messages is nice, but enough for me as I need to make my site multi-lingual.

For the multi-lingual support we use angular-gettext.

In the previous version of xtForm I hacked the call to getText in the code and now I tried it with the new override functionality. This does not seem to work. I get an injection error when I try to use the getText command in the xtFormConfigProvider.

In the old version I used: var errString = this.gettextCatalog.getString(key);
In the function showErrors where the key is the property being validated.

I assume more people have a use for this option, so could this be included where you set it in the config which option you want to use ?

@refactorthis
Copy link
Owner

Thanks for taking the time to test out the new package. You can override all errors in your module config by a call to the xtformconfigprovider.setErrorMessages and providing each key and value. Can you not make the calls to gettext here?

@ReinierGielen
Copy link
Author

I tried that, but unfortunatly the function I need to inject is a service and you can not inject a service in a config.
But I'll look for an alternative solution.

@ReinierGielen
Copy link
Author

I managed to get a translation with the following statement:
msg-required="{{'required'|translate}}"

The disadvantage of course is that I need to add this to every input field.

@refactorthis
Copy link
Owner

Ah right, I guess I could make a change so that setErrorMessages() can be
called from the service as well as the provider.

On Mon, Jan 19, 2015 at 10:45 PM, ReinierGielen notifications@github.com
wrote:

I managed to get a translation with the following statement:
msg-required="{{'required'|translate}}"

The disadvantage of course is that I need to add this to every input field.


Reply to this email directly or view it on GitHub
#25 (comment).

@idreeshaddad
Copy link
Contributor

I'm using the famous angular-translate and I'm also adding the translation filter to each field individually.

+1 for setErrorMessages() on a service level.

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

3 participants