Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Globalization question

Globalization question

Scheduled Pinned Locked Moved C#
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Glen Harvy 0
    wrote on last edited by
    #1

    Hi, Using an article from Code Project I have "globalized" my application however I think I have "over done it". The user can select from English OR Spanish and then I run the following code... CultureInfo objCI = new CultureInfo(MainForm.culture); Thread.CurrentThread.CurrentUICulture = objCI; this.xrLabelHeader.Text = MainForm.RM.GetString("0312"); this.xrLabelAmtReceived.Text = MainForm.RM.GetString("0194"); this.xrLabelSNumber.Text = MainForm.RM.GetString("0314"); This works fine but now I think I've stuffed it up for users that don't use Spanish or English (in this case en-US) because I haven't returned the culture back to the computers system after setting the text labels etc. Presumably I should have read the users culture first, changed it whilst setting the text files etc, and then returned the culture back to the computers so that other formatting rules apply (currency symbol etc). Can someone confirm the above please or point me in the right direction. Thanks,

    Glen Harvy

    C 1 Reply Last reply
    0
    • G Glen Harvy 0

      Hi, Using an article from Code Project I have "globalized" my application however I think I have "over done it". The user can select from English OR Spanish and then I run the following code... CultureInfo objCI = new CultureInfo(MainForm.culture); Thread.CurrentThread.CurrentUICulture = objCI; this.xrLabelHeader.Text = MainForm.RM.GetString("0312"); this.xrLabelAmtReceived.Text = MainForm.RM.GetString("0194"); this.xrLabelSNumber.Text = MainForm.RM.GetString("0314"); This works fine but now I think I've stuffed it up for users that don't use Spanish or English (in this case en-US) because I haven't returned the culture back to the computers system after setting the text labels etc. Presumably I should have read the users culture first, changed it whilst setting the text files etc, and then returned the culture back to the computers so that other formatting rules apply (currency symbol etc). Can someone confirm the above please or point me in the right direction. Thanks,

      Glen Harvy

      C Offline
      C Offline
      carbon_golem
      wrote on last edited by
      #2

      I'm not sure why you'd want to change the thread's CultureInfo back after you set it up. In this case you may want to write a ResourceManager wrapper to set various things without changing the thread's CultureInfo. Scott P

      “It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” -Edsger Dijkstra

      G 1 Reply Last reply
      0
      • C carbon_golem

        I'm not sure why you'd want to change the thread's CultureInfo back after you set it up. In this case you may want to write a ResourceManager wrapper to set various things without changing the thread's CultureInfo. Scott P

        “It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” -Edsger Dijkstra

        G Offline
        G Offline
        Glen Harvy 0
        wrote on last edited by
        #3

        I think I may be confusing myself with the UI Culture and the computers culture. In my application I don't touch the computers culture and therefor I didn't think there would be a problem. For example. the application's user can chose to set the UI culture to English or Spanish ie the labels/text in the program can be displayed in either English or Spanish. If they are using the program on a German computer then the dates etc will still be in German. As you said, I could have ignored the culture altogether and just used the ResourceManager as a wrapper. I'm trying to test all this on a VM but it's a bigger task than I imagined because the .Net version is in English so 'OK' is 'OK', not whatever is German for 'OK'. What triggered my 'panic' was that I have a Kuwaiti prospective customer who wants to get rid of the '$' and presumably use 'KD'. I paniced because I would have expected it to use 'KD' or whatever currecy symbol is appropriate for the users region. Apparently there is no region specific culture for Kuwait so I think my application is performing as it should anyhow. Thanks for your input - it seems I only needed to talk it through.

        Glen Harvy

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups