can’t understand _e function well

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

Related posts

Leave a Reply

1 comment

  1. $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');