So what my problem here is that the form is written out just fine, but the validation is always English. How can I change that based on the user language?
I have tried by setting the Thread like this:
@{
CultureInfo ci = new CultureInfo("da-DK");
Thread.CurrentThread.CurrentUICulture = ci;
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(ci.Name);
}
Even though I solved it otherwise, a silly thing really, I had changed the default language in Umbraco from English (US) to Danish (DK) and that basically rules.
But when I then added the language instead and set the Hostname with culture to the newly added language then it worked.
As I said, it really is silly and about that I had to add Danish instead of changing the default language in Umbraco is probably a bug.
I did get it to work out of the box with no need to use the resource approach with of course works great.
MVC model form jquery validation localized
Hi all,
I have been trying to create a form with a model a view and a controller.
Great I've got the form with validation. However now I try to change the language to Danish but it stays English.
View:
Model:
I have included this in web.config
I have added these scripts to the page:
So what my problem here is that the form is written out just fine, but the validation is always English. How can I change that based on the user language?
I have tried by setting the Thread like this:
And like this in web.config:
But honestly until now no luck!
Can anybody help me?
Thanks
Hello Scott
Great to se more people using umbraco MVC :)
what i think you missing is a resurce name in your atribute like
[Required(ErrorMessageResourceName = "resourceName")] public string LinkOne { get; set; }
you will offcourse need a resource file also with the message in :)
hope this helps.
Hi Kasper,
Thanks for pitching in really.
Even though I solved it otherwise, a silly thing really, I had changed the default language in Umbraco from English (US) to Danish (DK) and that basically rules.
But when I then added the language instead and set the Hostname with culture to the newly added language then it worked.
As I said, it really is silly and about that I had to add Danish instead of changing the default language in Umbraco is probably a bug.
I did get it to work out of the box with no need to use the resource approach with of course works great.
Thank you
Regards,
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.