Skip to navigation

PCPro-Computing in the Real World Printed from www.pcpro.co.uk

Register to receive our regular email newsletter at http://www.pcpro.co.uk/registration.

The newsletter contains links to our latest PC news, product reviews, features and how-to guides, plus special offers and competitions.

Real World Computing

Out with the old

Posted on 28 Apr 2009 at 10:26

Mark Newton wonders whether change is always for the better, and defends the difficult practice of web hosting.

The site was to support ten languages, so for each page I'd need ten resource files. I considered using such resource files to handle my translated text, but after due consideration the thought of maintaining one file per language per page sounded like the admin job from hell. For one or perhaps two extra languages it might work for you, but I needed an easy-to-maintain solution that could handle UTF-8 character sets so that languages such as Polish would be correctly rendered. I considered generating the resource files directly from a database, but decided to go the old route of storing the various phrases in a database with a separate record for each language. Using this technique meant I didn't need to convert all my old ASP pages to ASP.NET to get resource files into them.

Once again, I'm baffled that Microsoft provides a mechanism like resource files without the ability to easily create them on-the-fly from a database, as an alternative to creating a huge collection of files of which a lot of the content would be similar for each page. Since ASP.NET is extremely extensible, I'm sure some reader will write in to tell me that I could write a class that hooks into some obscure system call that will achieve what I want. While my attitude is that it's great to have such flexibility, in my experience software vendors fall back on this as an excuse after releasing incomplete products, saying you could always "write that functionality yourself".

Did my solution work? Yes, like a dream, except for the button control in ASP.NET. It seems that this fully multilingual operating system, coupled with multilingual development tools, still has some problems. Before I go into detail about this, let me explain how I got the various translations into the system. First, an Excel spreadsheet is set up, with a separate column for each language, and the English text for each phrase is entered into its rows. The sheet is then sent off to our translators around the world and comes back via email attachments. All the translations are combined into one master sheet that's then imported into a table in a Microsoft SQL Server 2005 database. This database is used to replace any text on the web page. The Dataset on the web page is a select query returning just one record containing the text phrases in the desired language, and the relevant column is displayed on the page. It's worth noting here that it's a good idea to forget your usual naming convention for database field names and instead pick something that gives you an idea of the text each field contains, since this will make it so much easier to understand your page in the future. For example, this scheme makes it easier to understand what text goes where:

than this more conventional version:

So far so good, and both Excel and SQL Server seemed to fully support all the characters we needed. The ASP pages seemed to as well, although there was an occasional drop out of certain accented characters to be replaced by their non-accented cousins, something both I and the client decided to live with. However, while most of the ASP.NET Framework 3.5 SP1 controls were happy, the button control didn't like the Polish ? character (and probably others too), and the Grid View control exhibited the same glitch, while the label control was happy to display it.

1 2 3 4 5
Be the first to comment this article

You need to Login or Register to comment.

(optional)

Mark Newton

Mark Newton

Mark is a contributing editor to PC Pro and managing director of the internet company ECats Ltd (Electronic CATalogueS). He specialises in internet-based solutions, often working with design houses. He works from a Victorial railway in deepest Suffolk.

Read more More by Mark Newton

advertisement

Latest Real World Computing
Latest Blog Posts Subscribe to our RSS Feeds
Latest News Stories Subscribe to our RSS Feeds
Latest Reviews Subscribe to our RSS Feeds

advertisement

Sponsored Links
 
SEARCH
SIGN UP

Your email:

Your password:

remember me

advertisement


Hitwise Top 10 Website 2008