Last post Oct 27, 2010 01:53 AM by sannhto
Oct 21, 2010 09:01 AM|sannhto|LINK
I'd like to make a site with multiple languages, but I don't have the full Visual Studio suite. I'm using VWD Express. I was wondering if I still can use resource files for translation. It's will probably require some more manual labour, but is it possible
to have several resource files and a session variable to decide which resource file to use? On the master page you'd have for example a dropdownlist to choose the language... Or what is another way to do it "manually"?
Thanks for any replies!
Oct 26, 2010 08:31 AM|Huske|LINK
When you create a web project or web site, you can right click on the project name and choose Add ASP.NET Folder. From the menu select App_LocalResources and/or App_GlobalResources.
Inside the App_LocalResources you will put the translation of your page. Let's say that you have a page called UserInformation.aspx and you want to localize this page. Right click on App_LocalResources folder and choose Add New Item... When an Add New Item
- Resources dialog box appears choose Resource File and name your file as UserInformation.aspx.<language>.resx. For example, <language> can be en-US for US English, en-UK for the UK, fr-FR for French, etc.
Now fill the Name of the control and its property and enter a translation in the Value part.
Your next step is to modify the page. For example, to modify the Text property of a label you would declare the label like this <asp:Label ID="lblInfo" runat="server" Text="<%$ Resources:InfoTitle %>
The biggest part of your work will be to specify how to detect language settings. Will you let a user specify the language via a drop-down box or will you let the user specify in the browser the languages that it accepts, or you could set the globalization
settings in web.config or by using <%@ Page Culture="" CultureUI="" %>
This is a pretty big subject and you should check MSDN for more information or get a book ASP.NET 3.5 or 4.0 Unleashed by Stephen Walther.
Oct 27, 2010 01:53 AM|sannhto|LINK