.NET Internationalization: The Developers Guide to Building Global Windows and Web Applications
Before we look into resource managers, let's take a brief look at the possibilities for resource file formats. Four resource file formats are used for resources. The .resx file format that you have already encountered is an XML format. The .resources format that you have also already encountered is a binary format representing a compiled .resx file. The .txt file format is simply a text file with key/value pairs. So Form1Resources.txt would simply be: InsufficientFunds=Insufficient funds for the transfer The .restext file format (introduced in the .NET Framework 2.0) is the same as the .txt file format; the only difference is the extension. The new extension enables developers to make a clearer distinction between a text file that might contain any freeform text and a text file that is used explicitly for resources. Table 3.1 compares the file formats.
When choosing a file format, weigh the relative benefits of each. .resx files are recognized by Visual Studio and are human readable. They also have explicit classes for their manipulation (ResourceManager, ResXResourceReader, ResXResourceWriter). .resources files are not human readable and must originate from a .resx, .txt, or .restext file. .txt files are human readable but are not recognized as resource files by Visual Studio, and are not so easily manipulated programmatically as resources. |
Категории