Lets Have a fun with Technology.

BTemplates.com

Follow by Email

Saturday, May 29, 2010

how to make website for multi Language support in asp.net (Resource Example in asp.net)


Hello Frd's

Here i am going to dicuss how to make multi support language in a asp.net.

In a asp.net multi support language supported build using resources.

there are two type of resouce in asp.net global resource and  local resource we will dicuss resources later.

to build multi language support in a asp.net there are two classes are use :-

1. Culture  and 2. UICulture.

Culture providing information related to Datetime,currency etc..  setting ofr multi langugaes. while UICulture are related to UI that means it's deal with a resources.

to set specified language in a web site you can give culturre setting in a globally web.config

"
< globalization uiCulture="es" culture="es-MX" / >"
 
 
Now lets see how to set multi language support from code behind.
Lets take one example :-
First Create One page Default2.aspx and suppose we want two language support in our application
 
Suppose English and Swedish language. 
So create resource for both in a local resource.



hear kepp in mind the resources name and extension.
currently for English there are resource name is same as a page name.

Page name :- Default.aspx
Resource file Name :- Default.aspx.resx
 
For Swidden language.
Resource file Name :- Default.aspx.sv.resx



Now lets put one label on a page. and set meta:resourcekey


 
Now you have to set culture in  Page_PreInit of a page. For better utilization you defaine it in a One base Page and Imherit other page from this basepage.



Where en-US  values for English / United states some other language are as below.

Language = "German" Value="de-DE"

Language ="Spanish" Value="es-ES"

Language ="Swedish" Value="sv-SE"


Language ="United States - English" Value="en-US"
Now lets run the application
 
 
 



Now lets apply second langugae swidden.


 




Hop you getting.

if you hasve any query let me know

Enjoy !!!!!!!!!!!!!