Posted: November 4, 2019 at 8:17 am
|
Hello, 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/event_espresso-ro_RO.mo. 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/event_espresso-ro_RO.mo, 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). |
Hi there,
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? |
|
|
Hi, Tony, I understand. I can send you the code; just point me to the right email address / contact form. |
You can use support[at]eventespresso.com |
|
|
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. |
|
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?
|
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]eventespresso.com user. |
|
|
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.