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

Validation messages are not localised #23

Open
JakeGinnivan opened this issue Apr 11, 2013 · 0 comments
Open

Validation messages are not localised #23

JakeGinnivan opened this issue Apr 11, 2013 · 0 comments

Comments

@JakeGinnivan
Copy link
Member

For instance 'Required' error messages

Putting this into my controller fixes it ([LanguageFilter] does not help)

    protected override void Initialize(RequestContext requestContext)
    {
        var culture = requestContext.HttpContext.Request.Cookies["_culture"];
        if (culture != null)
        {
            SetCulture(culture.Value);
        }
        base.Initialize(requestContext);
    }

    private void SetCulture(string culture)
    {
        culture = culture ?? "en";
        ViewBag.Culture = culture;
        Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture);
        Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(culture);
    }
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

1 participant