Multilanguage CMSMS MLE version 1.1.1

This is a FORK of the CMS Made Simple project and is not oficially supported in any way by the CMS Made Simple development team.
alby

Re: Multilanguage CMSMS MLE versione 1.1.2

Post by alby »

chipper wrote: Thanks but I am so sorry - I don't think I made myself very clear! - the url is the one generated for each page and not related to any module - specifically the ampersand in the urls calling the pages:

http://mydomain/yc/yc2/index.php?page=h ... e&hl=cy_GB
It's in link generated from {lang}, in menu of MenuManager or other?

Alby
chipper
Forum Members
Forum Members
Posts: 42
Joined: Thu Aug 09, 2007 5:29 pm

Re: Multilanguage CMSMS MLE versione 1.1.2

Post by chipper »

It's in both I think - clicking on the menu tabs brings up a url with a single ampersand and so does clicking on the flags
alby

Re: Multilanguage CMSMS MLE versione 1.1.2

Post by alby »

chipper wrote: It's in both I think - clicking on the menu tabs brings up a url with a single ampersand and so does clicking on the flags
I don't find single ampersand in code.
Have you site online?

Alby
chipper
Forum Members
Forum Members
Posts: 42
Joined: Thu Aug 09, 2007 5:29 pm

Re: Multilanguage CMSMS MLE versione 1.1.2

Post by chipper »

Yes it's here - just a basic shell at the moment as we are transferring an existing site over and I am getting the technical details out of the way first!

http://colonyofants.co.uk/yc/yc2

and an example url:

http://colonyofants.co.uk/yc/yc2/index. ... s&hl=en_GB

:)
gk

Re: Multilanguage CMSMS MLE versione 1.1.2

Post by gk »

alby wrote:
gk wrote: I've got this site (www.globalconceptfrance.com) that I'd like to be multilingual (done all you said, upgrading from cmsms v1.1.1 to mle v1.1.2, sql stuffs and so on) but it's not working smoothly. In fact, I can't get to the English page to display when UK flag being clicked, thaugh  I've succeeded displaying those pages before. Everything is showing fine in admin!! Is there a cache issue or something wrong in my config ?
1. In admin: I suppose that Title, Menu text and content are ok in fr_FR and en_GB pages?
2. Clear cache (absolutly like in CMSMS if modify template, module templates and css)
3. Work? No? Ok, it has happened to me once with pretty url enabled.
    Download this file and uncompress (overwrite) in /plugins and report this if work


My other $0.02:

1. Language page
Substitute in your template:

with:




2. Title Image

2a. Substitute in style CSS:

Code: Select all

h1#this {
   background:url(uploads/images/h1-desodorisant.gif) no-repeat transparent;text-indent:-5000px;height:54px;
}
h1#that {
   background:url(uploads/images/h1-modeles.gif) no-repeat transparent;text-indent:-5000px;height:62px;
}
h1#thus {
   background:url(uploads/images/h1-presentoir.gif) no-repeat transparent;text-indent:-5000px;height:34px;
}
with:

Code: Select all

h1#this_en_GB {
   background:url(uploads/images/h1-desodorisant_en_GB.gif) no-repeat transparent;text-indent:-5000px;height:54px;
}
h1#this_fr_FR {
   background:url(uploads/images/h1-desodorisant_fr_FR.gif) no-repeat transparent;text-indent:-5000px;height:54px;
}

h1#that_en_GB {
   background:url(uploads/images/h1-modeles_en_GB.gif) no-repeat transparent;text-indent:-5000px;height:62px;
}
h1#that_fr_FR {
   background:url(uploads/images/h1-modeles_fr_FR.gif) no-repeat transparent;text-indent:-5000px;height:62px;
}

h1#thus_en_GB {
   background:url(uploads/images/h1-presentoir_en_GB.gif) no-repeat transparent;text-indent:-5000px;height:34px;
}
h1#thus_fr_FR {
   background:url(uploads/images/h1-presentoir_fr_FR.gif) no-repeat transparent;text-indent:-5000px;height:34px;
}
2b.
- Rename h1-desodorisant.gif to h1-desodorisant_fr_FR.gif
- Create a new h1-desodorisant_en_GB.gif with English text

and same for h1-modeles and h1-presentoir

2c. Substitute, in template, =>
and same for that and thus


Alby
Hey this seems to be a full pack of cure methode!!
Thanx for taking the time to help, I'll let you know as soon as I try.
alby

Re: Multilanguage CMSMS MLE versione 1.1.2

Post by alby »

chipper wrote: Yes it's here - just a basic shell at the moment as we are transferring an existing site over and I am getting the technical details out of the way first!
http://colonyofants.co.uk/yc/yc2

and an example url:
http://colonyofants.co.uk/yc/yc2/index. ... s&hl=en_GB
On http://validator.w3.org homepage is ok (but I choice Validate by Direct Input because Validate by URI result 404 error!):
This Page Is Valid XHTML 1.0 Transitional!

In page there are errors!


Menu is ok (home and page):
2: Whats On

3: Free Time and Fun
In lang there is a problem:

Home, ok:


Page no:


In page template you use tag {lang} or is manual entry?

::) StyleClassForThisTag was a generic name of style  ::)

Alby
Last edited by alby on Sun Sep 16, 2007 8:03 am, edited 1 time in total.
chipper
Forum Members
Forum Members
Posts: 42
Joined: Thu Aug 09, 2007 5:29 pm

Re: Multilanguage CMSMS MLE versione 1.1.2

Post by chipper »

Hi Alby

Scrap what I wrote last night - think I was rambling - brain strain due to doing this!!!  ::) Getting my urls mixed up!

I have been playing around this morning, searching the forum etc - didn't find the exact answer so I investigated what could possibly be changed in function.lang and I have now got the site to validate! I have shocked myself  :o

I don't know if this was the correct way to go about things. (The bolded bits are the changes. It looks odd to me but when I had & two ampersands were added to the url in the code throwing up another error):
function smarty_cms_function_lang($params, &$smarty)
{
global $gCms;
$config = &$gCms->GetConfig();

global $hls;
global $argv;
$spacer = '';
if(isset($params['spacer'])){
$spacer = " " . $params['spacer'];
}
$query_string = $_SERVER['argv'][0];
$selector = '';
if (!isset($hls)){
echo "Languages not set!";
return false;
}

if ($config["assume_mod_rewrite"])
{
$hasparams = false;
$lankey = 0;
$thepage = (isset($params['defaultpage']) ? $params['defaultpage'] : 'home.html');
foreach ($hls as $key => $mle)
{
$url_parts = explode("/", $_SERVER['PHP_SELF']);
foreach ($url_parts as $url_part_key => $url_part_value)
{
if($key == $url_part_value)
{
$thepage = $url_parts[$url_part_key+1];
break;
}
}

$link_url = $config["root_url"] . "/" . $key . "/" . $thepage;
$selector .= ''.$mle['flag']."".$spacer."\n";
}
}
else if ($config['internal_pretty_urls'])
{
$lan = '';
$thispage = $_SERVER['PHP_SELF'];
$url_parts = explode("/", $thispage);
foreach ($url_parts as $url_part_key => $url_part_value)
{
foreach ($hls as $key => $mle)
{
if($key == $url_part_value)
{
$lan = $key;
break;
}
}
}
if($lan==''){
$lan = DEFAULT_LANG;
$thispage .= "/" . $lan . "/" .
(isset($params['defaultpage']) ? $params['defaultpage'] : 'home');
}
$url_chunks = explode("/$lan/", $thispage);
$thepage = $url_chunks[1];
foreach ($hls as $key => $mle)
{
$link_url = $url_chunks[0] . "/". $key . "/" . $thepage;
$selector .= ''.$mle['flag']."".$spacer."\n";
}
}
else
{
if(strstr($query_string, "hl=")){
foreach ($hls as $key => $mle) {
$link_url = $_SERVER['PHP_SELF'] . "?" . ereg_replace("hl=[_a-zA-Z0-9]+", "amp;hl=".$key, $query_string);
$selector .= ''.$mle['flag']."".$spacer."\n";
}
}
else
{
foreach ($hls as $key => $mle) {
$link_url = $_SERVER['PHP_SELF'] . "?" . $query_string . "amp;hl=".$key;
$selector .= ''.$mle['flag']."".$spacer."\n";
}
}
}

if($spacer != ''){
$length = strlen($spacer);
$selector = substr($selector, 0, -1*($length+1));
}

return $selector;
} ## smarty_function_cms_version

function smarty_cms_help_function_lang() {
?>

With this I get valid xhtml transitional markup. There could be a flaw in this somewhere but haven't found it yet so over to you!

And how dumb am I? (StyleClassForThisTag)  - I have now renamed the class. I thought it was some clever code thing!  ::)

As ever - grazie

Regards
Lynne
alby

Re: Multilanguage CMSMS MLE versione 1.1.2

Post by alby »

chipper wrote: Scrap what I wrote last night - think I was rambling - brain strain due to doing this!!!  ::) Getting my urls mixed up!

I have been playing around this morning, searching the forum etc - didn't find the exact answer so I investigated what could possibly be changed in function.lang and I have now got the site to validate! I have shocked myself  :o

I don't know if this was the correct way to go about things. (The bolded bits are the changes. It looks odd to me but when I had & two ampersands were added to the url in the code throwing up another error):
...........
                                                                                                                                                                                                                                       
Download function.lang.php update from Reply #30 and overwrite
I am testing this for new release

Alby
Last edited by alby on Mon Sep 17, 2007 9:13 am, edited 1 time in total.
josin

Re: Multilanguage CMSMS MLE versione 1.1.2

Post by josin »

Hi. Is it possible to use mod_rewrite whit CMSMS MLE? I tried to use it but it worked just in DEFAULT_LANG version. I couldn't change lang ... Thx for anwer

P.S.: Good work alby!
alby

Re: Multilanguage CMSMS MLE versione 1.1.2

Post by alby »

josin wrote: Hi. Is it possible to use mod_rewrite whit CMSMS MLE? I tried to use it but it worked just in DEFAULT_LANG version. I couldn't change lang ... Thx for anwer
It's possible but I am not a guru in mod_rewrite.
.htaccess may reflect this:
www.mysite.com/it_IT/alias
from www.mysite.com/index.php?page=alias[b]&hl=it_IT[/b]

.htaccess for normal CMSMS is:
www.mysite.com/alias
from www.mysite.com/index.php?page=alias

Ask in a new topic for help
PS: Download function.lang.php update from Reply #30 and overwrite
I am testing this for new release with 1.2

josin wrote: P.S.: Good work alby!
Thank you very much but Katon and devs also

Alby
alby

Re: Multilanguage CMSMS MLE versione 1.1.2

Post by alby »

josin wrote: Hi. Is it possible to use mod_rewrite whit CMSMS MLE? I tried to use it but it worked just in DEFAULT_LANG version. I couldn't change lang ... Thx for anwer
I don't read anymore

From your post:
but it doesn't work. It works, but you can't change lang.
If you change URL (edit) from:
www.mysite.com/DEFAULT_LANG/alias
to:
www.mysite.com/OTHER_LANG/alias
work?

If yes, replace new function.lang.php, check and report

Alby
josin

Re: Multilanguage CMSMS MLE versione 1.1.2 with mod_rewrite

Post by josin »

I made update function.lang.php (#30) and replace this RewriteRule

Code: Select all

RewriteRule ^(.+)$ index.php?page=$1 [QSA]
by

Code: Select all

RewriteRule ^([^/]+)/(.+)$ index.php?page=$2&hl=$1 [QSA]
and it works! You can include it in new MLE version  :)
gk

Re: Multilanguage CMSMS MLE versione 1.1.2

Post by gk »

Hello Alby,
These few words to say that you helped me solve the issue. Things are going the right way. Now I can focus on design and deal with the tricks you mention as for finalising the multilingual option.
Again thank you!!
chipper
Forum Members
Forum Members
Posts: 42
Joined: Thu Aug 09, 2007 5:29 pm

Re: Multilanguage CMSMS MLE versione 1.1.2

Post by chipper »

Hi Alby
In page template you use tag {lang} or is manual entry?
Missed this one sorry -  Here's an answer:

Yes the lang tag is in the template. When you say manual entry did you mean did I code it myself?

(not sure of the term)

Am still working on your last advice - will get back to you when I am done - just having an issue with the lang flags not working with the new function.lang file - very possibly something I have done wrong so am checking.

Fast learnining curve this!

Regards
Lynne
andreTTi

Re: Multilanguage CMSMS MLE versione 1.1.2

Post by andreTTi »

Hi alby and thank you for your great work!

I have installed cmsms mle 1.1.2 and so far it works great except for one small thing. For some reason firefox chooses english as default language although I have configured swedish as default. (With Opera and IE6 it's working and swedish is default)
I tried to follow your instructions as closely as possible but maybe I got somehing wrong..

This is my config_lang.php:
define('DEFAULT_LANG', 'sv_SE');

$hls = array(

'en_US' => array(
'block'=>'en',
'flag'=>'',
),
'sv_SE' => array(
'block'=>'sv',
'flag'=>'',
'locale'=>'sv_SE',
),


Actually i'm not sure about 'locale'=>'sv_SE' ? Is this correct? If not, where can I find the correct locale?

In config.php locale is left empty. ($config['locale'] = '';)

In Site Admin->Global Settings, "Default language for the frontend:" = "No default selected"

What do you mean by "current language (in this way CMSMS load current locale language for ALL modules)"?

In firefox a cookie named "mle" is set to "en_US" when I go to my frontpage. In Opera it is set to "sv_SE" as it should. Default language is set to Swedish in both firefox and opera.

I'm using firefox 2.0.0.7

Maybe it is a bug in firefox? 

Is there a way to force all browser to use swedish as default?

Ok, maybe that's enough questions for now..  :)

Thanks!
Locked

Return to “[locked] CMSMS MLE fork”