简体   繁体   中英

Problems with internationalization using MVC filter

I have an .NET 4.5.2 application with localized resource files (Messages.resx (for pt), Messages.es.resx and Messages.en.resx).

An MVC filter sets the thread culture based on client language.

I've published on a farm with 3 servers and it worked fine for some time, and suddenly the following behavior started:

  • One of the servers began to respond requests with pt culture with english messages.
  • Besides that, messages that are not translated to english and are only on Messages.resx file are returning empty.
  • If the client language is es the server returns with spanish messages.

We changed the farm servers and that happened on 4 different servers.

I tried to include [assembly: NeutralResourcesLanguage("pt")] on AssemblyInfo but the problem still happens.

Could anyone help me to solve this?

'An MVC filter sets the thread culture based on client language.'

Why? IIS can do this automatically. Use:

<globalization uiCulture="auto" culture="auto" />

in the system.web section of your web.config

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM