1
<?php _e( $text, $domain ) ?>

$domain

(string) (optional) Domain to retrieve the translated text Default: 'default

can't understand the second argument well. when i custom a theme, where the $domain's value shows on the theme, what value should i give it to.? could i write the $domain part optionally?i see some themes using its theme name as the $domain. but the document says Domain to retrieve the translated text.it's not a domain. why? some using other strings which doesn't have any relevance of the theme?

1 Answer 1

2

$domain is the unique identifier for retrieving translated strings.

It is set in functions.php

<?php load_theme_textdomain( $domain, $path ) ?>

ex:

load_theme_textdomain('my_theme', get_template_directory() . '/languages');

<?php _e( 'Translate this text', 'my_theme' ) ?>

If you don't have a translation file but want't to make it translatable just define the textdomain.

load_theme_textdomain('my_theme');

2
  • if i don't have the languages file. how do i do?
    – enjoylife
    Commented May 31, 2011 at 0:34
  • it is not absolutely necessary to have a languages file, for example the translation plugin WPML can also translate the strings within the Dashboard, without the need for a .mo file.
    – user2015
    Commented May 31, 2011 at 1:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.