Multilanguage website
I want to change language of my website from drop down list when user selects Hindi/ English language option. Can anyone tell me how to do it ?...As whole page contents should be changed from English to Hindi or any other language that user selects...Please help me...
neelPosted Mar 12, 2013, 3:53 AM
Thanks for your support. I want to change language using drop down list when i select hindi/ marathi that language should appear like this.
by using resource file can i change any text that appears on web page e.g.
elements etc...?
Vishal GilbilePosted Mar 12, 2013, 2:54 AM
For doing this you either can make use of Google Translation Service or you can make use of Asp.Net feature named as Localization or globalization.
Talking about localization; in this case you yourself have to create a resource file for whatever languages you want you webpage to be displayed and while creating resource file you, yourself have to specify the control values (text in that specific language) which are there on the page. For eg if you setting it for language hindi then in that case in may page there are 5 control then I'll have to specify 5 values of those control in hindi in resource file.
Now to do this, follow the steps.
1. Go to any .aspx page whose you want to display it in different language let assume the page name is Default.aspx
2. Go To Tools menu and select Generate Local Resource option.
3. It will generate local resource for your website and the resource file will be placed inside an special asp.net Folder named App_LocalResources and the resource file name will be Default.aspx.resx.
4. Copy the resource file and paste it in the same folder. Now you'll be having two folder in your App_LocalResources
5.Now rename the pasted resource file and specify the name as Default.aspx.fr.resx. Over here we are trying to create a french version of our website that's why the extension fr.resx.
6.Now double click the Default.aspx.fr.resx you will see that the control which are there on Default.aspx page will be listed and you are required to specify value for those controls in french version of your website.
7.After specifying the value just specify UICulture="auto" in Default.aspx page attribute.
8. Now try to run the website you'll by default see the english version of your website. This is because your browser's language is specified as English-UK.
9. Just change your browser's language to french [Fr-fr] and move it to first location in browser's language and just refresh the page.
10. Now you will see the french version is being displayed for your Default.aspx page.
Hope that solves your problem. Kindly mark the answer as accepted it it helps you so that other's can use the same solution if they are facing similar problem.
With Regards,
Vishal Gilbile.