Plugin translation not being displayed

admin2025-01-07  3

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>

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>

Share Improve this question edited Jun 4, 2019 at 12:57 leymannx 3,2213 gold badges29 silver badges35 bronze badges asked Jan 15, 2015 at 15:09 JonathanJonathan 4296 silver badges18 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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/!

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736252853a78.html

最新回复(0)