Hi everyone, I'm looking for information on possible approaches to site localization, and trying to figure out which would be the best. So far, all articles I found seem to describe the use of resources to handle the localization, so this would be the way to
go (probably). What I'm trying to localize is an ASP.NET web application. Now I see two possible approaches to this, one is the above mentioned approach utilising resources. But this way, what to do with the static content in the .aspx and .ascx files? Replace
all static content with label controls, and set their Text properties in the Page_Load handler? This doesn't seem to be the best way. A nice workaround seem to be to create a separate sets of the .aspx and .ascx files for each language, and since the code
is compiled in a dll they would all share the same code. The problem with this approach is that the localized messages that are used in the code would have to be stored elsewhere, probably using resources, resulting in a mixed approach: some localized strings
in resources, and some directly in localized versions of .aspx and .ascx files. But this doesn't just sound right to me. I'd highly appreciate any ideas! Thanks, Rado
After reading through some articles on localization, resources definitely look like the way to go. The question is how to do it. :) Did anyone try to use the Enterprise Localization Toolkit? http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/entloctoolkit.asp
Looks very nice, but I'm a little concerned about the non-standard resource format. Rado
I have used the Enterprise Localization Toolkit on 3 projects and have been very happy with the decision to use it. The localization manager app is workable - not to mention a nice self demonstrating web app - but needs tweaking to solve some irritating usability
issues. I am currently using the toolkit for an online game that is in development (in this case the resource files for the languages will be shared between the ASP .NET web app and a Windows desktop app). Andrew
I work for a translation and localisation company (thebigword -
http://www.thebigword.com) - I designed and developed the site in 8 languages. I decided against the use of resource files as I felt that it would be tricky to manage multiple resource files since they need to be compiled and that a more flexible approach
was needed, since content should be updated regularly on a Website. I decided to store the information in a database (SQLServer in my case) which also provides a search facility. I decided to create a custom Page base class which loaded it's META keywords,
author and description from the database and also provided header and footer facilities. This allowed the facility to translate keywords and META information into our target languages. This was stored as an XML document in the database so that I could simply
deserialize it into my PageSettings class. I then created a set of custom controls which inherited from the standard label, literal, button etc. controls and then I either overrode the Render function to load content from the database based on the name of
the page name and control ID. The language the content is returned in was selected from the language preference the user has set up in their browser. If this is not present, the user must select a language from a splash page. I think that this is a much tidier
solution than having to have code to load up the content into controls littered around your code. In Visual Studio .Net 2005 implicit localisation makes this step unnecessary from what I've seen. I can't stand using the RESX editor in Visual Studio .Net 2002
/ 2003, it's awful! Where the content for the control was complex, such as for drop down menus, paned lists, news tickers or for other controls, the data was stored as XML in the database so that I could deserialize the XML content directly into a class. The
really good bit is that all of the content for the Website is kept in the file system... I wrote a Windows Service which periodically looks through a set of directories which mirror the data in the database. If a file is different than it's corresponding record
in the database, the database is updated. If a file is present in one language and not another, then the service actually sends the file for human translation using our XML Web Services (http://www.thebigword.com/TranzManagerContent.aspx)
and then collects it when it's finished. It really helps to streamline the translation process. The XML and HTML files which I stored in the database were easy to get translated since I could use Trados to "protect" the tags in my HTMl and XML documents whilst
getting the benefit of Translation Memory. A great feature is of ASP.Net is that you can output your Japanese as if it was any other language because of the use of UTF-8. No more Shift-JIS! I hope you find that interesting!
I've been researching how to build localizable websites for an upcoming project and i'm curious as to how did you store the xml content inside the database. I've learned alot from Karl Sequins article on
multilingal websites but i can't get his app to work using a database instead of an xml file. Do you you how to do this?
Thanks
Well, my approach was very similar to Karls, the idea of creating a set of controls to create something similar to the implicit localisation available in Visual Studio .Net 2005. However, I'm afraid that I can't spare the time to look at his article and rewrite
it to store the text in a database.
One of the main reasons I store my text in a database is so that I can search the content easily using SQLServer, which makes for a good Website search engine.
I store my serialized XML classes within the database using ntext columns.
I was also thinking about the xml approach using karl's article, but i'm incorporating this into a 200+ page & growing site. So I needed a way to manage the xml documents needed to create the pages. I figured a database would be the best alternative.
Question: Does your site use XSLT to create its pages, if so how do you incorporate VS.Net web controls into the pages? Also how do you wire events to those controls rendered through xml + xslt?
Ah, well usually I just store sections of a HTML page in the database and only store XML in there if the control is more complex, for instance, a dropdownlist control requires both the value and text to be present. As such, I created a class which represents
the values of a dropdownlist:
[Serializable]
public class ListItem
{
public string Value;
public string Text;
public bool Selected;
}
public class ListItemCollection : System.Collections.CollectionBase
{
...
}
Then I serialized the collection of ListItem objects to XML and stored them in the database. I then used a custom control (which just inherits from the dropdownlist) which loads the XML from the database and serializes it directly into a class which it uses
to fill itself on the page load event. In that way, you can use all the features of the standard controls, except that they load their content from the database.
The database looks like this:
ID, Path, ISOCode, Data
Each control loads it's value based on the page name and its own ID. So, on page login.aspx, the password label would load its text from the database where the path (a text field) was: Login/lblPassword.html, if there was a country selection dropdownlist on
the same page the dropdownlist control would load its data from Login/cmbCountryList.xml - if that makes any sense!
The controls know which language is the user's preference by storing a variable in the session object upon Session Start. If the user does not have a language preference set up, then they are redirected to a language choice page which sets the variable, then
they are redirected back once they have selected a language..
immutability
Member
185 Points
37 Posts
Site localization - best approach?
Sep 10, 2004 04:13 PM|LINK
immutability
Member
185 Points
37 Posts
Re: Site localization - best approach?
Sep 13, 2004 07:09 AM|LINK
FirstCitizen
Member
5 Points
1 Post
Re: Site localization - best approach?
Sep 17, 2004 05:56 PM|LINK
AdrianHesket...
Member
154 Points
31 Posts
Re: Site localization - best approach?
Sep 22, 2004 02:23 PM|LINK
bruh_man
Member
47 Points
13 Posts
Re: Site localization - best approach?
Aug 01, 2005 03:19 PM|LINK
Thanks
AdrianHesket...
Member
154 Points
31 Posts
Re: Site localization - best approach?
Aug 03, 2005 09:54 AM|LINK
One of the main reasons I store my text in a database is so that I can search the content easily using SQLServer, which makes for a good Website search engine.
I store my serialized XML classes within the database using ntext columns.
Joël Hébert
Contributor
4624 Points
679 Posts
MVP
Re: Site localization - best approach?
Aug 04, 2005 04:02 AM|LINK
www.caseware.com
www.caseware-idea.com
www.caseware-idea.nl
all examples
if you want more details let me know.
Opulent ASP Development Inc.
www.opulentasp.com
Ottawa,Canada
Click "Mark as Answer" on the posts that helped you to help future readers to get the solutions
bruh_man
Member
47 Points
13 Posts
Re: Site localization - best approach?
Aug 04, 2005 01:45 PM|LINK
Question: Does your site use XSLT to create its pages, if so how do you incorporate VS.Net web controls into the pages? Also how do you wire events to those controls rendered through xml + xslt?
Thanks
Joël Hébert
Contributor
4624 Points
679 Posts
MVP
Re: Site localization - best approach?
Aug 04, 2005 05:36 PM|LINK
_contentXml
In this you create a structure that is the same as the site. you insert the xml in here and in the aspx pages you create
contentWrite functions that go and retrieve the text and write to the page
for simple text you can use the ressource files (resx or a xml dictionnary)
use a dictionaryWrite funciton.
for the xml here is an example, you use xpath to get the content element and grab the label that is what you paste into the aspx with the function
<contentdef>
<contents name="ca-en" region="ca" language="en" lcid="4105" default="true">
<title>blahbalbh</title>
<content label="content">
<![CDATA[
Opulent ASP Development Inc.
www.opulentasp.com
Ottawa,Canada
Click "Mark as Answer" on the posts that helped you to help future readers to get the solutions
AdrianHesket...
Member
154 Points
31 Posts
Re: Site localization - best approach?
Aug 05, 2005 08:14 AM|LINK
[Serializable]
public class ListItem
{
public string Value;
public string Text;
public bool Selected;
}
public class ListItemCollection : System.Collections.CollectionBase
{
...
}
Then I serialized the collection of ListItem objects to XML and stored them in the database. I then used a custom control (which just inherits from the dropdownlist) which loads the XML from the database and serializes it directly into a class which it uses to fill itself on the page load event. In that way, you can use all the features of the standard controls, except that they load their content from the database.
The database looks like this:
ID, Path, ISOCode, Data
Each control loads it's value based on the page name and its own ID. So, on page login.aspx, the password label would load its text from the database where the path (a text field) was: Login/lblPassword.html, if there was a country selection dropdownlist on the same page the dropdownlist control would load its data from Login/cmbCountryList.xml - if that makes any sense!
The controls know which language is the user's preference by storing a variable in the session object upon Session Start. If the user does not have a language preference set up, then they are redirected to a language choice page which sets the variable, then they are redirected back once they have selected a language..