<%@ page title="" language="c#" masterpagefile="~/masterpage.master" autoeventwireup="true" codefile="amenities.aspx.cs" inherits="amenities"%> <asp:content id="content2" contentplaceholderid="contentplaceholder2" runat="server" > <div> change language <br /> <asp:dropdownlist id="dropdownlist1" runat="server" autopostback="true" > <asp:listitem value="en-us">english</asp:listitem> <asp:listitem value="ur">urdu</asp:listitem> <asp:listitem value="fr">french</asp:listitem> </asp:dropdownlist> </div> <div> <img src="images/2.jpg" style="position:relative;top:20px; height:300px;" /> <p style="position:relative;left:454px; top: -300px; width: 619px;"><asp:label id="label2" runat="server" backcolor="<%$ resources:resource, bcolor %>" forecolor="<%$ resources:resource, fcolor %>" text="<%$ resources:resource, text %>" ></asp:label></p> <br /><img src="images/3.jpg" style="position:relative; height:305px; top: -120px; left: 2px;" /> <p style="position:relative;left:456px; top: -443px; width: 619px; bottom: 2332px;"><asp:label id="label1" runat="server" text="label"></asp:label></p> <br/><img src="images/4.jpg" style="position:relative;top:-180px; height:330px; left: 5px; width: 450px;" /> <p style="position:relative; top: -530px; left: 460px; width: 617px;">the spectacular happens @ of our hotels , resorts in 80 countries across 6 continents. let find 1 that’s right you. five-star international islamabad marriott hotel located @ foot steps of famous margalla hills , within close proximity rawal lake, town centre, president & prime minister houses, ministry of foreign affairs, senate, parliament house, foreign missions, world bank, government offices, corporate sector, print , electronic media offices etc. hotel favourite rendezvous of politicians, diplomats, businessmen , movers , shakers of country. owing perfect location of hotel, hardly takes half hour commute between hotel, islamabad international airport , places of interests.</p> <br/><img src="images/5.jpg" style="position:relative; top: -372px; left: 488px; width: 587px; height: 249px;" /> <p style="position:relative; top: -638px; left: 1px; width: 481px;">the all-day dining restaurant offers extensive selection of international & local flavors on la carte menu buffet available breakfast,lunch,hi-tea , dinner.the restaurant popular business lunches,casual dinners , sunday brunch</p> <br/><img src="images/6.jpg" style="position:relative; top: -424px; left: 485px; height: 276px; width: 590px;" /> <p style="position:relative; top: -718px; left: 2px; width: 478px;">a authentic japenese restaurant. dine not savour sumptous flavour spectacular design makes feel in japan. sakura made capture heart , soul imagination. jason's steakhouse concept centered around exceptionally high quality food , warm elegent atmosphere. serve best steak available , uncompromising quality.two private rooms, both capacity of 04-persons.</p> </div> </asp:content>
i trying use globalization in asp. have created 3 resource files, fr
,ur
, resource
. languages changing through selecting through drop down list, have change other language on same page using drop down list.
box1
language changed, how change box2
language?
have problems in resource
file how put 2 3 , 4 text in same resource fr
resource file , how link label each resource file different label.
http://prntscr.com/72uhug please see screenshot http://prntscr.com/72um08 resource file screenshot
firstly, make acquainted concept of globalization here
, understand use of global , local resource files handle kind of requirements have. 1 simple definition given here too
.
so, in short, should better generate local resources each language , override initializeculture()
method set page's uiculture
property choose appropriate language specific file , when dropdownlist
selection changes.
step 1: generate language specific resource files (.resx
)
- select option: tools -> generate local resource in visual studio. if suppose aspx file named:
default.aspx
, visual studio creates new folder namedapp_localresources
, , withinapp_localresources
folder, new file nameddefault.aspx.resx
. indefault.aspx.resx
, should put neutral languge( english) text. next, create resource file specific french language
in solution explorer, right-click
default.aspx.resx
file, and
click copy.right-click
app_localresourcesfolder
, , click paste.visual studio creates file named
copy of default.aspx.resx
.rename
default.aspx.fr.resx
. resource file represents page content in french language.open
default.aspx.fr.resx
, add french text.same way create language specific resource file urdu. [ file name be:
default.aspx.ur.resx
]
step 2:
keep in mind asp.net pick appropriate language specific resource file based on pages' uiculture
value. set uiculture
property of page, must override intializeculture()
method , set property there:
// use request.form["dropdownlist1"] access dropdownlist value
protected override void initializeculture() { if (request.form["dropdownlist1"] != null) { string selectedlanguage = request.form["dropdownlist1"]; uiculture = selectedlanguage ; culture = selectedlanguage ; thread.currentthread.currentculture = cultureinfo.createspecificculture(selectedlanguage); thread.currentthread.currentuiculture = new cultureinfo(selectedlanguage); } base.initializeculture(); }
read here
detailed tutorial on creating multilanguage websites asp.net
Comments
Post a Comment