I like the globalisation feature of .NET v2.0. That is a very easy to use feature to produce World ready applications. Here are the steps to use this feature:
- Add a resource file under App_GlobalResources with a culture name identifier explained here. If the default resource file name is Resource.resx which is for English; a Turkish resource file would be Resource.tr.resx.
- Enter strings that you would like to use in those resource files.
- Turn on the UICulture="Auto" of the aspx page in the @Page directive.
- Access to resx file through Resources class in the code behind like Resources.Resource.<name of the resource>
When the page is loaded it checks the culture of the client and loads the proper resource class. I think, it is doing this with a proxy class like in the proxy pattern. It is good that you don't have to do the necessary plumbing to get the culture from client and load proper resource file.
Part of "A Feature a Day" Series.