Switch between multi-language sites PAGE TO PAGE

If you have created additional (non official) documentation or tutorials or something like that please post this here
Post Reply
pepe
Posts: 3954
Joined: Mon 19. Jan 2004, 13:46

Switch between multi-language sites PAGE TO PAGE

Post by pepe » Tue 12. Apr 2005, 21:49

Hallo phpWCMS-Gemeinde,

vor einiger Zeit habe ich mehrere Möglichkeit ausgeknobelt,
mit der man bei mehrsprachige Sites eine Sprachumschaltung Seite zu Seite vornehmen kann :idea:
Also nicht nur zur jeweiligen Indexseite, sondern zur "passenden" Seite der gewünschten Sprache! :idea:
Die folgende Variante bietet sich an, bei Sites, die den kompletten Seitenumfang in den verschiedenen Sprachen besitzen!

Hello phpWCMS community,

I have worked out some possibilities, to switchover within multilingual sites page to page.
Not only to the respective index page but to the page which is "fitting" of the desired language!
The following variant offers its services at sites which have the complete page size in the different languages!



Landesspezifische Umschaltung "Seite zu Seite" bei mehrsprachige Sites
====================================================
Switch multiple-language sites "page to page"
=================================



Voraussetzung:
------------------
Die Bezeichnungen der ALIAS-Namen sind so gewäht, daß sich äquivalente Seiten nur im Prefix unterscheiden!
Als Trenner wird ein "_" verwendet!

Supposition:
--------------
The ALIAS-names of äquivalent pages must have only different prefixes, separated by a "_"!


Beispiel/Example:
de_neuigkeiten = deutsche Seite
en_neuigkeiten = englische Seite
fr_neuigkeiten = französische Seite


Die folgende PHP-Script entfernt das Prefix vom ALIAS-Namen und gibt den Rest zurück:
(Abzuspeichern unter scripts/strip-prefix.php)
The following PHP-script strips the prefix of the alias-name and gives back the rest:
(Save as scripts/strip-prefix.php)

Code: Select all

<?PHP
// copyright by Manfred Peperkorn :: strip-prefix.php
// find alias-name - strip prefix - give back name without prefix
//    alias:	 de_aliasname-example
//    strip:	 de
//    give back: _aliasname-example

$alias = $GLOBALS['content']['struct'][($GLOBALS['aktion'][0])]['acat_alias'];
$search = "_";
$aliasNOprefix = stristr($alias,$search);
echo $aliasNOprefix;
?>
Du benötigst nun für jede Sprache eine eigene Vorlage, die sich lediglich in wenigen Punkten unterscheidet:
You need a template of your own for every language, which is merely different in few points:



Vorlage DEUTSCH / Template GERMAN
=====================================

- ist mit allen DEUTSCHEN Seiten verbunden
- besitzt in der linken oder rechten Navigationsspalte eine Verknüpfung zur Kategorie DEUTSCH (de)
- enthält einen Link nach dem folgenden Muster:

- Is connected to all German pages.
- Has a connection in the left or right navigation-column to the category German (de).
- Contains a link after the following sample:



Code für Anzeige eines Image-Links:
Code for indication of an image link:

Code: Select all

<!-- Umschaltung/switch -> ENGLISCH -->
&nbsp;&nbsp;
<a href="index.php?en{PHP:scripts/strip-prefix.php}" target="_self">{IMAGE:flaggen/english.gif}</a>

Code für Anzeige eines Text-Links:
Code for indication of an text link:

Code: Select all

<!-- Umschaltung/switch -> ENGLISCH -->
&nbsp;&nbsp;
<a href="index.php?en{PHP:scripts/strip-prefix.php}" target="_self">englisch</a>

Vorlage ENGLISCH/ Template ENGLISCH
=====================================

- ist mit allen ENGLISCHEN Seiten verbunden
- besitzt in der linken oder rechten Navigationsspalte eine Verknüpfung zur Kategorie ENGLISCH (en)
- enthält einen Link nach dem folgenden Muster:

- Is connected to all English pages.
- Has a connection in the left or right navigation-column to the category English(en).
- Contains a link after the following sample:



Code für Anzeige eines Image-Links:
Code for indication of an image link:

Code: Select all

<!-- Umschaltung/switch -> DEUTSCH -->
&nbsp;&nbsp;
<a href="index.php?de{PHP:scripts/strip-prefix.php}" target="_self">{IMAGE:flaggen/deutsch.gif}</a>

Code for indication of an text link:

Code: Select all

<!-- Umschaltung/switch -> DEUTSCH -->
&nbsp;&nbsp;
<a href="index.php?de{PHP:scripts/strip-prefix.php}" target="_self">deutsch</a>
Vies Spass beim Testen :lol:
Last edited by pepe on Wed 13. Apr 2005, 14:50, edited 1 time in total.

User avatar
dbaron
Posts: 74
Joined: Tue 25. Jan 2005, 11:53
Location: France

Post by dbaron » Wed 13. Apr 2005, 08:47

And for people who doesn't understand german?

Thanks :wink:

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

Re: Switch between multi-language sites PAGE TO PAGE

Post by spirelli » Wed 13. Apr 2005, 09:23

dbaron wrote:And for people who doesn't understand german?

Thanks :wink:
pepe wrote:Hello phpWCMS-Community,

Some time ago I developed different possibilities that enables visitors to switch the language of the current page :idea:

This is NOT redirecting to the index page of the other language but to the corresponding page! :idea:

The following solution enablesto have all pages in several languages!



Switch multiple-language sites "page to page"
=================================

Supposition:
------------------
The Alias names are chosen in such a way that corresponding pages differ only in the prefix. Prefix and alias are seperated with "_".


Example:
de_news = German Page
en_news = English page
fr_news = French Page

The following PHP-script strips the prefix of the alias-name and gives back the rest:
(Save as scripts/strip-prefix.php)

Code: Select all

<?PHP
// copyright by Manfred Peperkorn :: strip-prefix.php
// find alias-name - strip prefix - give back name without prefix
//    alias:	 de_aliasname-example
//    strip:	 de
//    give back: _aliasname-example

$alias = $GLOBALS['content']['struct'][($GLOBALS['aktion'][0])]['acat_alias'];
$search = "_";
$aliasNOprefix = stristr($alias,$search);
echo $aliasNOprefix;
?>
Now, for every page a template is needed that only differs in a few points:

GERMAN template
============

linked to all German pages and has a navigation link to the English version, like this:

Code for image link:

Code: Select all

<!-- switch -> ENGLISCH -->
&nbsp;&nbsp;
<a href="index.php?en{PHP:scripts/strip-prefix.php}" target="_self">{IMAGE:flaggen/english.gif}</a>

Code for text link:

Code: Select all

<!-- switch -> ENGLISCH -->
&nbsp;&nbsp;
<a href="index.php?en{PHP:scripts/strip-prefix.php}" target="_self">englisch</a>
ENGLISH template
================

linked to all English pages and has a navigation link to the German version, like this:

Code for image link:

Code: Select all

<!-- switch -> GERMAN -->
&nbsp;&nbsp;
<a href="index.php?de{PHP:scripts/strip-prefix.php}" target="_self">{IMAGE:flaggen/deutsch.gif}</a>
Code for text link:

Code: Select all

<!-- switch -> GERMAN -->
&nbsp;&nbsp;
<a href="index.php?de{PHP:scripts/strip-prefix.php}" target="_self">deutsch</a>
Enjoy testing :lol:
Last edited by spirelli on Wed 13. Apr 2005, 14:54, edited 1 time in total.

brans

Post by brans » Wed 13. Apr 2005, 10:43

sounds cool :-), the only problem is, that the aliases all have to be in one language

ex.: de_produkte => en_produkte

which is very annoying, when using more languages, ex:

de_
nl_
fr_
en_

but nevertheless the best solution I have seen so far.

pepe
Posts: 3954
Joined: Mon 19. Jan 2004, 13:46

Post by pepe » Wed 13. Apr 2005, 14:57

Hi dbaron,
dbaron wrote:And for people who doesn't understand german?

Thanks :wink:
Three possibilities:

1.
Please learn the german language. That's verry easy!
In Germany the little children already speak German :lol:

2.
Use a translater-software.

3.
Read it twice, please THE RED WORDS ARE ENGLISH (i hope :oops: ).
Last edited by pepe on Thu 30. Jun 2005, 12:54, edited 1 time in total.

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

Post by spirelli » Wed 13. Apr 2005, 15:00

.... and I did such a 'nice' translation... :cry:


:wink:

User avatar
dbaron
Posts: 74
Joined: Tue 25. Jan 2005, 11:53
Location: France

Post by dbaron » Wed 13. Apr 2005, 15:17

Sorry one thousand times :cry:

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

Post by spirelli » Wed 13. Apr 2005, 15:28

don't worry, as far as I can remember the english content was not all there a the time of your posting. And I would have even translated it into French if I could speak it. :D

User avatar
dbaron
Posts: 74
Joined: Tue 25. Jan 2005, 11:53
Location: France

Post by dbaron » Wed 13. Apr 2005, 16:30

Thanks for your kindness

pepe
Posts: 3954
Joined: Mon 19. Jan 2004, 13:46

Post by pepe » Wed 13. Apr 2005, 17:17

Hi spirelli,

you are a real friend... and your translation is much, much better than mine....

... i wanted to try it at least, because my schooldays is past many many years :wink:


And spirelli, by the way... You are the bilingual man! Have you tried it? Works?

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

Post by spirelli » Wed 13. Apr 2005, 18:07

No, sorry. Haven't got a bilingual site to use it with. Maybe I'll use it in future!
Last edited by spirelli on Wed 13. Apr 2005, 18:08, edited 1 time in total.

jscholtysik

Post by jscholtysik » Thu 14. Apr 2005, 09:28

Deutsch:
***********************************

Hi pepe,


gab es diese Diskussion mit dem Verfassen von Einträgen nicht schon tausend Mal hier im Forum?

Was war denn das für ein blö..r Kommentar:
Three possibilities:

1.
Please learn the german language. That's verry easy!
In Germany the little children already speak German
Was würdest Du davon halten, wenn so ein Kommentar gegenüber Dir fallen würde?

Da dies ein internationales Forum sein soll, sollte man die Sprache verwenden, die international am meisten verwendet wird, und das ist nun mal Englisch.

Das Optimum wäre natürlich, gleich von Anfang an alle Nachrichten mehrsprachig zu schreiben (vielleicht Deutsch und Englisch).

Mal wieder ein kleiner Denkanstoß... :-)


Englisch:
***********************************

Hi pepe,


weren't there many discussions about the writing of messages here in this forum?

What was this for a si..y comment:
Three possibilities:

1.
Please learn the german language. That's verry easy!
In Germany the little children already speak German
How would you feel about such a comment concerning you?

This should be an international forum, so we should use the language that is internationally used the most and this is English.

The optimum would be to start or continue writing multilingual entries (perhaps in German and English).

Just think about it ... :-)




Joachim

frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold » Thu 14. Apr 2005, 10:19

http://www.studmed.dk Portal for doctors and medical students in Denmark

brans

Post by brans » Thu 14. Apr 2005, 10:42


User avatar
Kosse
Posts: 1066
Joined: Thu 9. Sep 2004, 12:08
Location: Brussels, Belgium
Contact:

Post by Kosse » Wed 1. Jun 2005, 20:03

Hi pepe,

would be nice to see an example working :P

I live in Belgium and we usually deal with 2 or 3 languages (fr-nl-en/de) when building sites, so as I am to make my first multilingual site, I hesitate between all the solutions you guys presented (frold, brans, fluvio and you... :wink: )

Have you done this somewhere live? could I see a result?
That would help me take the right decision. I like the idea where you go from page_x EN to page_x DE.

But does it work as well without aliases? What about files like 1.0.0.0.0.phtml (if using rewrite) or index.php?id=29,0,0,1,0,0 (if not using rewrite) ???

I would love to use that (but if it's too tricky, I guess I'll cope with a index.php?fr and index.php?nl or even easier: fr/ and nl/)

Thanks, I really appreciate the help you provide around here, all of u!
Congratulations again.

Cheers

PD: I'll check also on StudioZ (Malouin) site, he seems to have manged something...

Post Reply