Page 1 of 1

Multilanguage switcher, it's works.

Posted: Mon 4. Apr 2005, 11:59
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

Posted: Fri 8. Apr 2005, 00:57
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 ?

Posted: Fri 8. Apr 2005, 01:06
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]

Posted: Mon 11. Apr 2005, 17:12
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

Posted: Mon 11. Apr 2005, 17:26
by spirelli
I figure you sould put this into the "html head:" section of your template.

BRR

Posted: Mon 11. Apr 2005, 19:28
by east
Behind the META Tags ?

I do that, but ... nothing.

Posted: Mon 11. Apr 2005, 23:53
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)

Bitte noch mal in deutsch

Posted: Tue 12. Apr 2005, 01:08
by east
... muss wohl mal mein englisch erweitern ...

nur Bahnhof ...

danke

Posted: Tue 12. Apr 2005, 01:33
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

Multilanguage switcher, it's works.

Posted: Tue 3. May 2005, 11:55
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