Hi,
Martin (mr-fan) has send me a German and English README file for the code snippet: "Language Switcher". Therefore I decided to release the latest version in this thread.
Basics:This snippets allows you to switch the current displayed page to another language. The snippets requires the same amount and order of pages in the page tree for each supported language (e.g. EN, DE).
For each language, one has to set-up an identical page tree (amount + order of pages). If a page does not exists in English, but in German, one needs to create a "dummy-page" for that missing English page. A "dummy-page" is a page without content and the visibility set to "NONE".
Example (from the README file):
(Container - German) (Container - English)
DE.php EN.php (page name as you like, recommended: EN, DE, NL ...)
- Startseite - Home
- Seite 1 - site 1
- Seite 2 - no "site 2" exists (create dummy-page; visibility:= "NONE")
Using the Snippets:Install the snippet via the backend. Then invoke the new function switchLanguage from the index.php file of your template (or a page/section of type code).
<?php
if (function_exists('switchLanguage')) {
switchLanguage(array('EN' => 12, 'DE' => 14));
}
?>
The example assumes that the English container page has the page_id 12, the German one 14.
Further information can be found in the Germand and English READM files located in the moduel folder: /modules/switch_language/help/.
Pros and Cons of the module: + does not need any further information to switch pages (e.g. tags, page_id)
+ function needs to be invoked once, thats it (invoke with ALL container pages like DE, EN, ...)
+ flag icons are created automatically
- page tree (amount and order of pages) must be identical for ALL languages
- if no page exists for a certain language, you have to create a dummy-page (no content, visibility: NONE)
Martin, thank you very much for the READMDE files.
Link to German forum thread: click hereRegards Doc
P.S.: There exists another interesting solution worked out by the forum member FrankH:
Easy Multilanguage Link which requires some smaller core file modifications.
Note: Download removed as a newer version is available in this thread.