I'm learning from a plugin development course, and encountered two different internationalization functions:

<?php __('Newsletter Subscriber', 'ns_domain'); ?>


<?php _e('Title:'); ?>

I cannot find any reference information on when to use each one of these.

Can you point me in the right direction to learn more about these please?

  • Just for the record, I edited the question replacing 'localization' with 'internationalization'. These are also abbreviated l10n and i18n respectively. Per the docs I linked in my answer "Localization describes the subsequent process of translating an internationalized plugin." Searching for internationalization would have yielded better results but localization and internationalization are easily mixed up. – Dave Romsey Nov 29 '16 at 3:36

__() "Retrieves the translated string from the translate() function" without echoing. _e() does the same thing but echos the output.

For more information, take a look at these help articles:


It is probably good to know. The foundation of the internalization is the translate function

File: wp-includes/l10n.php
78: /**
79:  * Retrieve the translation of $text.
80:  *
81:  * If there is no translation, or the text domain isn't loaded, the original text is returned.
82:  *
83:  * *Note:* Don't use translate() directly, use __() or related functions.
84:  *
85:  * @since 2.2.0
86:  *
87:  * @param string $text   Text to translate.
88:  * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
89:  *                       Default 'default'.
90:  * @return string Translated text
91:  */
92: function translate( $text, $domain = 'default' ) {

Anytime you call any of the wrappers

172: function __( $text, $domain = 'default' ) {
173:    return translate( $text, $domain );
174: }


File: wp-includes/l10n.php
188: function esc_attr__( $text, $domain = 'default' ) {
189:    return esc_attr( translate( $text, $domain ) );
190: }


File: wp-includes/l10n.php
217: function _e( $text, $domain = 'default' ) {
218:    echo translate( $text, $domain );
219: }

or many other from wp-includes/l10n.php, this function will be called. But you never call this function directly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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