Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Support for multilanguage sites, Internationalization (I18N)
(2013-09-17, 01:15:54)anvold Wrote: Help me, please

I cant solve a problem with multilanguage:
My site has 2 languages, basic (en) and additional (de). Basic fancy urls must be without any suffix(for example http://mysite.com/page/), additional - with suffix "/de" (for example http://mysite.com/de/page/). If user's browser language is the same that basic, it's OK, but if not, all pages without suffix transform in german.
It's because urls has "lang" parameter only if i switch language. Modrewrite transforms urls without this parameter to default browser language. How to make urls to include "lang" parameter always? In this case it will be possible to set unique url to each language version

I have already made a website with the same scenario you are after.
http://ubytovanisetek.cz/ - the default language is Czech and it's Czech until you switch to English. Then, it stays English until you switch back. When the site's in English, there's "/en/" in the URL. When it's in Czech, there is no parameter.

In the website's settings, I use this custom permalink structure:
Code:
%nondefaultlanguage%/%parent%/%slug%/

And the .htaccess part for this setting (you have to replace the original RewriteRules with this one)
Code:
RewriteRule ^/?$ cs/ [R,L]   # optional
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(cs|en)/(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$3&lang=$1 [QSA,L]
RewriteRule ^(cs|en)/?$ index.php?lang=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?/)?([A-Za-z0-9-]+)/?$ index.php?id=$2&lang=cs [QSA,L]

Try it, it should work.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply


Messages In This Thread
rewrite language problem - by tomkop - 2013-03-27, 06:34:44
Enhancement suggestion - by hameau - 2013-05-12, 04:17:12
Enhancement request - by hameau - 2013-06-14, 20:02:07
RE: Enhancement request - by mvlcek - 2013-06-14, 22:04:12
RE: Enhancement request - by hameau - 2013-06-14, 23:01:36
Duplicate language cookies bug - by enzy - 2013-08-20, 07:03:26
RE: Duplicate language cookies bug - by ohayo - 2013-08-20, 18:12:25
Plugin is not shown - by tosho - 2013-09-15, 12:10:37
RE: Support for multilanguage sites, Internationalization (I18N) - by TeeJay - 2013-09-17, 03:59:09
1000 pages limit in i18n_navigation - by titus - 2014-10-13, 21:58:36
Bug found - by lbarsov - 2014-10-17, 03:41:53
Menu with picture - by Dimi - 2015-04-28, 16:05:45
Rendering Menu in Component - by Alexander_ - 2016-05-04, 23:06:51
Meta desc for different languages - by Alexander_ - 2017-02-14, 20:29:32
Hierarchical Menus - by celextel - 2019-07-26, 16:41:47
Ri18n_navigation - by celextel - 2021-02-19, 16:07:48



Users browsing this thread: 3 Guest(s)