Search code examples
asp.net-mvcdata-annotationshostunobtrusive-validationmultiple-languages

Asp.net MVC 4 DataAnnotation Language on Host Locaweb


I'm developing a website Application. I'm using asp.net MVC 4 with .net 4.5 framework. I'm having some problems with language validation messages. In my PC and work PC the validations show in brazilian portuguese, as I'd like. But, when I publish in Host (Locaweb.com.br) all the language messages show in english. I have translated the jquery validate file messages to PT-BR, but the problem goes on. I don't like to write custom messages in models (although this way solve my problem).

why the language change in the host? Anyone could help me?

ps: the IIS in the host is in english, but the host suport man says it couldn't interfere in my problem.

Thank you guys!


Solution

  • I suppose you should ann this section in your Web.config:

    <configuration>
        <system.web>
            <globalization uiCulture="pt-BR" culture="pt-BR" />
        </system.web>
    </configuration>
    

    This will tell MVC to use not default server culture but the one that you need.

    Also you should add Globalize scripts set on your master page:

    <script type="text/javascript">
        Globalize.culture("pt-BR");
    </script>