Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Language change problem!
Old 06-16-2007, 07:46 AM Language change problem!
Experienced Talker

Posts: 49
Location: Pula, Istra, Croatia
Trades: 0
I have 4 language web page...php with include functions.
I want that each page can be reached in any language directly.When I am on english version just to click on italian flag and to get italian version.
Now I can only go ?lang=ita which redirects me few pages back and I need (my visitors) to again browse to desired page.

Is there a script that will get adress bar content and just add ?lang=ita (or any other language) at its end.In that way current page will just change language.Thats my goal.

TNX for answers.
shile is offline
Reply With Quote
View Public Profile Visit shile's homepage!
 
 
Register now for full access!
Old 06-16-2007, 08:13 AM Re: Language change problem!
Ultra Talker

Posts: 251
Location: Belgium, Antwerp, Zoersel
Trades: 0
Well, if you've got a static address in your address bar, you could simply use "?lang=ita" in a link:

HTML Code:
<a href="?lang=ita">Italian</a>
If not, since you're using php, you could do it like this:

PHP Code:
<?php
$queryparts
=array();
foreach(
$_GET as $k=>$g){
  
$queryparts[]="$k=$g";
}
$queryparts[]='lang=ita';
$urlquery=implode('&amp;'$queryparts);
?>
<a href="?<?=$urlquery?>">Italian</a>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by Orodreth; 06-16-2007 at 08:14 AM..
Orodreth is offline
Reply With Quote
View Public Profile Visit Orodreth's homepage!
 
Old 06-16-2007, 09:30 AM Re: Language change problem!
Experienced Talker

Posts: 49
Location: Pula, Istra, Croatia
Trades: 0
Big thanx....its working.

I will have 4-5 languages....and I need for each language this code...

If you can please post unique code .... if not I will use this code for each language separately...

In any case BIG THANKS!!
shile is offline
Reply With Quote
View Public Profile Visit shile's homepage!
 
Old 06-16-2007, 03:43 PM Re: Language change problem!
Ultra Talker

Posts: 251
Location: Belgium, Antwerp, Zoersel
Trades: 0
You could do this:

PHP Code:
<?php
$queryparts
=array();
foreach(
$_GET as $k=>$g){
  
$queryparts[]="$k=$g";
}
$langs=array('Italian'=>'ita''Dutch'=>'ned''German'=>'deu''English'=>'eng''French'=>'fra');
foreach(
$langs as $f=>$s){
  
$tempqueryparts=$queryparts;
  
$tempqueryparts[]="lang=$s";
  
$tempquery=implode('&amp;'$tempqueryparts);
?>
<a href="?<?=$tempquery?>"><?=$n?></a>
<?php
}
?>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Orodreth is offline
Reply With Quote
View Public Profile Visit Orodreth's homepage!
 
Old 06-18-2007, 04:38 PM Re: Language change problem!
Experienced Talker

Posts: 49
Location: Pula, Istra, Croatia
Trades: 0
will try it...thnx
shile is offline
Reply With Quote
View Public Profile Visit shile's homepage!
 
Reply     « Reply to Language change problem!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.69877 seconds with 12 queries