Solved

Multiple Language issue (English, Dutch, German, French) C#

Posted on 2007-04-03
13
945 Views
Last Modified: 2010-05-18
Hi expt,

I am dealing with multiple languages issue within pages (English, Dutch, German, French). Each page's controls  will have to be loaded upon the selected language. there can be Spainish and Vietnamese in addition (so ...pretty much)

There are several option which are:
- using Database (kinda slow, and have to use cache) but more maintainable
- using XML (the best so far)
- using ASP.NET build-in Localization and globalization (I don't  really like this)

Can you give me an idea, which way is the best, and give me a small hint how should I implement this (example or link), just brief is enough and appreciated.

It doesn't  have to be one of these 3 methods. And, I am using ASP.NET 2.0 C#

Thanks in advance,

JINN
0
Comment
Question by:jinn_hnnl
  • 7
  • 6
13 Comments
 
LVL 19

Expert Comment

by:DreamMaster
ID: 18843064
Best is very relative in my opinion.

At the company I work at we have our own Content Management System, which we made ready for multiple languages by using a class Language, this class contains everything for every language we want to add. Depending on the chosen language, we change the languageID. Things like variable names, fieldnames etc...We could combine this with Globalisation and Localisation, but chose not to. We made this choice because a lot of things can not just be defined by country. For example if the price for a product is in euros, you could replace the notation to that of pounds sterling, but it would be the wrong price.

Now obviously you could reach the same effect using XML, it's more or less a matter of personal preference.

Regards,
Max.
0
 
LVL 10

Author Comment

by:jinn_hnnl
ID: 18880739
Hi Max,

Thanks for the suggestion. I have been busy implementing some other stuff and then it was Easter ... Now I have to come back to this...

Your idea about storing language information in Code behind seems interesting. But isn't it hard for maintainance (they will have to access the source code in order to change ...). But I think for button or lable Text ... I would follow your suggestion.

What I am wondering is: how you store it, and track it through languageID ???... in ArrayList or ... Can you give me a little more example ?
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 18884032
You could even combine the use of codebehind with a database.

How about creating a database table which has all your lables in different languages. Get the correct labels etc using a simple query based on your languageID...That way they can alter any available language specific thing in the database. You could even write them a little admin for that.

Hope that helps,

Regards,
Max.
0
 
LVL 10

Author Comment

by:jinn_hnnl
ID: 18887915
I was also thinking about using Database (but it kinda slow everytime a page or control is loaded - I might have to use cache).

I am looking forward if somebody can give me an idea how to implement it using XML, and codeBehind (like Max said)

@Max: can you give me small example of how you gonna store those values in CodeBehind (I have tried to use some static class and field, but it seems not very smart).

Thanks
0
 
LVL 19

Accepted Solution

by:
DreamMaster earned 500 total points
ID: 18888101
Well, for example we are using a language.vb file which looks a little something like this:

Namespace Digibiz.Arachna
    Public Class Language
#Region "Label variables"
        Private lblAlgemeneGegevens As String
        Private lblAdresGegevens As String
        Private lblGewensteAccountGegevens As String

        Private lblBedrijfsnaam As String
        Private lblAanhef As String
        Private lblVoornaam As String
        Private lblAchternaam As String
        Private lblTelefoon As String
        Private lblFax As String
        Private lblEmail As String
        Private lblKvKNummer As String
        Private lblReedsKlant As String

        Private lblStraatHuisnummer As String
        Private lblPostcodePlaats As String
        Private lblLand As String

        Private lblLoginnaam As String
        Private lblWachtwoord As String
        Private lblHerhaalWachtwoord As String
#End Region

#Region "Label variables Public"
        Public ReadOnly Property LabelAlgemeneGegevens() As String
            Get
                Return lblAlgemeneGegevens
            End Get
        End Property

        Public ReadOnly Property LabelAdresGegevens() As String
            Get
                Return lblAdresGegevens
            End Get
        End Property

        Public ReadOnly Property LabelGewensteAccountGegevens() As String
            Get
                Return lblGewensteAccountGegevens
            End Get
        End Property

        Public ReadOnly Property LabelBedrijfsnaam() As String
            Get
                Return lblBedrijfsnaam
            End Get
        End Property

        Public ReadOnly Property LabelAanhef() As String
            Get
                Return lblAanhef
            End Get
        End Property

        Public ReadOnly Property LabelVoornaam() As String
            Get
                Return lblVoornaam
            End Get
        End Property

        Public ReadOnly Property LabelAchternaam() As String
            Get
                Return lblAchternaam
            End Get
        End Property

        Public ReadOnly Property LabelTelefoon() As String
            Get
                Return lblTelefoon
            End Get
        End Property

        Public ReadOnly Property LabelFax() As String
            Get
                Return lblFax
            End Get
        End Property

        Public ReadOnly Property LabelEmail() As String
            Get
                Return lblEmail
            End Get
        End Property

        Public ReadOnly Property LabelKvKNummer() As String
            Get
                Return lblKvKNummer
            End Get
        End Property

        Public ReadOnly Property LabelReedsKlant() As String
            Get
                Return lblReedsKlant
            End Get
        End Property

        Public ReadOnly Property LabelStraatHuisnummer() As String
            Get
                Return lblStraatHuisnummer
            End Get
        End Property

        Public ReadOnly Property LabelPostcodePlaats() As String
            Get
                Return lblPostcodePlaats
            End Get
        End Property

        Public ReadOnly Property LabelLand() As String
            Get
                Return lblLand
            End Get
        End Property

        Public ReadOnly Property LabelLoginnaam() As String
            Get
                Return lblLoginnaam
            End Get
        End Property

        Public ReadOnly Property LabelWachtwoord() As String
            Get
                Return lblWachtwoord
            End Get
        End Property

        Public ReadOnly Property LabelHerhaalWachtwoord() As String
            Get
                Return lblHerhaalWachtwoord
            End Get
        End Property
#End Region

Sub New()
End Sub

Sub New(ByVal strLng As String)
    If (strLng <> "" And IsNumeric(strLng)) Then
        intID = Convert.ToInt32(strLng)
        If intID < 1 Or intID > 3 Then
            intID = 1
        End If
    Else
        intID = 1
    End If
    Init()
End Sub

Private Sub Init()
    Select Case intID
         Case 1
             lblAlgemeneGegevens = "Algemene gegevens"
             lblAdresGegevens = "Adres gegevens"
             lblGewensteAccountGegevens = "Gewenste account gegevens"

             lblBedrijfsnaam = "Bedrijfsnaam"
             lblAanhef = "Aanhef"
             lblVoornaam = "Voornaam"
             lblAchternaam = "Achternaam"
             lblTelefoon = "Telefoon"
             lblFax = "Fax"
             lblEmail = "E-mail"
             lblKvKNummer = "KvK nummer"
             lblReedsKlant = "Reeds klant"

             lblStraatHuisnummer = "Straat / Huisnummer"
             lblPostcodePlaats = "Postcode / Plaats"
             lblLand = "Land"

             lblLoginnaam = "Login naam"
             lblWachtwoord = "Wachtwoord"
             lblHerhaalWachtwoord = "Herhaal wachtwoord"              
    End Select
End Sub

Now wherever I need these variables all I need to do is reference my language class and tell it what language is the current language, and load different labels accordingly.

Hope it helps,
Regards,
Max.
0
 
LVL 10

Author Comment

by:jinn_hnnl
ID: 18888155
MOI, Aardig Nice, dank voor de wenken ^^

I work with C#, but I understand your idea, coooooool. I will try it out and comeback to ya later. I will partly implement my pages from codebehind like this, and the other from XML. Still wait for someone who can help me out with XML issue (I might have to end up with another question properly LOL)

I will give credit after a while (wanna see addtional solution).

Thanks alot  MAX

JINN ^^

PS: r u Dutch ???
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 10

Author Comment

by:jinn_hnnl
ID: 18888169
LOLLL

I read your profile and I see you work in the same city as I do ^^. Cool ...
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 18888204
No way? You work in Den Bosch as well? That IS cool!

Yes I am Dutch, what gave me away? :P The names of the variables were soooo international.. ;) Must have been my terrible typing accent then ;)

Regards,
Max.
0
 
LVL 10

Author Comment

by:jinn_hnnl
ID: 18888678
ohh ^^ your don't really have problem with accent but there are alot of Dutch words. and I have been living in Eindhoven for awhile so ....

's Hertogenbosh is such a beautiful city, but I hate the bus station >.< OMG... the bus system is so weird :D.

JINN ^^
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 18888861
I like 's-Hertogenbosch a lot better than Eindhoven personally, not that I have anything against Eindhoven ;)

I hope that you will get other input for your question, but seeing that it has already been open a while now it will probably be out of sight for others now.

What was the issue with the XML by the way, maybe I can help you with that as well.. ;)

Regards,
Max.
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 18903850
Are you still here jinn? If I can help with your XML question, please tell me..but I doubt anyone new will come in this question anytime soon.
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 18903946
Glad to have been helpful Jinn :)
0
 
LVL 10

Author Comment

by:jinn_hnnl
ID: 18903963
Thank I have implemeted successfully using CodeBehind as the idea you gave me. It's for button lable .... and standard controls like that.

The XML issue is what I wanna deal with some text (or bigger content than text on a button etc...). And I wanna store that not in a database but an XML file.

I wanna know what the best way to store (smart) and how should I load these values in such a good structure (I used 3 tier layers application architecture)... so those loading stuff will happen in DataLayer and Business Logic Layer... But anyway, I just wanna know how should I make those XML files (should I store all in one XML) or each page each XML file... blah blah... (I really don't know how to express this idea, hope you understand it ^^)

JINN ^^

PS: I wanna accept multiple solution, (make the other assisted for example) but I hit the ACCEPT SOLUTION button... I think I can not assign credit for a new solution, can't I ????  Should I publish another question then ??  
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now