Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Support for multilanguage sites, Internationalization (I18N)
Hello everyone Smile

I have a website in Czech (cs) and English (en). However, I happened to meet a few major problems I could not solve.

1) When not using custom permalinks, default language is English -wrong. I need the default to be Czech. So I wrote into .htaccess
Code:
RewriteRule ^/?$ cs/ [R,L]
Apparently, it didn't help, I understand that it's because it just adds /cs/ into the address. How can I make it Czech as a default language when not using permalinks? I just want to visit my site and have it in Czech without switching.

2) When using these custom permalinks showing all the languages, to the admin panel I wrote
Code:
%language%/%parent%/%slug%/
and set .htaccess like this
Code:
# News Manager setup:
RewriteRule ^clanky/tag/([^/.]+)/?$ index.php?id=clanky&tag=$1 [L]
RewriteRule ^clanky/post/([^/.]+)/?$ index.php?id=clanky&post=$1 [L]
RewriteRule ^clanky/page/([^/.]+)/?$ index.php?id=clanky&page=$1 [L]
RewriteRule ^clanky/archive/([^/.]+)/?$ index.php?id=clanky&archive=$1 [L]
# end News Manager

# To make custom permalinks with both languages work :)
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=$1 [QSA,L]
Everythings works as it is supposed be, except news from News Manager. You can see News Manager lines (starting with "clanky", "clanky" is my menu tam with news from News Manager), which are there for Fancy URLs (you can use Fancy URLs and News Manager without these lines in .htaccess). What should I add or change about the News Manager lines to make it work with this plugin and Fancy URLs?

3) When using custom permalinks showing only the secondary language, in the admin panel I wrote
Code:
%nondefaultlanguage%/%parent%/%slug%/
and changed .htaccess like this:
Code:
# News Manager setup:
RewriteRule ^clanky/tag/([^/.]+)/?$ index.php?id=clanky&tag=$1 [L]
RewriteRule ^clanky/post/([^/.]+)/?$ index.php?id=clanky&post=$1 [L]
RewriteRule ^clanky/page/([^/.]+)/?$ index.php?id=clanky&page=$1 [L]
RewriteRule ^clanky/archive/([^/.]+)/?$ index.php?id=clanky&archive=$1 [L]
# end News Manager

# To make custom permalinks with the secondary language only work :)
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=en [QSA,L]
In this case, everything was wrong. On the title page, it was okay and Czech, correctly switchable into both languages back and forth. However, after clicking onto any menu tab or submenu tab, the language changed into English and couldn't be changed even with my language switching menu (which is:
Code:
<a class="en<?php if ($language == "en") echo "-current"; ?>" href="<?php echo htmlspecialchars(return_i18n_setlang_url('en')); ?>" title="English"></a>
          <a class="cz<?php if ($language == "cs") echo "-current"; ?>" href="<?php echo htmlspecialchars(return_i18n_setlang_url('cs')); ?>" title="Czech"></a>
What is funny about this menu - although the option of English is states first in the HTML code, it shows on the right side of its div. It's a CSS/HTML thing though.) The only menu tab where I can switch language is the index page, it just doesn't work anywhere else.
Futhermore, the news ("clanky") didn't work as in the second case.

My question is, how can I make all these three things working properly? Well, I would like to use the third option the most - for Czech a standard address without /language/ in the address, for English /en/.
I would also like to have translated the address of the web in English version according to the new translated Menu labels and translated page titles, but firstly I need to make it work at all.

Thanks for helping me. I'm willing to provide all the information needed and try your kind suggestions. I don't know what do write in .htaccess because I don't understand what to write in there.

Tom
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
RE: Support for multilanguage sites, Internationalization (I18N) - by TeeJay - 2013-04-10, 02:10:43
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
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: 9 Guest(s)