views:

339

answers:

3

As the question is a bit self explanatory, I want to achieve the goal of a multi-language website. I am using an Entity Data Model with MS SQL 2005. I came up with an idea of making a seperate database for each language with exactly the same model and relations. So I can use the Entities constructor that takes a connectionString and switch the site to the selected language.

I am using an ascx as the language control that fires an event, and the parent aspx gets the selected language as an integer (from event args) and call the method containing the same linq queries but Entity context will be created with the connection string of that db (of language)

I could only came up with this solution, because I think adding a new language will require a replication of the english one, imported to Access and sent to the translator. Then will be exported back, and the model will fit (HOPEFULLY).

My question is if this is really a good approach or am I missing anything that will create greater hassle to me. Thanks in advance

+1  A: 

Hi Emre

multi-database is not a good solution as soon as entities within the different databases have relations to each other. Generally a good approach is to work with labels in one default language. These labels can either be in a well defined format (e.g. 'LABEL.TEXT_HELLO') or just in the base language (e.g. 'Hello World').

So all you have to do is building a table for translations where the base language is the key and hopefully there is for each key a value containing the translation. As soon as you have the translations, you can write a method ont he frontend which writes the labels in the language used by the user.

In Zend Framework for example, you have to write <h1><?= $this->translate('Hello World'); ?></h1> instead of just <h1>Hello World</h1> The good thing about that is, that if ya translation is missing, you can still use the fallback (in this case english) to show the user at least something.

That way, you can manage your app in one database and users who speak several languages do not have to switch between applications and content.

cheers

Marc
What are those things? :) ... $this->translate('Hello World');
Emre
hi emre, that was just an example in PHP. you just have to call a method instead of writing plain text. So that wrapper function will do the translate for you and you can write your app in a single language.
Marc
A: 

My approach: create a table Language that lists all the available languages. Relate each table that should be localized to Language. Now, you can easily access the localized content e.g.

Content[content_ID].HeadLine.Where(hl => hl.Language.id == "en-US")

I look forward to see what other people as I myself is still learning DB design and EDM.

Christian Madsen
A: 

OK, if you want to be able to easily implement a new language, then reinventing the internationalization features already built in to ASP.NET is not the way to go, because it isn't "easy".

At least, not as easy as using a satellite resource DLL. Your translators will use off-the-shelf tooling to translate your resources, and ASP.NET will automatically select the correct DLL based on the user's current culture.

Read up on ASP.NET internationalization/globalization features; there's no need to invent your own.

Craig Stuntz