C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




globalization


Posted Date: 05 Sep 2008      Total Responses: 1

Posted By: barun       Member Level: Bronze     Points: 1



hi experts .i m working in asp.net . i want to implement globalization. how to set culture for a label.i m using Thread.CurrentThread.CurrentCulture =new CultureInfo("en"). now i want to print some value on the label in that specified language .i m not getting whta to write in label.text property.
plz help me.


regards
thanks in advance





Responses

Author: Ramesh    05 Sep 2008Member Level: SilverRating:     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





Post Reply
You must Sign In to post a response.
Next : To Vipul
Previous : how to ristrict the image size to height=400 and size=600
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use