Jump to content

language according to domain or pass language variable to subdomain


Ilyas

Recommended Posts

Hey,

 

How can I pass the language variable of the main website (domain.com) to whmcs (client.domain.com)

 

Or how can I set the language according to the domain? On my main website this is done by the .htaccess with SetEnvIf and some php.

 

SetEnvIf Host "\.uk$" SITE_LANGUAGE=english
SetEnvIf Host "\.cc" SITE_LANGUAGE=english
SetEnvIf Host "\.be" SITE_LANGUAGE=dutch
SetEnvIf Host "\.nl" SITE_LANGUAGE=dutch

$_SERVER['SITE_LANGUAGE']; calls the language detirmined in the.htaccess

 

And the php:

<?php
session_start();
header('Cache-control: private'); // IE 6 FIX

// lang according to domain
$lang = $_SERVER['SITE_LANGUAGE'];

if(isSet($_GET['lang']))
{
$lang = $_GET['lang'];

// register the session and set the cookie
$_SESSION['lang'] = $lang;

setcookie('lang', $lang, time() + (3600 * 24 * 30));
}
else if(isSet($_SESSION['lang']))
{
$lang = $_SESSION['lang'];
}
else if(isSet($_COOKIE['lang']))
{
$lang = $_COOKIE['lang'];
}
else
{
$lang = 'en_eu';
}

switch ($lang) {
 case 'nl_be':
 $lang_file = 'nl_be.php';
 break;

 case 'nl_nl':
 $lang_file = 'nl_nl.php';
 break;

 case 'en_us':
 $lang_file = 'en_us.php';
 break;

 case 'en_uk':
 $lang_file = 'en_uk.php';
 break;

 case 'en_eu':
 $lang_file = 'en_eu.php';
 break;

 default:
 $lang_file = 'en_eu.php';

}

include_once 'components/languages/'.$lang_file;
?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated