• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: switching language
PostPosted: Fri Jan 04, 2008 10:48 pm 
Hi,

I would like to have a bilangual website without flags to make switch the language.
I means , if we are in English and want to switch to French, you have just to click on "french" and when you are in French
just click on "English" but not have the both option in the same time.

I'm not a php developper but just a integrator. I would really appreciate if someone can help me to solve this issue.

Thanks


Top
   
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: switching language
PostPosted: Sat Jan 05, 2008 10:11 am 
Offline
Support Guru
Support Guru
User avatar

Joined: Mon Jul 04, 2005 5:12 pm
Posts: 4809
Location: Ferrara, Italy
linoleum wrote:
I would like to have a bilangual website without flags to make switch the language.
I means , if we are in English and want to switch to French, you have just to click on "french" and when you are in French
just click on "English" but not have the both option in the same time.

I'm not a php developper but just a integrator. I would really appreciate if someone can help me to solve this issue.


You must go to MLE version or wait for 2.0 release

Alby

_________________
Former Italian Admin and Moderator
Multilingual: MLE is not CMSMS


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: switching language
PostPosted: Sun Jan 20, 2008 12:05 am 
Offline
Administrator
Administrator
User avatar

Joined: Tue Nov 28, 2006 8:39 pm
Posts: 446
Location: Norway
By using the top menu level as languages and use two diferent templates you should acomplish this.
Just hardcode the flags for the languages as top level and set the showing menu to start at level two.
Make the english flag show in the french template and the french flag in the english template. And set all english pages to english template and french to use french template.
(But then you click the flag you will always end on same landing page.)

_________________
ReneH 8-)
A search will save you hours waiting for an answer! Image


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: switching language
PostPosted: Sun Jan 20, 2008 6:52 am 
Offline
Dev Team Member
Dev Team Member
User avatar

Joined: Wed Oct 25, 2006 8:29 pm
Posts: 4969
Location: Raalte, the Netherlands
I use the top-level for the languages as well.....

I also use a UDT to show the browser-language as the first page to be shown, but that is optional....

http://forum.cmsmadesimple.org/index.ph ... 805.0.html

You dont need the UDT, and can set any page as the default landing-page, but with the UDT on the landingpage, you push the viewer to the page with their language if available, else it goes to the default-page......

Ronny


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: switching language
PostPosted: Fri Sep 26, 2008 7:21 pm 
Offline
Forum Members
Forum Members

Joined: Mon Nov 26, 2007 4:46 pm
Posts: 191
linoleum wrote:
Hi,

I would like to have a bilangual website without flags to make switch the language.
I means , if we are in English and want to switch to French, you have just to click on "french" and when you are in French
just click on "English" but not have the both option in the same time.

I'm not a php developper but just a integrator. I would really appreciate if someone can help me to solve this issue.

Thanks



Simple insert in the header of your website (or where you want users to toggle)
===================================================
English | French

NOTE: I changed the English and French acronym to "en" and "fr" (the defaults were "usa" and "fra" (sorry but Canadians are English and some French so I preferred to use a 2-letter acronym for the language instead of the originating Country))

I just installed this module moments ago - thank goodness for it and thanks to the developers!!  Here's what I did to quickly toggle between languages....

NOTE: I am using CMSMS Version 1.4.1

Good luck and enjoy this great addon!!


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: switching language
PostPosted: Fri Sep 26, 2008 7:51 pm 
Offline
Support Guru
Support Guru
User avatar

Joined: Mon Jul 04, 2005 5:12 pm
Posts: 4809
Location: Ferrara, Italy
inyerface wrote:
Simple insert in the header of your website (or where you want users to toggle)
===================================================
English | French


This is MLE sintax, for language trees depend from method used

Alby

_________________
Former Italian Admin and Moderator
Multilingual: MLE is not CMSMS


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: switching language
PostPosted: Tue Sep 22, 2009 4:53 am 
Offline
Forum Members
Forum Members

Joined: Tue Sep 22, 2009 4:38 am
Posts: 11
I used to use the above code as well, just problem is that you will always be redirected again to the homepage. So what you basically want is to use the current URL with the language parameter added to it, so you will return to your current page, just within the language of your choice.

As I am fairly new to cmsms, I could not find an existing TAG to retrieve the current URL, so I wrote a small UDT named: get_url. It pretty much does what it says it does: returning your current URL. It comes with the options to remove and add certain variables.

How to use it? I created a global content block for the language options (so it changes with the language in MLE version or v2.x)
Code:
<a title="English" href="{get_url add='hl=en_US'}"><img src="images/lang/gb.png" alt="English" /></a>
<a title="Nederlands" href="{get_url add='hl=nl_NL'}"><img src="images/lang/nl.png" alt="Nederlands" /></a>
<a title="Francais" href="{get_url add='hl=fr_FR'}"><img src="images/lang/fr.png" alt="Francais" /></a>

Note: You could unlink the language you are showing at the moment.

Code to insert into your UDT (User defined tag):
Code:
/*
 * Get the current URL
 * Parameters:
 * - remove (array of vars to remove from URL)
 * - add (array of vars to add to URL)
 *
 * Examples:
 * {get_url remove="hl" add="hl=us_US:returnid=15"
 *
 * NOTE: Variables are seperated by a ":"
 
*/

$pageURL = 'http';
$REQUEST_URI = $_SERVER["REQUEST_URI"];
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
   $pageURL .= "s";
}
$pageURL .= "://";


if( isset($params['add']) || isset($params['remove']) ) {
   list($file_name, $file_params_string) = explode("?", $REQUEST_URI);
        if( stripos($file_params_string, "&") ) {
           $file_params_array = explode("&", $file_params_string);
        } else {
           $file_params_array = array();
      }
        foreach($file_params_array as $value) {
            if( stripos($value, "=") ) {
                list($k,$v) = explode("=", $value);
            } else {
                $k = $value;
                $value = "$k=";
            }
            $file_params[$k] = $value;
        }

        if( isset($params['remove']) ) {
      $params['remove'] = explode(":", $params['remove']);

                foreach($params['remove'] as $k) {
         unset($file_params[$k]);
      }
   }
   if( isset($params['add']) ) {
                $params['add'] = explode(",", $params['add']);
      foreach($params['add'] as $key) {
                        if( stripos($key, "=") ) {
                            list($k,$v) = explode("=", $key);
                        } else {
                            list($k,$v) = array($key, "");
                        }
         $file_params[$k] = "$k=$v";
      }
   }
   $REQUEST_URI = $file_name;
   if( count($file_params) ) {
      $REQUEST_URI .= "?" . implode("&", $file_params);
   }
}


if ($_SERVER["SERVER_PORT"] != "80") {
   $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$REQUEST_URI;
} else {
   $pageURL .= $_SERVER["SERVER_NAME"].$REQUEST_URI;
}
return $pageURL;


I am pretty sure the CMSMS Team will include something like this in the new version, but for now, it works for me.

Good luck!


Last edited by joeri on Tue Sep 22, 2009 5:00 am, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: switching language
PostPosted: Wed Sep 23, 2009 9:01 pm 
Offline
Support Guru
Support Guru
User avatar

Joined: Mon Jul 04, 2005 5:12 pm
Posts: 4809
Location: Ferrara, Italy
joeri wrote:
I used to use the above code as well, just problem is that you will always be redirected again to the homepage. So what you basically want is to use the current URL with the language parameter added to it, so you will return to your current page, just within the language of your choice.

As I am fairly new to cmsms, I could not find an existing TAG to retrieve the current URL, so I wrote a small UDT named: get_url. It pretty much does what it says it does: returning your current URL. It comes with the options to remove and add certain variables.


Have you look to lang plugin?

Alby

_________________
Former Italian Admin and Moderator
Multilingual: MLE is not CMSMS


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: switching language
PostPosted: Sat Sep 26, 2009 5:22 am 
Offline
Forum Members
Forum Members

Joined: Tue Sep 22, 2009 4:38 am
Posts: 11
Found it yesterday... ahuh! :(

Thanks anyway.

PS. Too bad documentation is not up to date. I understand its done by fanatics in their spare time, just if they would list the functions/modules they write, ppl would at least know something exists like this.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: switching language
PostPosted: Sat Sep 26, 2009 7:55 pm 
Offline
Support Guru
Support Guru
User avatar

Joined: Mon Jul 04, 2005 5:12 pm
Posts: 4809
Location: Ferrara, Italy
joeri wrote:
PS. Too bad documentation is not up to date. I understand its done by fanatics in their spare time, just if they would list the functions/modules they write, ppl would at least know something exists like this.


Tips and Tricks #2

Alby

_________________
Former Italian Admin and Moderator
Multilingual: MLE is not CMSMS


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: switching language
PostPosted: Sun Sep 27, 2009 9:31 am 
Offline
Forum Members
Forum Members

Joined: Tue Sep 22, 2009 4:38 am
Posts: 11
Ok. I implemented it, but it doesnt get the correct URL for switching purposes when you are in a module. So, still need my own code to do this.

Thanks anyways.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: switching language
PostPosted: Sun Sep 27, 2009 9:21 pm 
Offline
Support Guru
Support Guru
User avatar

Joined: Mon Jul 04, 2005 5:12 pm
Posts: 4809
Location: Ferrara, Italy
joeri wrote:
but it doesnt get the correct URL for switching purposes when you are in a module.


Obviously that module does not use CMSMS API
It could be a problem with new versions of CMSMS

Alby

_________________
Former Italian Admin and Moderator
Multilingual: MLE is not CMSMS


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
A2 Hosting