Asp.net-mvc – What advantages are the of using .resx localization for an ASP.NET MVC app

asp.net-mvclocalizationresx

There are a number of questions on this site related to how to access RESX files in an ASP.NET MVC application, and best practices of using them.

However after reading (for the first time I might add) the MSDN article on resources I'm left wondering if there are even any advantages of using RESX files since I'm not going to be using server controls. Theres all this talk of 'implicit' and 'explicit' localization but I'm not going to benefit from that with MVC.

Ultimately my application will need string resources for buttons and menu items and also much longer HTML items for longer miscellaneous content. I would like to use a CMS for the longer items becuase I'm pretty sure I don't want to go sticking them into an RESX file.

Are there any compelling reasons to use or not to use ASP.NET resources in a new application. I'm going to assume that any future MVC enhancements or RESX enhancements will work in harmony together, but for now I'm just getting a glorified IDictionary as far as I can see.

Should I proceed with RESX or look elsewhere? Should I even be considering a CMS for the kinds of resources that RESX is designed for?

Any lessons learned would be appreciated.

Best Answer

There are couple of advantages to the RESX infrastructure:

  • you don't have to load the proper per-language resources. Once the locale of the thread is established, the CLr takes care of finding the appropriate assembly and loading the resources.
  • it is easy to hand off the locale-specific resources for localizations to third-parties.
  • there is a default fallback mechanism for non-localized resources.

There is also one particular disadvantage to the RESX approach:

  • it is hard to support translation model where the users translate your resources for you.

I'd like to elaborate a bit about that last point. Take for example the Facebook translation model. Facebook has fairly simple way for people to provide and vote on translations of various resources. If these are stored in a database, it would be possible to use them after the proper editorial process without rebuilding and redeploying the application. With the RESX model, the resources assemblies will have to be rebuild and redeployed, which could have high enough cost depending on the deployment process.

Thus, before deciding what localization process to use, I would look at the decision of who is going to do the localization and what the deployment process for the localizaed resources would be after the main application is already deployed.

EDIT: I forgot to mention that these considerations are orthogonal to the ASP.NET framework choice (MVC or WebForms).