When you use the WordPress translation functions to make your plugin or theme translatable, you pass in a text domain as a second parameter, like so:
<?php _e( 'Some Text String', 'my-plugin-name' ); ?>
This text domain is just a unique string (usually your plugin’s WordPress.org repository slug). Well, many plugin developers see code like this:
<?php _e( 'Another Text String', 'my-plugin-name' ); ?> <?php _e( 'Yet Another Text String', 'my-plugin-name' ); ?> <?php _e( 'Gosh, So Many Text Strings!', 'my-plugin-name' ); ?>
And they think to themselves “hm, I sure am typing the
'my-plugin-name' string a lot. I’ll apply the DRY (Don’t Repeat Yourself) principle and throw that string into a variable or a constant!”
Stop! You’re being too clever! That won’t work!*
See, PHP isn’t the only thing that needs to parse out your translatable strings. GNU gettext also needs to parse out the strings in order to provide your blank translation file to your translators. GNU gettext is not a PHP parser. It can’t read variables or constants. It only reads strings. So your text domain strings needs to stay hardcoded as actual quoted strings.
* Well, it won’t break your plugin, but it could make it harder to be used with automated translation tools. And trust me, you don’t want to be manually managing your translation files… we have a better solution coming.