WordPress.org

Forums

qTranslate
[resolved] How to use qTranslate is this situation? (9 posts)

  1. iLucato
    Member
    Posted 1 year ago #

    I have the following code:

    <a href="' . wp_logout_url( get_permalink( ) ) . '" title="Logout">(<i class="icon-key"> </i> Logout)</a>';

    I have already tried [:en] or <!--:en--> but it is printing on the screen the tag I used. Example of the results on the screen from the code above:

    ([:en] Logout)

    (<!--:en--> Logout)

    How to set the correct code for the situation above?

    Thanks in advance

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

  2. parcodeisuoni
    Member
    Posted 1 year ago #

    Hi,
    had similar issues, I solved with this kind of syntax:
    (<!--:en-->Logout<!--:-->)

    try it, hope this may help

    Marcello

  3. iLucato
    Member
    Posted 1 year ago #

    Hi Marcello, thanks for your reply, but as I've posted, I have already tried to use [:en] or <!--:en--> on the code above, but it is printing on the screen the tag I used.

    Example of the results on the screen from the code above:

    ([:en] Logout)

    (<!--:en--> Logout)

    So when using href plus . and alll that code need to do something different I think.

  4. parcodeisuoni
    Member
    Posted 1 year ago #

    Where are you using the link? e.g. is it a menu voice, a button, or what?

    for me worked inside a menu link, which translates properly now.

    but the code <a href="' . wp_logout_url( get_permalink( ) ) . '" title="Logout">(<i class="icon-key"> </i> Logout)</a>'; seems to be inside a php line, so
    if you post a more complete code, I can try to reproduce the issue to help.
    Also, did you check plug version vs wordpress version?

    I solved some things coupling correct versions
    they are listed here

    sorry if I wrote things you already knew...

  5. iLucato
    Member
    Posted 1 year ago #

    Hi Marcello, I have latest versions 2.5.38 (qTranslate) and WP 3.8.

    here goes a bigger part of the code:

    if...

    } else
        {
            $nav_links = '<li class="logout">
            <a href="' . wp_logout_url( get_permalink( ) ) . '" title="Logout">(<i class="icon-key"> </i> Logout)</a>';
            $nav_links .= '<li class="license_area">
            ' . symbiostock_customer_area( $name ) . '
            </li>';
    
        }
    
        return $nav_links;
  6. parcodeisuoni
    Member
    Posted 1 year ago #

    Ok, I see..
    I think that if you want to keep this structure, you can try to close and open php tags and put your link content as straight html, otherwise inside a php string you may need to localize the text you want to translate with _e()

    so the first solution should be:

    } else
        {
            $nav_links = '<li class="logout">
            <a href="' . wp_logout_url( get_permalink( ) ) . '" title="Logout">'; ?>
    	(<i class="icon-key"> </i> <!--:en-->Logout<!--:--><!--:es-->Cerrar<!--:-->)
    	<?php '</a>';
            $nav_links = '<li class="license_area">
            ' . symbiostock_customer_area( $name ) . '
            </li>';
    
        }
    
        return $nav_links;

    ...not so sure if it's the right syntax for your context, otherwise with a localized unction could be:

    } else
        {
            $nav_links = '<li class="logout">
            <a href="' . wp_logout_url( get_permalink( ) ) . '" title="Logout">';
    	_e( '(<i class="icon-key"> </i> Logout)</a>', 'yourtextdomain' );
            $nav_links = '<li class="license_area">
            ' . symbiostock_customer_area( $name ) . '
            </li>';
    
        }
    
        return $nav_links;

    then to be translated with Poedit...
    but still I'm not sure it will work straight, you may check well all those parentesis within the rest of the template code.

    let me know if works either one of the two, or if you don't mind, put your template in a pastebin so I can play a little better with it.

  7. iLucato
    Member
    Posted 1 year ago #

    Hi Marcello, I got to solve it!
    Unfortunately not with your code, because the code you gave me was the same as I said 1st, that I had already tried to use [:en] or <!--:en--> on the code above, but it was printing on the screen the tags I used. ;0)

    Anyway, thanks for your try. Let me share with you and other readers the solution.

    PAY ATTENTION, VERY IMPORTANT TIP!

    To get to make your there understand the qtranslate quick-tags or regular tags [:en] or <!--:en--> within the input fields such as titles, texts and others codes in your theme back-end/front-end...

    ALWAYS use

    (__())

    Code Example

    from:
    <?php echo $hp->ss_cta_two_title ?>

    to:
    <?php echo (__($hp->ss_cta_two_title)) ?>

    Or in this thread case the solution was:

    } else
        {
            $nav_links = (__('<li class="logout">
            <a href="' . wp_logout_url( get_permalink( ) ) . '" title="Logout"> <i class="icon-signout"> </i><!--:pt-->Sair<!--:--><!--:en-->Logout<!--:--></a>'));
            $nav_links .= '<li class="license_area">
            ' . symbiostock_customer_area( $name ) . '
            </li>';
    
        }
    
        return $nav_links;

    Notice that right after the "$nav_links =" just opened the "(__(" and added the regular-tagswhere it should be (text) and closed "))" right after "< /a >'"

    I hope that can help others too.

    Have a great weekend and wishing you all and your family a Merry Christmas!

    All the best.
    Luis
    http://www.ilucato.com.br

  8. parcodeisuoni
    Member
    Posted 1 year ago #

    Hi Luis,
    thanks a lot for this, helps me a lot too!!
    I'm still so bad with syntax... :) I have to study harder!!

    I think if you mark this post as resolved anyhow will be easier for other to check it first,
    thanks again and best to you

    marcello

  9. iLucato
    Member
    Posted 1 year ago #

    You're welcome. We are always learning. I'm on the same boat or worst than tha, Im on a floating trunk with syntaxes and php codes. :0)

    Changed to Solved. ;0)

    A hug,
    Luis
    htt://www.ilucato.com.br

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • qTranslate
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic