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. Get Client machine localization

Get Client machine localization

Scheduled Pinned Locked Moved C#
question
5 Posts 3 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.
  • M Offline
    M Offline
    Mugdha_Aditya
    wrote on last edited by
    #1

    i need to get machine localization in my website. i change my machine localization ("Regional and Language Options" control panel.) and check with below code but always it shows as 'en_US'.. string strCluture = CultureInfo.CurrentCulture.Name; what i need to do to get current localization. am i missing some setting or what?

    L B 2 Replies Last reply
    0
    • M Mugdha_Aditya

      i need to get machine localization in my website. i change my machine localization ("Regional and Language Options" control panel.) and check with below code but always it shows as 'en_US'.. string strCluture = CultureInfo.CurrentCulture.Name; what i need to do to get current localization. am i missing some setting or what?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Mugdha_Aditya wrote:

      i change my machine localization ("Regional and Language Options" control panel.)
      and check with below code but always it shows as 'en_US'..

      string strCluture = CultureInfo.CurrentCulture.Name;

      what i need to do to get current localization. am i missing some setting or what?

      Did you restart your application after you changed the setting? The CultureInfo is set for the app when it starts, and (luckily) doesn't change while running - even if the user changes it. The new CultureInfo should be displayed after you start your app.

      Mugdha_Aditya wrote:

      i need to get machine localization in my website.

      Care to explain a bit? You're fetching the culture of the webserver, not of the connected clients.

      Bastard Programmer from Hell :suss:

      M 1 Reply Last reply
      0
      • L Lost User

        Mugdha_Aditya wrote:

        i change my machine localization ("Regional and Language Options" control panel.)
        and check with below code but always it shows as 'en_US'..

        string strCluture = CultureInfo.CurrentCulture.Name;

        what i need to do to get current localization. am i missing some setting or what?

        Did you restart your application after you changed the setting? The CultureInfo is set for the app when it starts, and (luckily) doesn't change while running - even if the user changes it. The new CultureInfo should be displayed after you start your app.

        Mugdha_Aditya wrote:

        i need to get machine localization in my website.

        Care to explain a bit? You're fetching the culture of the webserver, not of the connected clients.

        Bastard Programmer from Hell :suss:

        M Offline
        M Offline
        Mugdha_Aditya
        wrote on last edited by
        #3

        Hey... Thanks for the your reply. I have restarted my application as well as my pc. still its not applying selected culture.

        1 Reply Last reply
        0
        • M Mugdha_Aditya

          i need to get machine localization in my website. i change my machine localization ("Regional and Language Options" control panel.) and check with below code but always it shows as 'en_US'.. string strCluture = CultureInfo.CurrentCulture.Name; what i need to do to get current localization. am i missing some setting or what?

          B Offline
          B Offline
          Bernhard Hiller
          wrote on last edited by
          #4

          Apart from CurrentCulture, there is also CurrentUICulture. Since you're talking about a web site, do not forget to set the CurrentUICulture to the desired value whenever a new thread (!) is started - otherwise your web site will always run in the localization of your web server. E.g.

          System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("de-DE");

          Threads get their culture specific settings from the operating system, not from the thread they were started from.

          M 1 Reply Last reply
          0
          • B Bernhard Hiller

            Apart from CurrentCulture, there is also CurrentUICulture. Since you're talking about a web site, do not forget to set the CurrentUICulture to the desired value whenever a new thread (!) is started - otherwise your web site will always run in the localization of your web server. E.g.

            System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("de-DE");

            Threads get their culture specific settings from the operating system, not from the thread they were started from.

            M Offline
            M Offline
            Mugdha_Aditya
            wrote on last edited by
            #5

            i dontt want to set culture , i want to getculture info. i have done below changes in page load but still its not working. System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("de-DE"); string strCluture = CultureInfo.CurrentCulture.Name; strCluture returns en-US :(

            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