Different URLs for different languages

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

Rules → http://www.boonex.com/terms
Quote · 17 Feb 2017

This is really a good idea for internationalization !

How about different languages for different forums?

https://www.insoler.com/ The first community site supports RAW photo formats !
Quote · 17 Feb 2017

Please could you describe the idea in more details ? 

How about different languages for different forums?

 

Rules → http://www.boonex.com/terms
Quote · 19 Feb 2017

Could you not add the feature that dolphin checks with the help of a catalogue of ip adresses where the user is located, and then taking the appropriate language?

Quote · 19 Feb 2017

There is already a feature which detects browser language and set Dolphin language accordingly. 

Could you not add the feature that dolphin checks with the help of a catalogue of ip adresses where the user is located, and then taking the appropriate language?

 

Rules → http://www.boonex.com/terms
Quote · 19 Feb 2017

Oh, i did not know this. Can you tell me since when this is part of dolphin? 

Quote · 20 Feb 2017

I can't tell exactly, but this feature exists for a long time already.

Oh, i did not know this. Can you tell me since when this is part of dolphin? 

 

Rules → http://www.boonex.com/terms
Quote · 20 Feb 2017

 

Please could you describe the idea in more details ? 

 

Yes, If BOONEX forum supports 10 languages, The discussion list will become very long...

In fact, I can't read Russian, French, German, Italian, Spanish... so BOONEX does not need to list all the discussion lists in 10 languages at same time.

For example, Apple uses a different URL to correspond to a different language.

this is Apple's English discussion :

https://discussions.apple.com/content

this is Apple's French discussion :

https://communities.apple.com/fr/content

this is Apple's German discussion :

https://communities.apple.com/de/content

Japan's forum site is not the same, more special ! this is Apple's Japanese discussion :

https://discussionsjapan.apple.com/content

 

Now the dolphins system have just only one forum, maybe the dolphin system can also correspond to 10 languages, For example :

www. boonex.com/ru/forums/ (for Russian)

www. boonex.com/fr/forums/  (for French)

www. boonex.com/de/forums/ (for German)

www. boonex.com/ja/forums/ (for Japanese)

www. boonex.com/cn/forums/ (for Chinese)

Just copy the current forum to different languages and use a different MySQL data table name. More short list of forums, MySQL data read faster, web page display speed can be faster.

https://www.insoler.com/ The first community site supports RAW photo formats !
Quote · 23 Feb 2017

Thank you for the explanation, but it will require much more work than just a small modification.

Rules → http://www.boonex.com/terms
Quote · 25 Feb 2017

My pleasure.

I know it's not so easy to support multiple languages, in fact it will be very difficult. but you know it's not "Mission: Impossible" !

Although the dolphin is not perfect, but I like it.

https://www.insoler.com/ The first community site supports RAW photo formats !
Quote · 28 Feb 2017

It would also be interesting to add the hreflang tags.

Which file should be modified to add these tags. URLactual would be a variable with the page url visited.


I currently have three languages.

 

<link rel="alternate" type="text/html" hreflang="es-ES" href="'+URLactual+'?lang=es" title="Español"/>

<link rel="alternate" type="text/html" hreflang="es-MX" href="'+URLactual+'?lang=mx" title="Mexico"/>

<link rel="alternate" type="text/html" hreflang="es-Ar" href="'+URLactual+'?lang=arg" title="Argentina"/>

Quote · 2 Mar 2017
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.