Forums

[Plugin: qTranslate] How to add php translation code into another php function (4 posts)

  1. dczepiel
    Member
    Posted 3 weeks ago #

    Hello,

    I know nothing about php.
    I tried to qTranslate all I could in my php files using the php function provided in FAQ - <?php _e("<!--:en-->english text<!--:--><!--:de-->german text<!--:-->"); ?>
    The problem is when I need to translate something that is already inside a php function like below:

    <?php comments_number('No Responses', 'One Response', '% Responses' );?>

    Is there a way to translate those 'No responses', 'One Response' etc. ?

  2. dczepiel
    Member
    Posted 3 weeks ago #

    anyone ?

  3. nouveller
    Member
    Posted 3 weeks ago #

    How about...

    <?php 
    
    	$no_responses = __("<!--:en-->english text<!--:--><!--:de-->german text<!--:-->");
    
    	$one_response = __("<!--:en-->english text<!--:--><!--:de-->german text<!--:-->");
    
    	$responses = __("<!--:en-->english text<!--:--><!--:de-->german text<!--:-->");
    
    	comments_number($no_responses, $one_response, '% $responses' );
    
    ?>

    I think __() returns the value where as _e( echoes it.

  4. dczepiel
    Member
    Posted 3 weeks ago #

    this looks pretty hard and I am not sure if that was the solution I was looking for but I will give it a try.

    I hoped there is a way to just insert the <!--:en-->english text<!--:--><!--:de-->german text<!--:--> part into an existing php function to make it work and be translated.

    But thanks !

Reply

You must log in to post.

About this Topic