Page 1 of 2

Multilingual web site

Posted: Tue Apr 04, 2006 2:26 pm
by katon
This web site has been made with the multilingual modification of CMSMadeSimple:
http://nishiobudo.org.ua

Re: Multilingual web site

Posted: Tue Apr 04, 2006 3:55 pm
by Oliver
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

Posted: Tue Apr 04, 2006 4:01 pm
by katon
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.

Re: Multilingual web site

Posted: Wed Apr 05, 2006 9:19 am
by lennon
That looks great. Nice one Katon.

Re: Multilingual web site

Posted: Wed Apr 05, 2006 8:41 pm
by ealfert
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

Re: Multilingual web site

Posted: Sun Apr 09, 2006 3:19 am
by tamlyn
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".
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.

Re: Multilingual web site

Posted: Sun Apr 09, 2006 8:12 am
by tsw

Code: Select all

RewriteRule ^(.+)/(.+)\.html$ index.php?page=$2&lan=$1 [QSA]
UNTESTED as I dont have the mod installed...

EDIT: lang -> lan as katon said :)

Re: Multilingual web site

Posted: Sun Apr 09, 2006 9:38 am
by katon
It's not lang, it's lan.

Re: Multilingual web site

Posted: Sun Apr 09, 2006 1:44 pm
by ealfert
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.

Re: Multilingual web site

Posted: Sun Apr 09, 2006 2:05 pm
by ealfert
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,

Re: Multilingual web site

Posted: Sun Apr 09, 2006 2:12 pm
by tamlyn
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

Posted: Sun Apr 09, 2006 2:20 pm
by ealfert
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".

Re: Multilingual web site

Posted: Sun Apr 09, 2006 2:57 pm
by ealfert
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...
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".
is not a mod_rewrite problem but a multilang design decision.  Katon, please correct me if I'm wrong.

(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

Posted: Sun Apr 09, 2006 3:22 pm
by ealfert
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.

Re: Multilingual web site

Posted: Mon May 15, 2006 12:08 am
by katon
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.