Language change as per region

Hi, 

Is there any module which can change the website language automatically as per user location. 

If not then can someone develop it. 

  • 199
  • More
Replies (5)
    • Hello travis k !

      UNA detects the language of the user from the browser's settings. So there is no big necessity to develop the mode which you described.

      • hi, but user have to change the language manually. is it possible for una to automatically detect the location and change the language. or atleast give language change option  first time when there is not browser history..

        • Let's review how UNA checks what language should be set for the user (my comments are bold):

          // 1. check if user has the language argument in the URL (GET parameter)

          if(!$sLang && !empty($_GET['lang']))

                      $sLang = $this->tryToGetLang($_GET['lang'], $bSetCookie);

          // 2. check if user has the POST argument with the language

                  if(!$sLang && !empty($_POST['lang']))

                      $sLang = $this->tryToGetLang($_POST['lang'], $bSetCookie);

          // 3. check if user already visit this site and chose langauge (COOKIE setting)

                  if(!$sLang && !empty($_COOKIE['lang']))

                      $sLang = $this->tryToGetLang($_COOKIE['lang']);

          // 4. check the settings of the browser

                  if(!$sLang && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']))

                      $sLang = $this->tryToGetLang($_SERVER['HTTP_ACCEPT_LANGUAGE']);

          // 5. set the default languge from Studio settings

                  if(!$sLang)

                      $sLang = $this->tryToGetLang(getParam('lang_default'));

          // 6. set the default lang form constant

                  if(!$sLang)

                      $sLang = $this->tryToGetLang(BX_DOL_LANGUAGE_DEFAULT);

          As you may see in the step 4 UNA tries to define the browser settings of the first-time site's visitor. But all these steps work if the necessary language is installed. For example, if the guest from Russia will visit UNA site with English and Italian only then he will see the default English, but the Italians will see the correct language from the beginning.

          • Thanks.. Where I can get French and Spanish language pack.. Is it available. 

              Login or Join to comment.