How to localize MVC with backup database resources

I read most of the literature that Google and SO provides on this (correct me if I missed something).

What I'm trying to do is localize the MVC site using resources, I want the security of strongly typed resource files (ResX) but the flexibility of the ASP.NET 2.0 Resource-Provider Model or something similar to this. I do not mind doing some work, but it seems that all the paths that I explored lead to a dead end.

To display localized text in views, I can hack an assistant to extract resources from HttpContext.Get (Global | Local) ResourceObject , but it doesn’t get me anywhere when it comes to checking the model and forest , I suppose I could subclass attributes and provide data, but since it means pulling stuff out of the HttpContext, I doubt it’s available at the time the attributes are activated.

Since the localization of the direction in MVC seems to refer to ResX files and away from the 2.0 Resource-Provider model, I could try embedding myself in the classes created by ResXFileCodeGenerator with a custom ResXFileCodeGenerator to provide my own ResourceProvider, but it's terribly hacky. using custom Visual Studio add-ons and cogeneration.

So my question is basically , what is the story with flexible localization of MVC ?

In the literature below:

+4
source share
2 answers

The resource provider should work fine (i.e. http://msdn.microsoft.com/en-us/library/aa905797.aspx ). I used this in some projects with SQL Server support, it works fine. It allows you to use all the localization functions of ASP.NET and all translations of validation attributes using resources.

0
source

Try the dedicated NuGet package to localize MVC applications with database resources: Globsite.Globalization.Mvc

It is built on its own ASP.NET Resource-Provider Model, so it can be integrated with your application in the same way as standard ResX resources.
Moreover, the library allows you to generate highly typed resources with just one click, if you need to.

Project website with more detailed information:

globsite.net/GlobsiteGlobalizationLibrary

0
source

All Articles