Thread: Lang selector

Results 1 to 9 of 9
  1. #1
    Join Date
    Dec 2005
    Posts
    25
    Plugin Contributions
    0

    Default Lang selector

    Hi,

    I've looked everywhere I could in the forum to find what I need.

    I would like to have a text link in my header for lang selection. This is already done and is working. But how i could have this link show only the unactive lang and hide the active lang ??

    Thanx for any help

    maximil
    Maximil

  2. #2
    Join Date
    Dec 2005
    Posts
    25
    Plugin Contributions
    0

    Re: Lang selector

    Hi again,

    I would like to display a text link of the unactive language (and thus, hide the active lang) in my header. I was able to display the lang flags but not the text and all my available lang are displayed ??

    Thanx again for any help

    Maximil
    Maximil

  3. #3
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Lang selector

    You would have to create custom code to exclude the current language from displaying. Is there a real benefit to this?
    Zen-Venom Get Bitten

  4. #4
    Join Date
    Dec 2005
    Posts
    25
    Plugin Contributions
    0

    Default Re: Lang selector

    The only benefits it would provide are aesthetical of course. The french guy buying (i hope) on my site really doesn't need to have displayed the french flag or text title !!

    That's why i want to get rid of the "other" text title.

    Still want to help me ??

    Here's my actual code

    <?php
    $lng = new language;
    $languages_string = '';
    reset($lng->catalog_languages);
    $lng_cnt = 0;
    while (list($key, $value) = each($lng->catalog_languages)) {
    $languages_string .= '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type) . '" class="lang">' . zen_image(DIR_WS_LANGUAGES . $value['directory'] . '/images/' . $value['name'], $value['name']) . '</a>;';
    $lng_cnt ++;
    }
    echo $languages_string;
    ?>

    I tweaked the two $value and inserted the 'name' in it. But it doesn't seem to work in IE, only in FF ??

    Maximil
    Maximil

  5. #5
    Join Date
    Dec 2005
    Posts
    25
    Plugin Contributions
    0

    Default Re: Lang selector

    Anyone out there willing to help me ???

    Thanks
    Maximil

  6. #6
    Join Date
    May 2004
    Location
    Hong Kong
    Posts
    1,291
    Plugin Contributions
    1

    Default Re: Lang selector

    I have the opposite approach.
    I want to highlight the language which is selected by the users who come from different zones and with different customs.

    I am modifying the mod of Language/Currency Links in Header and under testing.

    The code logic below works for me. You may refer and modify it for you purpose.
    PHP Code:
      while (list($key$value) = each($lng->catalog_languages)) {
        
    // If current languages_id NOT matched with the returned languages id 
        
    if (!($_SESSION['languages_id'] == $value['id'])) {
            
    // display normal effect for languages and flags
            
    $content .= '<div id="navLanguages"><a href="' zen_href_link($_GET['main_page'], zen_get_all_get_params(array('language''currency')) . 'language=' $key$request_type) . '">' zen_image(DIR_WS_LANGUAGES .  $value['directory'] . '/images/' $value['image'], $value['name']) . '</a></div>';
        } else {
            
    // If current language_id matched with the returned languages id, display special effect for selected language and flag 
            
    $content .= '<div id="navLanguagesSelected"><a href="' zen_href_link($_GET['main_page'], zen_get_all_get_params(array('language''currency')) . 'language=' $key$request_type) . '">' zen_image(DIR_WS_LANGUAGES .  $value['directory'] . '/images/' $value['image'], $value['name']) . '</a></div>';
        }
      }
      
      echo 
    $content
    Last edited by seethrou; 24 Sep 2006 at 07:03 AM.
    A New Starter again

  7. #7
    Join Date
    Dec 2005
    Posts
    25
    Plugin Contributions
    0

    Default Re: Lang selector

    Hi,

    I'm still looking for a way to display only the unactive lang. Since i'm really not a good PHPer i'm asking for help. I came able to make this code
    PHP Code:
    <?php if ( ???) {
    <
    a href="<?php echo zen_href_link($_GET['main_page'], zen_get_all_get_params(array('language', 'currency')) . 'language=en'); >">English</a>&nbsp;&nbsp;
    } else {
    <
    a href="<?php echo zen_href_link($_GET['main_page'], zen_get_all_get_params(array('language', 'currency')) . 'language=fr'); ?>">Français</a>
    }
    ?>
    What is the variable that I could place instead of the if (???) ... Is there a variable that indicates which is the active lang ??? With that i could says something like :
    if (en is active) display french
    else
    display english

    Thanks

    Maximil
    Maximil

  8. #8
    Join Date
    Dec 2005
    Posts
    25
    Plugin Contributions
    0

    Default Re: Lang selector

    Hi,

    finaly made it here's the code :
    PHP Code:
    <?php
    if (!($_SESSION['languages_id'] == '3')) {
    ?>
    <a href="<?php echo zen_href_link($_GET['main_page'], zen_get_all_get_params(array('language''currency')) . 'language=en'); ?>">English</a>&nbsp;&nbsp;
    <?php    } else { ?>
    <a href="<?php echo zen_href_link($_GET['main_page'], zen_get_all_get_params(array('language''currency')) . 'language=fr'); ?>">Français</a>
    <?php    ?>
    One can change the languages_id and the links to match his settings

    Maximil
    Maximil

  9. #9
    Join Date
    May 2004
    Location
    Hong Kong
    Posts
    1,291
    Plugin Contributions
    1

    Default Re: Lang selector

    They key is
    $_SESSION['languages_id']

    It is the language id that the user are using or selected
    If you only have two languages, it is two by one choice or toggle on / off.
    May be it can be simplified.

    if (!$_SESSION['languages_id'])
    A New Starter again

 

 

Similar Threads

  1. Vietnamese Lang...
    By kimsonvu in forum Addon Language Packs
    Replies: 12
    Last Post: 8 Mar 2009, 01:32 AM
  2. German Lang install
    By tbokich in forum Addon Language Packs
    Replies: 1
    Last Post: 25 Apr 2008, 05:35 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR