headhunter
Posts: 130
|
Posted: 06/10/2004, 11:49 PM |
|
I have implemented the Multi language module from Sixto. http://ccs.ath.cx:/~ccs/kb.php?language_id=7&category_id=37&event_id=101
I have 3 languages and want to make it possible to change the language while in the application by selecting it in a select dropdown list, and if possible, without losing url parameters etc...
It may be done via a session or url parameter (lang_id=1 or 2 or 3)
Thx for your help
|
|
|
Sixto Luis Santos
|
Posted: 06/18/2004, 2:09 AM |
|
Ooopps! Sorry Bart, missed your post... :)
To have a dropdown as the language selector, you can do something like this:
First, add the dropdown to the HTML of the page (you can add as many
languages as you need):
<select name="lang_id" onchange="document.location.href=this.value;">
<option value="{lang_1_url}" {lang_1_sel}>Language 1</option>
<option value="{lang_2_url}" {lang_2_sel}>Language 2</option>
</select>
Then, in the BeforeShow of the page:
global $Tpl;
$num_langs=2; // Number of languages
$act_lang=GetLangID(); // Get the current language
$this_page=$_SERVER["PHP_SELF"]; // Get the current base URL
$params=CCGetQueryString("QueryString", Array("lang_id")); // Get the
parameters (minus lang_id)
do{ // For each language, set the template variable to the appropriate
value
$Tpl->SetVar("lang_".$num_langs."_url",$this_page."?".CCAddParam($params,"la
ng_id",$num_langs));
$Tpl->parse("lang_".$num_langs."_url",false);
} while($num_langs--);
if($act_lang){ // Make the active language the selected option of the
dropdown
$Tpl->SetVar("lang_".$act_lang."_sel","selected");
$Tpl->parse("lang_".$act_lang."_sel",false);
}
Regards, and sory for the belated response.
Sixto
"headhunter" <headhunter@forum.codecharge> wrote in message
news:540c95603afcf5@news.codecharge.com...
> I have implemented the Multi language module from Sixto.
> http://ccs.ath.cx:/~ccs/kb.php?language_id=7&category_id=37&event_id=101
>
> I have 3 languages and want to make it possible to change the language
while in
> the application by selecting it in a select dropdown list, and if
possible,
> without losing url parameters etc...
>
> It may be done via a session or url parameter (lang_id=1 or 2 or 3)
>
> Thx for your help
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
Sixto Luis Santos
|
Posted: 06/18/2004, 2:09 AM |
|
Ooopps! Sorry Bart, missed your post... :)
To have a dropdown as the language selector, you can do something like this:
First, add the dropdown to the HTML of the page (you can add as many
languages as you need):
<select name="lang_id" onchange="document.location.href=this.value;">
<option value="{lang_1_url}" {lang_1_sel}>Language 1</option>
<option value="{lang_2_url}" {lang_2_sel}>Language 2</option>
</select>
Then, in the BeforeShow of the page:
global $Tpl;
$num_langs=2; // Number of languages
$act_lang=GetLangID(); // Get the current language
$this_page=$_SERVER["PHP_SELF"]; // Get the current base URL
$params=CCGetQueryString("QueryString", Array("lang_id")); // Get the
parameters (minus lang_id)
do{ // For each language, set the template variable to the appropriate
value
$Tpl->SetVar("lang_".$num_langs."_url",$this_page."?".CCAddParam($params,"la
ng_id",$num_langs));
$Tpl->parse("lang_".$num_langs."_url",false);
} while($num_langs--);
if($act_lang){ // Make the active language the selected option of the
dropdown
$Tpl->SetVar("lang_".$act_lang."_sel","selected");
$Tpl->parse("lang_".$act_lang."_sel",false);
}
Regards, and sory for the belated response.
Sixto
"headhunter" <headhunter@forum.codecharge> wrote in message
news:540c95603afcf5@news.codecharge.com...
> I have implemented the Multi language module from Sixto.
> http://ccs.ath.cx:/~ccs/kb.php?language_id=7&category_id=37&event_id=101
>
> I have 3 languages and want to make it possible to change the language
while in
> the application by selecting it in a select dropdown list, and if
possible,
> without losing url parameters etc...
>
> It may be done via a session or url parameter (lang_id=1 or 2 or 3)
>
> Thx for your help
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
|