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?
Add a comment
|
1 Answer
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' ) );
-
Hey Jacob, The 'string-name' is available for translation and I have uploaded the mo files in desired language including this string but in the wordpress it still reflects as English String. Translation is working for all other strings except the one defined as constants in my config file. Any idea why is this happening? Commented Aug 18, 2017 at 7:45