Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC 2 Localization/Globalization stored in the database?

I've been searching for a while for a good example of localizing an C# ASP.NET MVC 2 application but storing the data in the database instead of .RESX files. Unfortunately I've had no luck finding a good example and was hoping someone else may know and could point me in the right direction?

Many thanks for any help/advice/articles

like image 888
user307828 Avatar asked Apr 02 '10 17:04

user307828


People also ask

How globalization is implemented in ASP.NET MVC?

Image is used from: Globalization. In Visual Studio 2013 select "File" from the menu and inside that select Project and then a New Dialog will popup with the name New project. Inside that select Templates then select Visual C# and then inside that select web then select ASP.NET MVC 4 Web Application.

How do I change the language of a resource file in ASP.NET MVC?

One way you can do it is to have the drop down just redirect the page to a language specific URL (this is quite nice as you can send around language specific links) then in a base class on your controller, set the Thread's locale. This example has . aspx pages not razor . cshtml.


2 Answers

Resource provider model:

http://msdn.microsoft.com/en-us/library/aa905797.aspx

Scroll down to the section titled Building a Database Resource Provider.

like image 83
Rob Rodi Avatar answered Oct 07 '22 04:10

Rob Rodi


I'd also recommend these links:

  • Localization model with database resource provider
  • MVC localization
  • Related StackOverflow question
like image 25
Morten Mertner Avatar answered Oct 07 '22 02:10

Morten Mertner