• 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. ?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter dczepiel

    (@dczepiel)

    anyone ?

    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.

    Thread Starter dczepiel

    (@dczepiel)

    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 !

    I’ve never seen translation used in that way.

    Are you using the POT and MO files?

    The whole point of the __() and putting text in it is to tell wordpress that string should be translated. It then looks into the MO files for the alternative doesnt it?

    If your way works then great but it looks like far too much work.

    WebTechGlobal

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: qTranslate] How to add php translation code into another php function’ is closed to new replies.