| Author: Ramesh 05 Sep 2008 | Member Level: Silver | Rating: Points: 6 |
Hi,
For making your application global, you need to create a resource file for each language your applicatin supports. for instance if your application supports english and french then you need to create 2 resource files.
The resource file content will be in a key value pair format. The key will be common for all the languages and the value should contain the exact info which you need to display for that language.
Suppose you need to display a message "Welcome" in a label Your English Resource file will be: Key: labelText Value: Welcome
Your French esource file will be: Key: labelText Value: Welcome in french
Code: Create instance for ResourceManager and CultureInfo classes.
Dim rm As New ResourceManager("rmc", [Assembly].GetExecutingAssembly()) Dim ci As New CultureInfo("en-US")
label1.Text = rm.GetString("labelText", ci)
-- rmc is the name of the resource file which will be converted into satellite assembly once you build the application.
This will display the English Message. you can dynamically change the culture and just pass the culture info to the Resource Manger's Getstring method.
For more detailed Info: http://msdn.microsoft.com/en-us/library/system.resources.resourcemanager.aspx
Thanks, Ramesh
|