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. Web Development
  3. ASP.NET
  4. Where to set language and culture

Where to set language and culture

Scheduled Pinned Locked Moved ASP.NET
questiondatabase
5 Posts 5 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.
  • P Offline
    P Offline
    Priya Prk
    wrote on last edited by
    #1

    Dear All, What is the proper place to set the default culture and uiculture of the entire website? And the proper place to set the user specific culture and uiculture based on data in de database, ofter the user logs in? Thanks in advance.

    B V G M 4 Replies Last reply
    0
    • P Priya Prk

      Dear All, What is the proper place to set the default culture and uiculture of the entire website? And the proper place to set the user specific culture and uiculture based on data in de database, ofter the user logs in? Thanks in advance.

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

      The bad thing is that processes do inherit the language/culture settings from Windows, not from a parent thread. Consequently, you must set that whenever a new thread is started - i.e. at least once for each web page.

      1 Reply Last reply
      0
      • P Priya Prk

        Dear All, What is the proper place to set the default culture and uiculture of the entire website? And the proper place to set the user specific culture and uiculture based on data in de database, ofter the user logs in? Thanks in advance.

        V Offline
        V Offline
        Vipin_Arora
        wrote on last edited by
        #3

        Following tip may help you: Satellite Assembly Example in C# (Step by Step)[^]

        Happy Coding... :)

        1 Reply Last reply
        0
        • P Priya Prk

          Dear All, What is the proper place to set the default culture and uiculture of the entire website? And the proper place to set the user specific culture and uiculture based on data in de database, ofter the user logs in? Thanks in advance.

          G Offline
          G Offline
          Grace Daniel
          wrote on last edited by
          #4

          Hi, Please follow any one of the below alternatives.

          Alternative 1
          In Web.Config file: <globalization culture="de-AT" uiCulture="de-AT" ….>
          Note: If configured here the value would remain same for all the webforms of the project and is not based on clients choice of language.

          Alternative 2
          //Following should be written in Global.asax and this global to all the webforms of the application.
          protected void Application_BeginRequest(object sender, EventArgs e)
          {
          if (Request.Cookies["culture"] == null) return;
          System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo(Request.Cookies["culture"].Value);
          System.Threading.Thread.CurrentThread.CurrentCulture = ci;
          System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
          }

          For more information on Globalization follow the below link http://www.bestdotnettraining.com/Online/Training/ASP-NET/Globalization-and-Localization-/59[^]

          Grace

          1 Reply Last reply
          0
          • P Priya Prk

            Dear All, What is the proper place to set the default culture and uiculture of the entire website? And the proper place to set the user specific culture and uiculture based on data in de database, ofter the user logs in? Thanks in advance.

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

            Hi, the proper place is inside the function Application_BeginRequest in the global.asax file.

            protected void Application_BeginRequest(object sender, EventArgs e)
            {
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-GB");
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");
            }

            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