A Multilingual application is one that provides support for
multiple languages. This section discusses how we can implement a multilingual
application in .NET using the concepts explained earlier. The steps for
implementing a multilingual application in .NET can be summarized as the
following.
·
Create a resource file for each locale.
·
Save the resource files with a .resx extension.
·
Compile the resource files using resgen utility of .NET SDK to
create a compiled binary resource file.
·
Create satellite assembly using al utility of .NET SDK.
·
Create folders for storing the satellite assembly and store the satellite
assembly there.
·
Read resources from the satellite assembly in the application's
source code.
First, we have to create culture specific resources in
resource files. Then we can store the culture specific data in the resource
file and save the same with a .resx extension. Note that the culture name
should be provided in the resource file name to follow the resource file naming
convention. We can use Visual Studio .NET to create a resource for a
particular culture. Resource files have been explained in more detail earlier.
Let us assume that a file Internationalization.en-GB.resx be created for en-GB
culture and compiled (as shown in listing 4) to create the Internationalization.en-GB.resources
file. This file is the complied resources file. This compiled resource file
can be used to create a satellite assembly. This satellite assembly can then
be used by the application. Refer to code listing 9. The file Internationalization.resources.dll
is a satellite assembly. This satellite assembly should now be placed in a sub
folder inside the application's main folder and the name of this sub folder
should be the same as the name of the culture that the satellite assembly is
targeted for. This satellite assembly can now be used to display locale
specific information in the application.