C# Web App: Globalising Web App

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmj07
    New Member
    • Aug 2008
    • 55

    C# Web App: Globalising Web App

    Hi all,

    I need to globalise my web app from english into french. I have created a .resx resource file for both languages but now am unsure of a way of setiing which resource file is to be used. For example:

    A French user logs on to the application, when the page loads for him I need the resource file to point to the french one so all label.text descriptions are brought from the correct file using the GetString format.

    Hope you can help me :)

    Many thanks in advance.
  • balabaster
    Recognized Expert Contributor
    • Mar 2007
    • 798

    #2
    Simplest way is to grab the current culture when the user logs in or starts the application. Your strings file can be read with My.Resources.Fi leName, so depending on the culture, just change the reference to the file name. I've included some pseudo code that should kind of work...with a bit of tweaking...

    Code:
    string resFile;
    switch(System.Globalization.CultureInfo.CurrentCulture){
      case <French> :
        resFile = My.Resources.French;
        break;
      default :
        resFile = My.Resources.English;
        break;
    }
    Then you'd have a function to parse each file for the correct string...

    Comment

    • dmj07
      New Member
      • Aug 2008
      • 55

      #3
      Many thanks for your reply, I will have to have a go with this psuedo code see if i can implement it :)

      Comment

      Working...