views:

110

answers:

1

I'm building C# WinForms using the MVP pattern in VS 2008. I will migrate these to WPF in the future. These forms will need to support multiple languages for the input labels and menus. I want to store the label text in a SQL Server database and pull up the proper label based on language.

Which of thse options (or another option perhaps) would you use?

  • Use Visual Studio 2008 built-in resource capability and write a custom provider to get properties from SQL.

  • Incorporate the label text into the
    MVP presenter.

+1  A: 

As you are aiming at changing UI at some time in the future, you should keep the presentation layer as thin as possible, to avoid writing a lot of extra code. With this in mind, slapping your globalization/localization code in the presenter is not a great idea. A custom provider for the built-in resource management is a better option than loading the presenter, IMO.

Look at Michele Bustamante's articles on globalization on MSDN. As far as whether or not to store the localized strings in SQL Server, you will have to decide this, as resource files can be used in a wide variety of project types. I will have to find her article on building a custom globalization provider.

A quick google finds this article: http://www.codeproject.com/KB/aspnet/customsqlserverprovider.aspx?fid=308557&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=1619351

I have not played with the code, but it appears to be a good start.

Gregory A Beamer
No problem. Hope it helps.
Gregory A Beamer
After more research and tinkering, I'm convinced that before "reinventing the wheel", I should really try out what is already built into the framework. It isn't 100% what I'm looking for, but I'll spend less time (and deal with far fewer bugs) by keeping it simple! Thanks again for your input!
Doug L.