Multilingual web site
Multilingual web site
This web site has been made with the multilingual modification of CMSMadeSimple:
http://nishiobudo.org.ua
http://nishiobudo.org.ua
Re: Multilingual web site
That's terrific! Being able to produce multilingual sites is a top priority for CMS ms as for me. How did you do this one? I wish there were a simple module...
Re: Multilingual web site
I was using this hack:
http://dev.cmsmadesimple.org/projects/multilang/
It's a temporary solution. Make sure to read the readme file before the install.
http://dev.cmsmadesimple.org/projects/multilang/
It's a temporary solution. Make sure to read the readme file before the install.
Re: Multilingual web site
That looks great. Nice one Katon.
Re: Multilingual web site
Katon,
Thank you for the great code. I needed multilanguage support.
If I turn on search engine friendly urls the navigation stops workings.
The system chokes on the "&lan=en" appended to the "page_name.html".
If you have the time and desire, would it be possible to make multilang work with the following format?
http://www.domain.tld/en/page_name.html
http://www.domain.tld/es/page_name.html
http://www.domain.tld/au/page_name.html
Either way, thank you for the great code.
Edward
Thank you for the great code. I needed multilanguage support.
If I turn on search engine friendly urls the navigation stops workings.
The system chokes on the "&lan=en" appended to the "page_name.html".
If you have the time and desire, would it be possible to make multilang work with the following format?
http://www.domain.tld/en/page_name.html
http://www.domain.tld/es/page_name.html
http://www.domain.tld/au/page_name.html
Either way, thank you for the great code.
Edward
Re: Multilingual web site
Surely that's just a matter of updating the rewrite rule in the .htaccess. I'll prob be using this mod for a site so I'll look into it and post back.ealfert wrote: If I turn on search engine friendly urls the navigation stops workings.
The system chokes on the "&lan=en" appended to the "page_name.html".
Re: Multilingual web site
Code: Select all
RewriteRule ^(.+)/(.+)\.html$ index.php?page=$2&lan=$1 [QSA]
EDIT: lang -> lan as katon said

Last edited by tsw on Sun Apr 09, 2006 10:48 am, edited 1 time in total.
Re: Multilingual web site
Tamlyn, thanks for the effort and time you put into it.
But, it does not seem to work. Gives a 404 error like the original rewriterule.
But, it does not seem to work. Gives a 404 error like the original rewriterule.
Re: Multilingual web site
I have played around with your rule by learning a little more about mod_rewrite and got it to work when the link contains both the page name and a language selection (test.html&lan=en). NO MORE 404s!!!
RewriteRule ^(.+)\.html&lan=(.+)$ index.php?page=$1&lan=$2 [QSA]
But if the link only contains the page name (test.html) then it gives a 404.
It seems that the rule is matching only when both variable are present in the requested url. Maybe the rule needs to be split in 2 so that it tests each component individually an matches one, the other, or both and the rewrite then rewrites only the parts that match instead of none?
Also,
RewriteRule ^(.+)\.html&lan=(.+)$ index.php?page=$1&lan=$2 [QSA]
But if the link only contains the page name (test.html) then it gives a 404.
It seems that the rule is matching only when both variable are present in the requested url. Maybe the rule needs to be split in 2 so that it tests each component individually an matches one, the other, or both and the rewrite then rewrites only the parts that match instead of none?
Also,
Re: Multilingual web site
heh, i haven't put any effort or time into it! I think you emant to thank katon & tsw. Anyway this rewriterule should work better:
Code: Select all
RewriteRule ^(.+)\.html(&lan=.+)?$ index.php?page=$1$2 [QSA]
Re: Multilingual web site
OK...IT WORKS!
RewriteRule ^(.+)\.html(&lan=.+)?$ index.php?page=$1$2 [QSA]
But just before you gave me the elegant solution, I came up with a working ugly solution also... splitting into 2 rules.
RewriteRule ^(.+)\.html&lan=(.+)$ index.php?page=$1&lan=$2 [QSA]
RewriteRule ^(.+)\.html$ index.php?page=$1 [QSA]
Your rule is better and I will use it instead.
Now I notice another issue. The links in the menu are friendly "http://www.domain.tld/test.html&lan=en", but the links for the flags to switch language are in the non-friendly format "http://www.domain.tld/index.php?page=test&lan=es".
RewriteRule ^(.+)\.html(&lan=.+)?$ index.php?page=$1$2 [QSA]
But just before you gave me the elegant solution, I came up with a working ugly solution also... splitting into 2 rules.
RewriteRule ^(.+)\.html&lan=(.+)$ index.php?page=$1&lan=$2 [QSA]
RewriteRule ^(.+)\.html$ index.php?page=$1 [QSA]
Your rule is better and I will use it instead.
Now I notice another issue. The links in the menu are friendly "http://www.domain.tld/test.html&lan=en", but the links for the flags to switch language are in the non-friendly format "http://www.domain.tld/index.php?page=test&lan=es".
Re: Multilingual web site
TSW,
Sorry I didn't give you thanks for the original rewriterule that got the ball rolling. My bad.
(1) Mod_Rewrite is now working as it should and it looks to me that the issue I mentioned in my previous post...
(2) Also, fixing (1) above would be good but my ideal look for the URL would be in the format:
http://www.domain.tld/en/page.html
http://www.domain.tld/es/page.html
insead of:
Instead of the current"
http://www.domain.tld/page.html?lan=en
http://www.domain.tld/page.html?lan=es
I'm going to look at the code to see if i can figure it out. Thanks everyone for your time.
Katon, is it as simply editing "modules/MenuManager/MenuManager.module.php" and finding the line that reads:
$onenode->url = $content->GetURL() . "&lan=$lan";
and changing it to:
$onenode->url = "$lan/" . $content->GetURL();
And then changing the mod_rewrite rules to look for the new format of URL?
Are there other php scripts or other areas that need to change other than MenuManager.module.php?
Sorry I didn't give you thanks for the original rewriterule that got the ball rolling. My bad.
(1) Mod_Rewrite is now working as it should and it looks to me that the issue I mentioned in my previous post...
is not a mod_rewrite problem but a multilang design decision. Katon, please correct me if I'm wrong.Now I notice another issue. The links in the menu are friendly "http://www.domain.tld/test.html&lan=en", but the links for the flags to switch language are in the non-friendly format "http://www.domain.tld/index.php?page=test&lan=es".
(2) Also, fixing (1) above would be good but my ideal look for the URL would be in the format:
http://www.domain.tld/en/page.html
http://www.domain.tld/es/page.html
insead of:
Instead of the current"
http://www.domain.tld/page.html?lan=en
http://www.domain.tld/page.html?lan=es
I'm going to look at the code to see if i can figure it out. Thanks everyone for your time.
Katon, is it as simply editing "modules/MenuManager/MenuManager.module.php" and finding the line that reads:
$onenode->url = $content->GetURL() . "&lan=$lan";
and changing it to:
$onenode->url = "$lan/" . $content->GetURL();
And then changing the mod_rewrite rules to look for the new format of URL?
Are there other php scripts or other areas that need to change other than MenuManager.module.php?
Re: Multilingual web site
For those that are interested in the format:
http://www.domain.tld/2LeterLanguageCode/page.html
The the following is working for me:
(1) Modify rewriterule in .htaccess to:
RewriteRule ^(.+)/(.+)\.html$ index.php?page=$2&lan=$1 [QSA]
(2) Modify "function GetURL" in "lib/classes/class.content.inc.php" by adding:
global $lan;
Before the line that reads:
global $gCms;
(3) Modify "function GetURL" in "lib/classes/class.content.inc.php" by changing:
$url = $config["root_url"]."/".$alias.
to
$url = $config["root_url"]."/".$lan."/".$alias
(4) Modify "" in "modules/MenuManager/MenuManager.module.php" by changing:
$onenode->url = $content->GetURL() . "&lan=$lan";
to
$onenode->url = $content->GetURL();
Now the Menu system creates the link format that I like and the mod_rewrite interprets it correctly.
The only issue remaining is the URLS that the flags hyperlink to. I need to find the script that controls them and modify it.
http://www.domain.tld/2LeterLanguageCode/page.html
The the following is working for me:
(1) Modify rewriterule in .htaccess to:
RewriteRule ^(.+)/(.+)\.html$ index.php?page=$2&lan=$1 [QSA]
(2) Modify "function GetURL" in "lib/classes/class.content.inc.php" by adding:
global $lan;
Before the line that reads:
global $gCms;
(3) Modify "function GetURL" in "lib/classes/class.content.inc.php" by changing:
$url = $config["root_url"]."/".$alias.
to
$url = $config["root_url"]."/".$lan."/".$alias
(4) Modify "" in "modules/MenuManager/MenuManager.module.php" by changing:
$onenode->url = $content->GetURL() . "&lan=$lan";
to
$onenode->url = $content->GetURL();
Now the Menu system creates the link format that I like and the mod_rewrite interprets it correctly.
The only issue remaining is the URLS that the flags hyperlink to. I need to find the script that controls them and modify it.
Re: Multilingual web site
Please try 0.12.2 multilingual beta 1. I didn't have a chance to test it it on multiple systems, so I need your help with this guys.