How does translation (gettext) work for translating config file of plugin?

I am doing translation of my plugin. I am using __ _e in php files. But can't figure out how to do same for config file that contains constants added using define(name, value)? Does it automatically get translated using Wordpress translation dictionary once plugin adds code for loading text-domain? Also, Do I need to use add text domain compulsorily or will Wordpress's translator will translate it even then?

Topic xgettext translation plugin-development plugins Wordpress

Category Web


WordPress doesn't automatically translate anything, you need to use the __ and _e functions, even in your config file, if you want it to be translateable.

define( 'CONSTANT', __( 'some string', 'textdomain' ) );

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.