Prev | Current Page 877 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

CurrentUICulture = culture;
The demonstration code shows that the Thread class has both a CurrentCulture and a
CurrentUICulture property that can be assigned by an instance of CultureInfo. The instance
assigned to the CurrentCulture affects the formatting and comparisons of string, numeric, and
date formats. The CurrentUICulture property setting affects resources such as strings and images
that are loaded from assemblies. Setting both to the same value for a thread ensures that consistent
culture settings are applied.
The ResourceManager Class
A key consideration when designing ASP.NET controls that support localization is to ensure
that static control layouts accommodate for potential size changes due to language differences.
You should avoid hard-coding any textual values; instead, you should rely on a resource-based
approach. This approach supports localization with the side benefit of not requiring a full
recompile of a control library just to modify language support.
With that in mind, we switch to looking at a snippet of the Search control, which loads the
string for the Text property using the ResourceManager class:
// search button Text is localized
ResourceManager rm = ResourceFactory.Manager;
searchButton = new Button();
searchButton.


Pages:
865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889