views:

28

answers:

2

I have a class library and was to add a resource file to it to support both English and Spanish.

Any tips as how I can do this? The language will be dictated by the user visiting the site. Would like to have to only load each resource file once and cache or set in static variable and avoid any overheads.

A: 

It should be already handled by .net engine, and it would choose to use the one according to currentUICulture or currentCulture. BTW, the resource is supposed to be compiled into DLL so it is not possible to "Choose" since the file is not existed in the final compilation.

xandy
So when I access the dll, the .net engine will provide the resource relevant to my current culture?
Niall Collins
yes. The resource file is named according to the culture. e.g., myResource.xml will be the default culture (which is used in case no specific culture you have); myResource.fr-FR.xml will be French, it will be automatically used once the user is using fr-FR as culture.
xandy
A: 

Since you mentioned a user visiting your site, I'm assuming you're using ASP.NET. As such, you should read these MSDN articles for information about localization of resources in your ASP.NET application. If you're simply developing an offline application (without ASP.NET), read these articles. In fact, it wouldn't hurt to read all of them.

Matthew Ferreira