This is small modification to make different URLs for different languages on your Dolphin site.
So site with site.com/ru/ with always has Russian language applied, and site.com/en/ with have English.
Also all URLs will be changed according to the current language.
1. Add symbolic links for each language in the Dolphin root folder, for example:
ln -s . en ln -s . ru
2. Apply the following modification in header.inc.php
Instead of:
$site['url'] = 'http://domain.com/path/';
Add the following code:
$sUrlRoot = 'http://domain.com/path/'; $sPath = trim(parse_url($sUrlRoot, PHP_URL_PATH), '/'); $aMatches = array(); if (preg_match("/" . preg_quote($sPath, '/') . "\/([a-z]{2})\//", $_SERVER['PHP_SELF'], $aMatches) && isset($aMatches[1])) { // set the language detected in the URL $sUrlRoot .= $aMatches[1] . '/'; $_COOKIE['lang'] = $aMatches[1]; } else { // if no language is detected in the URL - redirect to English version homepage header('Location: ' . $sUrlRoot . 'en/'); } $site['url'] = $sUrlRoot;
Don't forget to replace http://domain.com/path/ with your own domain and path.
3. Possible problems:
- lang switcher must be removed or changed, since old switcher will work incorrectly
- user must login again when site language is switched
- social login (like Facebook Connect) must be configured the special way - the redirect URI for each language must be specified