Localization
The software market is a global one, and many programs will ship in regions where the users’ first language will be different from the application developers’ native tongue. While many software products get away with making the highly parochial assumption that everybody speaks English, .NET lets us do better than that. It provides support for building applications that support multiple languages.
The .NET Framework supplies facilities for localization of resources such as strings and bitmaps, and the Forms Designer can create forms that make use of this. To understand how to create localizable user interfaces, it is first necessary to understand the underlying localization mechanism that it is based on, so we will first look at global resource management, and then we will see how it is applied in a Windows Forms application.
Resource Managers
The programming model for
localizable applications is based on a simple premise: whenever you
require information that might be affected by the current language,
you must not hardcode this information into your application. All
such information should be retrieved through a culture-sensitive
mechanism. (In .NET, the word culture is used to
describe a locality; it implies all the relevant information, such as
location, language, date formats, sorting conventions, etc.) The
mechanism we use for this is the
ResourceManager
class,
which is defined in the System.Resources
namespace.
The ResourceManager
class allows named pieces of data ...
Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.