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.
-
-
- · travis k
-
·
In reply to LeonidS
- ·
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.
-
- · travis k
-
·
In reply to LeonidS
- ·
Thanks.. Where I can get French and Spanish language pack.. Is it available.
-
Hi travis k - you can access all available UNA translations via the Market here.
https://una.io/searchKeyword.php?cat=bx_market_cats&keyword=38§ion[]=bx_market