0

I'm trying to change an English text string in a plugin that has the following structure:

├── language
│   ├── albdesign-wc-donations-sq.mo
│   ├── albdesign-wc-donations-sq.po
│   └── default.pot
└── woocommerce_donations_on_cart.php

I'm using only English on the website I installed the plugin, so I could also just edit the English text strings in woocommerce_donations_on_cart.php, but I would prefer a solution that is update-safe.

I read about putting translations in wp-content/languages/plugins/ with the same name of the file(s), but as there are no English .mo/.po files that would probably not work.

So I used the code styling project plugin to create an empty albdesign-wc-donations-en_US.po and added my custom translation like so

msgid "Add a donation to your order"
msgstr "Add a donation"

but that doesn't do the trick.

1

to use the file wp-content/languages/plugins/albdesign-wc-donations-uu_UU.mo in the plugin, it has to be declared like that :

load_plugin_textdomain("albdesign-wc-donations"); // search in wp-content/languages/plugins/
// search in the plugin files if not found in wp-content/languages/plugins/
load_plugin_textdomain("albdesign-wc-donations", FALSE, plugin_dir_path(__FILE__) . "languages/");

is it's not the case, you can create another plugin to correct that loading of the translations files

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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