Multilanguage switcher, it's works.

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
pw
Posts: 8
Joined: Wed 25. Feb 2004, 16:58

Multilanguage switcher, it's works.

Post by pw »

Hello,
I just done simple switcher the same article in another language.
When you click on the link (flag), you will move in another article ( in apprioprate lang ):
I have x langs:


Root (PL)
article1
article2
EN
article1_en
article2_en
:
:

In my header :


<a href="
[PHP]
print($_SERVER['REQUEST_URI'])
[/PHP]

_en"> EN (flag)</a>

:
:
etc...
(I tested only on the aliases!)

Salute,
Pawel
WeDgE
Posts: 51
Joined: Tue 30. Mar 2004, 22:53
Location: France (Nice)

Post by WeDgE »

i want to know, i want to add this function for all the website, to switch in other language of the navigation link, article...

phpwcms have this function or is your modification ?
WeDgE
Posts: 51
Joined: Tue 30. Mar 2004, 22:53
Location: France (Nice)

Post by WeDgE »

ok sorry i just find this

[PHP]
if(!$GLOBALS['aktion'][0]) {

switch( strtolower( substr( $_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2 ) ) ) {
case 'de': header('Location: '.$GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'index.php?de');
exit();
break;
default: header('Location: '.$GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'index.php?en');
exit();
}

}
[/PHP]
east
Posts: 17
Joined: Mon 11. Apr 2005, 12:30

Post by east »

WeDgE wrote:ok sorry i just find this

[PHP]
if(!$GLOBALS['aktion'][0]) {

switch( strtolower( substr( $_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2 ) ) ) {
case 'de': header('Location: '.$GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'index.php?de');
exit();
break;
default: header('Location: '.$GLOBALS['phpwcms']['site'].$GLOBALS['phpwcms']['root'].'index.php?en');
exit();
}

}
[/PHP]
... sorry, I'm a Newbie !
Where I must copy this code if the Function is working ?

east
spirelli
Posts: 996
Joined: Tue 27. Jul 2004, 13:37
Location: London

Post by spirelli »

I figure you sould put this into the "html head:" section of your template.
east
Posts: 17
Joined: Mon 11. Apr 2005, 12:30

BRR

Post by east »

Behind the META Tags ?

I do that, but ... nothing.
Pappnase

Post by Pappnase »

hello

create an article called e.g. redir place the script in the summary field. and save it.

root
-redir(article)
--pl(structurelevel)
--en(structurelevel)
east
Posts: 17
Joined: Mon 11. Apr 2005, 12:30

Bitte noch mal in deutsch

Post by east »

... muss wohl mal mein englisch erweitern ...

nur Bahnhof ...

danke
spirelli
Posts: 996
Joined: Tue 27. Jul 2004, 13:37
Location: London

Post by spirelli »

ok, mein Gerate war falsch. Pappnase liegt da richtig und auf Deutsch ist das:

Erstelle einen Artikel der z.B. "weiterleitung" benannt ist. Das obige PHP script fuegst Du in das Feld 'Schlagtext' ein + speicherst das ganze.

Dann muss Deine Struktur folgende Ebenen haben:

-weiterleitung (mit Weiterleitungsarikel)
--de
--en
gl
Posts: 1
Joined: Tue 3. May 2005, 10:59

Multilanguage switcher, it's works.

Post by gl »

Hello all,
I used the WeDgE suggestion successfully.
What I changed is the switch clause, like this:
switch( strtolower( substr( $_SERVER['REQUEST_URI'],6, 2 ) ) )
In this way the check is explicitly on the user request and not on the browser configuration.....

bye

gl
Post Reply