In this function,the “$domain” is used to locate the multilingual file.(The file which is the translation of your theme.)
In wp-include there is a function related to this var
function load_theme_textdomain( $domain, $path = false ) {
$locale = apply_filters( 'theme_locale', get_locale(), $domain );
if ( ! $path )
$path = get_template_directory();
// Load the textdomain from the Theme provided location, or theme directory first
$mofile = "{$path}/{$locale}.mo";
if ( $loaded = load_textdomain($domain, $mofile) )
return $loaded;
// Else, load textdomain from the Language directory
$mofile = WP_LANG_DIR . "/themes/{$domain}-{$locale}.mo";
return load_textdomain($domain, $mofile);
}
You can see $domain is used in this file.Actually it’s used to locate the .mo file.So you must may sure it share the same name with your theme folder name
Basic Example
Display some translated text:
The WordPress documentation states that you should not use
but use
instead.
In this function,the “$domain” is used to locate the multilingual file.(The file which is the translation of your theme.)
In wp-include there is a function related to this var
You can see $domain is used in this file.Actually it’s used to locate the .mo file.So you must may sure it share the same name with your theme folder name
This function is same as
echo __like:Important security note:
_e()is not an escaping function. Since all output really needs to be escaped, consider using__()instead.For example, this is safe:
echo esc_html( __( 'This is my translatable text' ) )But this might not be, because the output can get filtered and is not escaped close to where it is output:
_e( 'This is my translatable text' )esc_html_einstead of_eUse escaping functions instead,
which is the equivalent of,