0

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?

1 Answer 1

1

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' ) );

1
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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