• Resolved esseespinach

    (@esseespinach)


    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

    https://www.ads-software.com/plugins/qtranslate-slug/

Viewing 5 replies - 1 through 5 (of 5 total)
  • 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 .= " |";
    	}
    Thread Starter esseespinach

    (@esseespinach)

    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!

    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.

    Thread Starter esseespinach

    (@esseespinach)

    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! ??

    Like in
    https://www.ads-software.com/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…”

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Appearance of selector text’ is closed to new replies.