Home Forums Translations Translating event_espresso text domain from custom payment folder

Translating event_espresso text domain from custom payment folder

Posted: November 4, 2019 at 8:17 am


November 4, 2019 at 8:17 am


I have developed a custom payment gateway which references text from event_espresso text domain, for example: $payment->set_gateway_response( __( ‘Payment Failed’, ‘event_espresso’ ) );

I’ve also prepared translation file as wp-content/plugins/netopia-mobilpay/languages/

Despite this, the translation does not get picked up and either there is no translation or, if one is available in wp-content/uploads/espresso/languages/, that one is picked up.

Is there any way of having my plugin translation file be used? If not, how I see it I need to rename the text domain from event_espresso to my custom plugin name (it is not enough if I translate the texts in the official EE translation site as some custom plugin strings appear only for my plugin and are not part of EE).
Thank you.


  • Support Staff

November 6, 2019 at 6:52 am

Hi there,

Is there any way of having my plugin translation file be used?

You can’t have 2 plugins using the same text_domain and different .MO files.

Text domains are essentially pointers to MO files, when you try to use the same text domain with 2 different files, you basically overwrite the filename of one with the other.

I think you’ll need to use your own text domain for your strings and likely your own call to load_textdomain to load the correct mo file.

Is your code publicly accessible somewhere where I can take a look?


November 6, 2019 at 12:29 pm

Hi, Tony,

I understand. I can send you the code; just point me to the right email address / contact form.


  • Support Staff

November 7, 2019 at 4:32 am

You can use support[at]


November 7, 2019 at 5:44 am

Hi, Tony,

I’ve just sent you the files. Is there anything else that I need to do besides replacing the text domain? Functional wise, the payment gateway has been tested ok.
Thank you.


November 8, 2019 at 1:11 am

Hello again,

I’ve managed to activate my custom text domain by setting below code in the payment gateway class file. Is the code ok from your point of view? Do I need to do anything else?

Class  EE_Netopia_Mobilpay extends EE_Addon {

	 * class constructor
	public function __construct()
		add_action( 'plugins_loaded', array( __CLASS__, 'netopia_mobilpay_load_plugin_textdomain'));
	public static function netopia_mobilpay_load_plugin_textdomain()
		load_plugin_textdomain( 'netopia-mobilpay', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );


  • Support Staff

November 8, 2019 at 5:09 am

The above looks fine to me and I don’t think you’ll need anything else.

You’ll now be loading your own translations so they should work throughout your plugin.

I tried to take a look over your code however you’ll need to make it public as its limited to the support[at] user.


November 8, 2019 at 8:35 am

Email resent without confidentiality feature of Gmail. Thanks.

The support post ‘Translating event_espresso text domain from custom payment folder’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso