Here is a small sample on how to support globalization and localization on asp.net.
create a text with some strings with key and value pair.
greeting_lblMessage = Hi, Welcome back to my application.
save this as anything with culture code appended to it separate with comma, such as strings.en-US.txt
to the application's root directory.
open a visual studio 2005 command prompt and type in
Code:resgen strings.en-US.txt strings.en-US.resources
Add this code to Page_Load event handler of a asp.net page to use the resource created above.
Code:ResourceManager resmgr = ResourceManger.CreateFileBaseResourceManager("strings", Server.MapPath("."), null); lblMessage.Text = resmgr.GetString("greeting_lblMessage"); resmgr.ReleaseAllResources();
Finally, do not forget to import the namespace required for code to work.


LinkBack URL
About LinkBacks

Reply With Quote

Bookmarks