Welcome, Guest. Please login or register.
Did you miss your activation email?
May 25, 2012, 12:53:46 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155504 Posts in 21710 Topics by 7736 Members
Latest Member: deenangle
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Snippet: Language Switcher  (Read 5771 times)
doc
Guest
« on: May 31, 2009, 11:25:46 PM »

If you search for similar ones, please have a look at Language Matrix or the language switcher module from the authors Iceat and Luisehahne.

Regards Christian

Removed outdated version.
« Last Edit: July 21, 2009, 09:05:53 PM by doc » Logged
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #1 on: June 01, 2009, 12:38:50 PM »

Hello Christian.

The new features works great!

There is only a problem if you have some alterations in the page trees of the different (tested with 2) languages.

Example:

DE
- Start
- mein Test
-- erster Test
-- zweiter Test

- meine Ergebnise
-- bestes Ergebnnis
-- mittleres Ergebnis

- Preise und Ehrungen
       
EN
- Welcome
- my Test
-- firstTest

- my Results
-- best Result

- Awards


Up to firstTest/ersterTest everythig is going fine.

It means the snippet works only good if you have the same structure in all your languages.

 undecided

The same Problem appears if you have the same structure and then you switch one of your pages to "hidden".

Regards,
Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #2 on: June 01, 2009, 02:13:17 PM »

Hello Doc.

I like (and will use) your snippet anyway.

It's very handy so far.

Thank you for your efforts!

Regards,
Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
doc
Guest
« Reply #3 on: July 20, 2009, 08:15:55 PM »

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):
Code:
(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).
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 here

Regards 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.
« Last Edit: August 29, 2009, 07:15:57 AM by doc » Logged
doc
Guest
« Reply #4 on: August 29, 2009, 07:12:21 AM »

Hi,

as requested by the forum member mr-fan, I added IDs to the language flag icons created by the code snippet for better access and styling with CSS. The default flag output is as follows:

Code:
<a href="page.php" target="_self" title="DE">
<img id="flag_icon_de" class="flag_icon" src=".../images/DE.gif" alt="DE" />DE
</a>

Regards Doc
Logged
mylesk42

Offline Offline

Posts: 120



WWW
« Reply #5 on: June 26, 2010, 10:34:35 AM »

  Php Error with switch_language modul
« on: June 25, 2010, 05:03:19 PM »     

--------------------------------------------------------------------------------
I've already posted this topic in the modul forum but think it's more specific here

Hello,
I've just encoutereed a problem with the switch_language modul :

Notice: Undefined index: 692 in /home/xxxx/public_html/xxxxxx/xxxxx/modules/switch_language/include.php on line 170

This line is repeated 6 times from index 687 to index 692.

I have other multi languages websites wit non problem. There was no problem until (I suppose) I've installed calendar-v2 + calendar month + calendar month link. I deleted the 3 moduls + the swtich language then re installed the switch language but I have the same errors. The EN and FR pages are creaed equal.

An idea ?

Regards
Logged
mylesk42

Offline Offline

Posts: 120



WWW
« Reply #6 on: June 26, 2010, 04:42:27 PM »

I've updated the php code in the index.php (commented and then uncommented the php coe) and now it works like before.
Weird, but
Logged
mylesk42

Offline Offline

Posts: 120



WWW
« Reply #7 on: January 23, 2011, 12:47:02 PM »

Hello,

I'm using language switcher and the by default showing, I mean the flags.

How could I use this module to show the langusges in a drop down menu ?

Regards
Logged
kweitzel
Forum administrator
*****
Offline Offline

Posts: 6975


WWW
« Reply #8 on: January 26, 2011, 10:11:57 AM »

It seems to me nobody is actively interested in this Module.

cheers

Klaus
Logged

WebsiteBaker Org e.V. - for WebsiteBaker

mylesk42

Offline Offline

Posts: 120



WWW
« Reply #9 on: January 27, 2011, 06:19:22 PM »

It's weirf because it's used. And 'Doc' isn't part of ths forum anymore ?
Regards
Logged
kweitzel
Forum administrator
*****
Offline Offline

Posts: 6975


WWW
« Reply #10 on: January 27, 2011, 07:44:44 PM »

The fact that it is in use does not mean, that anybody is interested in developing it anymore (unfortunately). And DOC decided not to participate.

cheers

Klaus
Logged

WebsiteBaker Org e.V. - for WebsiteBaker

Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #11 on: January 27, 2011, 08:37:34 PM »

Hello,

I'm using language switcher and the by default showing, I mean the flags.

How could I use this module to show the langusges in a drop down menu ?

Regards


Hello, you want to have the switcher with a combobox of HTML Element "select->option"?, like here?:
http://www.w3schools.com/tags/tag_select.asp
Without images?

Regards,
Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
mylesk42

Offline Offline

Posts: 120



WWW
« Reply #12 on: January 27, 2011, 11:48:32 PM »

Hello Stefek and thanks for your response.

Yes, I'd like a combo box (with the flags why not), but don't know what php code to assign and where.

Regards
Logged
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #13 on: January 28, 2011, 12:04:27 AM »

(with the flags why not)
Hello,
the problem with flags is, that some browsers doesn't support hem.

Regards,
Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
mylesk42

Offline Offline

Posts: 120



WWW
« Reply #14 on: January 28, 2011, 09:38:35 AM »

If you know where to change the code to show a combo box (without flags), you're welcome !

Regards
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!