Skip to:

Opened 4 weeks ago

Closed 3 weeks ago

#9187 closed defect (bug) (fixed)

Custom BuddyPress translation files are no more loaded since WP 4.6

Reported by: imath's profile imath Owned by: imath's profile imath
Milestone: 14.0.0 Priority: strategic
Severity: major Version: 1.0
Component: Core Keywords: has-patch


Reviewing @vapvarun's PR about documenting how to use custom labels (etc..) made me remember we lost this very important feature for our plugin when WP's _load_textdomain_just_in_time() function was introduced in version 4.6. I remember I was a bit mad at it!

FWIW, here's the ticket I opened about it 8 years ago.

We need something approaching back: it's a very important way to customize BuddyPress even for en_US communities.

Change History (7)

This ticket was mentioned in PR #316 on buddypress/buddypress by imath.

4 weeks ago

  • Keywords has-patch added; needs-patch removed

Use the 'load_translation_file' filter to check custom file locations for the buddypress text domain.

NB: this filter was introduced by WordPress in version 6.5.

If there's a (where xx_XX is the locale code) file into one of the following directories, it will be used to replace the default one ( Plugin Directory / GlotPress):

  1. /wp-content/languages/plugins/buddypress (added in 14.0.0)
  2. /wp-content/languages/buddypress
  3. /wp-content/languages

Trac ticket:

imath commented on PR #316:

3 weeks ago

FYI, I've also added a function to override default JavaScript translation files used in BP Blocks.

#3 @imath
3 weeks ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 13936:

i18n: bring back custom locations for translation files

Prior to WordPress 4.6, it was possible to completely override the translation file with a custom one from one of the 'buddypress_locale_locations' filterable list items.

With WordPress 6.5 latest improvements about l10n, we are now able to bring these back. Making it easier for users to customize every BuddyPress strings should help them build match their community needs (e.g.: using sport/school/working/any other wording).

3 functions has been introduced:

  • bp_get_custom_translation_file() is looking for a file name into 'buddypress_locale_locations' filterable list items.
  • bp_load_custom_translation_file() is the 'load_translation_file' filter callback for regular translation files.
  • bp_load_custom_script_translation_file() is the 'load_script_translation_file' filter callback for JavaScript translation files.

The bp_core_load_buddypress_textdomain() function has been deprecated as it was pretty useless since WordPress 4.6.

Props espellcaste

Fixes #9187

#4 @imath
3 weeks ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

#5 @imath
3 weeks ago

We actually need to keep bp_core_load_buddypress_textdomain() so that it's possible to use a custom en_US translation file to customize BuddyPress texts to match specific community needs.

This ticket was mentioned in PR #322 on buddypress/buddypress by imath.

3 weeks ago

If we don't need bp_core_load_buddypress_textdomain() for the regular translation usage, when an advanced user is using a custom en_US language file for BuddyPress, we absolutely need it to load this specific file.

Trac ticket:

#7 @imath
3 weeks ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 13941:

Make sure default en_US BuddyPress strings can be override

Restore bp_core_load_buddypress_textdomain() so that it's possible to customize all BuddyPress default strings with a custom translation file.

Fixes #9187

Note: See TracTickets for help on using tickets.