如何在php函数中使用_e()?

<?php _e( 'text', 'textdomain'); ?> is used to translate text in themes and plugins. But what if i have a php function that defines text as a variable:

$textoutput = 'blablabla';

In another document the variable is echoed:

echo $textoutput;

How to translate the 'blablabla' text? $textoutput = _e( 'blablabla', 'textdomain'); doesnt work.

Thank you.

_e( 'blablabla', 'textdomain'); is used for echoing to the browser, not for assignment to a variable.

If you wish to assign it to a variable you need to use a different function which is $variable = __( 'blablabla', 'textdomain')

that means these code lines of code do the same thing

_e( 'blablabla', 'textdomain');
echo __( 'blablabla', 'textdomain');
$variable = __( 'blablabla', 'textdomain');
echo $variable;

More information on wordpress i18n can be found in the documentation