Reputation: 497
I'm starting a new solution in ASP.NET MVC5 and I'll have to implement internationalization for the whole views.
The best article I found so far that explains how to well implement ASP.NET MVC 5 Internationalization was this one. I also read this one.
Anyway I still have some questions that I'd like the ask here in order to make sure about the best practices of internationalization which ones I still haven't found clearly answers on web.
Thank you in advance.
Upvotes: 1
Views: 2727
Reputation: 570
According to MSDN, local resources are a concept relative to .aspx views.
In MVC, it is recommended to avoid App_GlobalResources and App_LocalResources. A great answer/explanation regarding this can be found here.
Alternatives to App_*Resources include:
Properties > Resources
Resources Folder
Resources Project
Upvotes: 1
Reputation: 729
You can simply put your resource files in a custom folder. I created a "resources" folder and it works like a charm.
To access values, here an example for an action link:
@Html.ActionLink(Resources.Labels.Archivio, "Archivio", "Home")
Note you don't specify the Language, because MVC takes the locale loaded into the current thread
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(cultureName);
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
Upvotes: 0