Search code examples
qtranslate

qTranslate and Wordpress functions


I'm using qTranslate on a Wordpress site but am having a little trouble working some bits of it into the Wordpress functions in some cases. For example, when I want to include a "Read More link" within a query, I can just do:

echo _e('[:en]Read More_[:ru]читать далее_');

(that said, it looks like it's echoing an echo, so I may not be doing that right, even though it seems to work).

But I can't quite work out the syntax for this:

echo comments_number( '<div class="noComment"></div>No Comments', '<div class="oneComment"></div>One Comment', '<div class="oneComment"></div>% Comments' );

How do I put in the translation for those?


Solution

  • try this:

    echo comments_number(
        qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage('<div class="noComment"></div>[:en]No Comments[:es]No comentarios'), 
        qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage('<div class="oneComment"></div>[:en]One Comment[:es]Uno comentario'), 
        qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage('<div class="oneComment"></div>[:en]% Comments[:es]% comentarios)' 
    );