Handling Multiple User Languages?

Posts   
 
    
Emmanuel
User
Posts: 167
Joined: 13-Jan-2006
# Posted on: 01-Mar-2007 14:04:42   

My application supports two languages (English and French). Database tables for the app contain columns with a suffix of "_e" and "_f" to designate those text fields that are English or French.

The web interface includes many pages where read-only views of the data are displayed. The web interface also includes the ability to switch between English and French at any time so I need a convenient way to populate controls with either the English or French data.

How should I implement this? I don't want to simply create English and French versions of each View as this would cause double the work in creating SQL Views and will result in 2 entity classes. I also don't want to create a single view that would require code that differentiates between English and French fields.

I'd like some sort of parameterized method where I could simply pass the app's current thread's UICulture and magically get the right fields but have no idea how to do this.

Any suggestions?

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 01-Mar-2007 15:55:15   

I'd say that some effort or work is needed anyway.

An option is to handle this in the GUI, i.e. fetch views with both languages and bind to those that match the current application language. So you'd be switching the databinding between '_e" fields and "_f" fields..

Another option is to use DynamicLists, and since DynamicLists fields are created at runtime, you can either add the "_e" fields or the "_f" fields according to the current language. And you'll always bind to the same fieldName/alias of the DynamicList.

Emmanuel
User
Posts: 167
Joined: 13-Jan-2006
# Posted on: 03-Mar-2007 17:41:07   

As I read your email, I realized that I could simply do something like <%# Eval("Name" + Lang == "en" ? "_e" : "_f") %> wherever I'm binding a column (which is undoubtably what you were saying).

Don't know why I was making this so complicated for myself. Walaa, thanks for bringing me to my senses!

The Dynamic Lists is also a good idea that I might need in some particular special cases. I hadn't even looked at that part of llblgen before.