WordPress.org

Ready to get started?Download WordPress

Forums

Qtranslate Slug
[resolved] Appearance of selector text (6 posts)

  1. esseespinach
    Member
    Posted 9 months ago #

    I'm trying to put in the header of my site selector for language qtranslate slug. I found this to work:

    <php if (function_exists ('qts_language_menu')) qts_language_menu ('text', array ('short' => true));?>

    but, how can make it looks "ES | CA | EN" instead of "es ca en"?

    With qtranslate I have this code:

    <php if (function_exists ('qtrans_generateLanguageSelectCode')) qtrans_generateLanguageSelectCode ('text')?> <script> jQuery (document). ready (function () {jQuery ('. lang-is a span'). html ('ES | '), jQuery ('. lang-ca to span '). html (' CA | '), jQuery ('. lang-in a span '). html (' EN ');}) </ script>

    Works in terms of appearance, but does not translate url.

    Thank you!,
    Esther

    http://wordpress.org/plugins/qtranslate-slug/

  2. Carret
    Member
    Posted 9 months ago #

    Edit file "qtranslate-slug.php". At function "language_menu" change

    } else {
    	$link_class = '';
    	$link_content = $language_name;
    	}

    to

    } else {
    	$link_class = '';
    	//$link_content = $language_name;
    	$link_content = strtoupper($lang);
    	if ( $index != (count($languages) - 1) ) $link_content .= " |";
    	}
  3. esseespinach
    Member
    Posted 9 months ago #

    Thank you very much! I works perfectly! :)

    The only problem I have seen with this code is that it changes the format of the footer qtranslate slug widget too. I had on the footer
    "Choose your language:
    Español
    Català
    English"

    and with this code has transformed to:
    "Choose your language:
    ES |
    CA |
    EN"

    I have removed this widget (it was not important) but I wanted to comment it.

    Thank you again!

  4. Carret
    Member
    Posted 8 months ago #

    You are welcome. That was easy.

    For to have both: "Español Català..." and "ES | CA...", try this:

    After the lines

    case 'image':
    case 'text':
    case 'both':

    add

    case 'text-short':

    and put this code instead of the previous:

    } else {
         if ($type == 'text') {
    	$link_class = '';
    	$link_content = $language_name;
         }
         if ($type == 'text-short') {
           	$link_content = strtoupper($lang);
           	if ( $index != (count($languages) - 1) ) $link_content .= " |";
         }
    }

    Saludos.

  5. esseespinach
    Member
    Posted 8 months ago #

    Thank you very much, but it does not work for me... :(

    I have added
    case 'text-short':

    And I have modified your code like this (your code didn't work):
    } else if ($type == 'text') {
    $link_class = '';
    $link_content = strtoupper($lang);
    if ( $index != (count($languages) - 1) ) $link_content .= " |";
    } else if ($type == 'text-short') {
    $link_class = '';
    $link_content = "$language_name";
    if ( $index != (count($languages) - 1) ) $link_content .= " |";
    }

    But the second part of the code doesn't work...
    Do you have any idea?
    Muchas gracias! :)

  6. Carret
    Member
    Posted 8 months ago #

    Like in
    http://wordpress.org/support/topic/appearance-of-selector-text?replies=5#post-4807244

    just remove the original code for this one:

    } else {
         if ($type == 'text') {
    	$link_class = '';
    	$link_content = $language_name;
         }
         if ($type == 'text-short') {
    	$link_class = '';
           	$link_content = strtoupper($lang);
           	if ( $index != (count($languages) - 1) ) $link_content .= " |";
         }
    }

    Use "qts_language_menu('text')" to show "Español Català.."
    and "qts_language_menu('text-short')" to show "ES | CA..."

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.