Can somebody please give me some guidance and direct me to the papers that I should read to globalize my ASP.Net application.
I have developed a web site, www.famnet.org.nz, using VS 2008. Now I have interest from a European country in this site - but they want it in their own language. I have developed the site without thinking of globalization, so there is English text: -
1. Embedded in the .aspx pages. For example, Appendix 1 shows part of the Home page. Within this there are object references and values that should not be changed, and text values that are in English and should be translated. I have highlighted the bits that would need translation in green.
2. Embedded in program code, where (for example) the program assigns a value to a label’s text: -
lblmessage.Text = "Invalid record key, so no record to display. Click Return"
3. Help pages which are written in English, but are simply html. These would seem to pose few problems, as it would be easy to provide versions in other languages.
4. Text that is derived from the database-derived, for example
lblOwner.Text = " (Record owner:" & trINDI.INDIUserName & ",Source:" & trINDI.INDIGedFile & ")"
Even if the constant parts of this, “Record Owner” and “Source”, were translated, presumably the database values would not be.
So where do I start?
Thank you, Robert Barnes.
<%@ Page Language="VB" MasterPageFile="~/GDBMaster.master" AutoEventWireup="false" CodeFile="Home2.aspx.vb" Inherits="Login_Pages_Home" Title="Home" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<asp:Label ID="lblMessage1" runat="server" Style="z-index: 104; position: relative" /><br />
<asp:Button ID="btnIntro" runat="server" Text="Introduction"
ToolTip="Register/Logon,Introduction,What's New,How do I join?" />
<asp:Button ID="btnSponsors" runat="server" Text="Sponsors" />
<asp:Button ID="btnGDB" runat="server" Text="Genealogy Database" Width="139px"
ToolTip="Look up People by Name, Reopen Last GDB Record, Add or Update Your Family Data, Manage Your GDB Data, Genealogy Charts, also FamNet Combined Database Search" />
<asp:Button ID="btnDatabases" runat="server" Text="General Resource Databases"
ToolTip="FamNet Combined Database Search, Useful Web Sites, Publication, Shipping-Voyages, Shipping-Passengers" />
<asp:MultiView ID="mvw" runat="server" ActiveViewIndex="0">
<asp:View ID="mvwIntro" runat="server">
<div align="center" style="float: right">
<asp:Panel ID="pnllogin" runat="server">
<uc:LogRegister ID="LogRegister" runat="server" />
<asp:Panel ID="pnlLogonText" runat="server">
<div style="float: right">
Tell your Story!</h2>
Find your Family!</h2>
Welcome to FamNet, the on-line Family History Network for those with a New Zealand connection!
Robert Barnes I don't think is there any possibility to convert whole website to other languages? You need to create resources file and also need to redo most of the work. Easiest option is to use google translator to change whole website to any other language but googles header is present there Have a look:
I changed it from English to Dutch from here:
ASP.NET provides a fairly simple, but powerful, localization story, based around resources. Any controls on the page can be automatically localized by Visual Studio, which can analyse a page (one by one) and generate the resource files, which can then be duplicated. Static content on pages, such as text, can be wrapped in an <asp:Localize> control, so when VS does it's work these too generate resources. Once you've generated your resources, you copy the resx file to a new one with the appopriate culture, translate it (see http://guysmithferrier.com/post/2009/09/Automatically-Translating-resx-Files-Using-Microsoft-Translator.aspx for a cool way of automating that), then deploy your application. Which resource file gets used can be customised, but by default it's the browser country; it's trivial to customise this though, so that users pick the language.
Full HTML pages can not be catered for this way, since the above procedure is ASP.NET based, so yo'd probably have to translate each page and keep a separate set of pages for each language.
To start with, head to the quick starts: http://quickstarts.asp.net/QuickStartv20/aspnet/doc/localization/default.aspx
Thanks Dave, that looks to be exactly what I wanted. No doubt I'll be back for more questions when I've read it :-)
Dave, a follow-up question.
Dave SussmanStatic content on pages, such as text, can be wrapped in an <asp:Localize> control, so when VS does it's work these too generate resources.
In Visual Studio I viewed an aspx page in Design view, clicked menu Tools/Generate Local Resource, and the system generated the resource files for me beautifully for label and button text, tooltips, etc. However the text embedded within the page was not extracted to the .resx file, except for a couple of bits that I had expermentally put within Localise tags, like <asp:Localize ID="Localize1" runat="server">text here</asp:Localize>. Exactly as you described.
Is there any option or tool that will automatically insert these Localize tags around embedded text for me, or is there no alternative to manually editing the page.
What are the relative merits of Localise and Label tags?
Thank you, Robert.
Nope, no tool, you have to do it yourself. In a way this makes sense, because how could VS know what you wanted to localize?
In reality there's not much difference between using Localize and a Label; certainly not for small pieces of text. For large text blocks, such as paragraphs, I'd probably use Localize. In fact, for anything, even small blocks that are just static text, I'd probably use Localize because the intent is clear; Label mens "I'm explicitly using a label", localize means "this is just text, but I want it localized". It's a subtle difference, but for anyone looking at your codeit's clearer.
Also Label means it outputs as a span (or a label when associated with an input control), while Localize doesn't emit any html itself; so using Label could change the html generated.
See Microsoft Article ID 917414 currently found here:
and "ASP.NET Globalization and Localization" currently found here:
Also see my localization product at http://www.hexadigm.com. It's a Visual Studio add-in and standalone translator's app that makes the job of translation extremely easy.