ASP.NET and Localization

Posts   
 
    
Jabra
User
Posts: 5
Joined: 13-May-2008
# Posted on: 14-May-2008 16:37:48   

Hi!

Anyone have any suggestions how to handle localization for ASP.NET controls like gridviews, to display values/names depending on the selected language? In combination with a MS SQL server..

Guess this might be a challenge simple_smile

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 14-May-2008 16:57:49   

It depends on your database design, and how ndo you persist different languages/values. There are many options, here is one of them:

For example if you have the following table for Customers.

Customer ------------ Id (PK) EnglishName ArabicName OtherFields.

And at runtime you want to display either the ArabicName or English name based on user settings.

My favorite approach is: - Since you might already have string tables (GlobalResources) to hold values for labels and system strings. - You may insert the field name as well (en: EnglishName, ar: ArabicName)

And call it frm the aspx as follows:

<aspsmile ropDownList ID="Countries" runat="server" DataSourceID="CountryDataSource" DataTextField="<%$ Resources:Strings, CountryName %>" DataValueField="id" > </aspsmile ropDownList>

Jabra
User
Posts: 5
Joined: 13-May-2008
# Posted on: 15-May-2008 08:03:41   

Good example!

Might be a bit too simple for my approach, i also have user-inserted fields, with the option to set two different languages for the name of the discipline. And these will mostly be used in gridviews..

If this help:

Discipline

DisciplineID PK Discipline

DisciplineMetadata

DisciplineID PK MetadataID PK

Metadata

MetadataID CategoryID NorwegianValue EnglishValue

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 15-May-2008 09:36:32   

I guess you need to do pivoting, rght?

So you have 2 options: 1- Manually in code. 2- In database if it supports (Pivoting).

Please check the following thread for more details: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=7816