0

I'd like to change some translatable text of a plugin I'm using, Buddypress Group Email Subscription. The text is: No Email (users will read this group on the web - good for any group - the default), and I want to change it to No Email (users will read this group on the web - good for any group), since it's not really default. Here's what I've done so far:

  • copied the .pot file to bp-ass-en_US.po (since all the other translations files for the plugin are in the form bp-ass-xx_XX.po).
  • edited the appropriate lines to read:

    #: bp-activity-subscription-functions.php:1087 msgid "" "No Email (users will read this group on the web - good for any group - the " "default)" msgstr "" "No Email (users will read this group on the web - good for any group)"

  • compiled the .po file into a .mo file (msgfmt -o bp-ass-en_US.mo bp-ass-en_US.po), and put them both, bp-ass-en_US.mo and bp-ass-en_US.po in /wp-content/languages.

  • I've also tried putting these files in /wp-content/languages/buddypress-group-email-subscription, and /wp-content/languages/bp-ass.

But the translation isn't taking. I still see the old text. I can't figure out what I'm doing wrong. I checked the .po file to make sure there wasn't a similar string elsewhere that I should be editing instead, but it's just that one.

For reference, here's the offending line in the plugin's code:

<?php _e( 'No Email (users will read this group on the web - good for any group - the default)', 'bp-ass' ) ?></label>

0

You are doing things correctly. Either the plugin is including its languages folder and text domain in a wrong way, or your locale is wrong.

Note: the following paragraph is outdated (written 4-5 years ago), so consider using Loco Translate instead of Codestyling Localization which was recommended before, as it is no longer maintained and might be a security threat to your site!

You can install Codestyling Localization plugin in order to check if the plugin is being localized as it should be, and if it doesn't give any warnings, then try forcing the locale of the site from Settings -> Language dropdown menu.

Update: Without plugins you can add the file in plugindir/languages/ as textdomain-xx_XX.mo and if you want it to remain translated after plugin update, add it in wp-content/languages/plugins/ with the same name of the file(s). wp-content/languages/themes/ is the directory for theme po & mo files.

Plugin and theme translations won't be loaded, if in wp-content/languages/!

  • I don't think I understand the relation between *.po and *.mo files in wp-content/languages, wp-content/languages/some-plugin, and wp-content/plugins/languages. It looks like the plugin is loading the textdomain from plugin_basename, but I don't know how wp-content/languages overrides that, or what the plugin should be doing to load languages from wp-content/languages. – Jonathan Jan 15 '15 at 18:08
  • I'm not sure that wp-content/languages overrides your plugin-specific language folder, but it's the place where WordPress will be looking for a .mo file if there is a lookup for a string of a text domain that can't be found in it's plugin language folder. Codestyling Localization Preserver is a nice addon to Codestyling Localization that copies your po and mo files to your wp-content/languages folder just to protect them from being lost after a plugin/theme update. I recommend using these two, instead of dealing with translations manually ;) – vlood Jan 15 '15 at 18:14
  • But why use two extra plugins when I can just put a file in a directory? The only problem is, I don't know which directory to put them in, wp-content/languages, wp-content/languages/bp-ass, wp-content/languages/buddypress-group-email-subscription, or some other directory. – Jonathan Jan 15 '15 at 18:19
  • Those plugins are not a thing you will keep all the time, but tools just like poedit that you probably use for compiling .mo. Each plugin defines where WordPress should look for it's .mo that should look like textdomain-xx_XX.mo. As you got some problem with that, which is plugin-specific, I suggest you try a tool that will point you out your plugin's right languages folder AND will point out if there is a problem with the plugin. I hate having useless plugins too, but those two help a lot while translating strings :) – vlood Jan 15 '15 at 18:58
  • 1
    Check loco translate instead of code styling localization. We changed to it years ago and it does a better job. – Pat_Morita Apr 28 at 16:12

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.