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. localization - Browser's language and javascript

localization - Browser's language and javascript

Scheduled Pinned Locked Moved Web Development
helpjavascriptsysadmin
4 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.
  • M Offline
    M Offline
    militiaware
    wrote on last edited by
    #1

    hello fellows, I'm facing a problem with localization. You know each time the browser create a request, it will send its language (en, en_us, ..etc) with the it where the web application can determine the language of the client and send the proper response. Now, what i want is to play around with this option on the client-side not from the server-side. And I want the language option to be displayed as a choice as a select-box on login page. My first option (as i think) is to modify the browser's language using javascript when the user select (event) a choice from the select-box. My second option is to override the value of the header "accept-language" using javascript also. Until now I couldn't know it those two options are possible or there's any other choices. I really appreciate it if you can help Regards, Faris Madi Nothing Comes Easy (N.C.E.)

    J 1 Reply Last reply
    0
    • M militiaware

      hello fellows, I'm facing a problem with localization. You know each time the browser create a request, it will send its language (en, en_us, ..etc) with the it where the web application can determine the language of the client and send the proper response. Now, what i want is to play around with this option on the client-side not from the server-side. And I want the language option to be displayed as a choice as a select-box on login page. My first option (as i think) is to modify the browser's language using javascript when the user select (event) a choice from the select-box. My second option is to override the value of the header "accept-language" using javascript also. Until now I couldn't know it those two options are possible or there's any other choices. I really appreciate it if you can help Regards, Faris Madi Nothing Comes Easy (N.C.E.)

      J Offline
      J Offline
      Johnny
      wrote on last edited by
      #2

      As far as I'm aware you can't do any of those options. The language of the browser is as determined by the user and can not be changed by javascript. Also, dont assume that the user of the browser can actually understand the lanuages it supports. Your best bet is to have the user make some language selection and store this in a cookie.

      M 1 Reply Last reply
      0
      • J Johnny

        As far as I'm aware you can't do any of those options. The language of the browser is as determined by the user and can not be changed by javascript. Also, dont assume that the user of the browser can actually understand the lanuages it supports. Your best bet is to have the user make some language selection and store this in a cookie.

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

        Do you know anyway to override the value of the sent parameters by the browser to the server. for example the browser sends to the server with each request a parameter called "accept-language" or "language". So, the web application will know the language of the browser. I want to change the value of "accept-language". Im not sure if that's possible? Any Ideas ?? Regards, Faris Madi Nothing Comes Easy (N.C.E.)

        J 1 Reply Last reply
        0
        • M militiaware

          Do you know anyway to override the value of the sent parameters by the browser to the server. for example the browser sends to the server with each request a parameter called "accept-language" or "language". So, the web application will know the language of the browser. I want to change the value of "accept-language". Im not sure if that's possible? Any Ideas ?? Regards, Faris Madi Nothing Comes Easy (N.C.E.)

          J Offline
          J Offline
          Johnny
          wrote on last edited by
          #4

          Why do you want to change it from JavaScript? If the user wants a different language then they will change it through the browser. You will be better off using a cookie to store the user's language selection (you can use accept-language to discover the initial setting).

          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