Skip to:
Content

BuddyPress.org

Changeset 7204


Ignore:
Timestamp:
06/12/2013 09:49:54 PM (11 years ago)
Author:
boonebgorges
Message:

Attempt to use load_plugin_textdomain() before loading translations from WP_LANG_DIR

This will ensure compatibility with future support for automatic translation
downloads on wordpress.org/extend, while continuing to allow translations to be
stored in wp-content/languages/.

Fixes #5030

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-functions.php

    r7104 r7204  
    13171317 */
    13181318function bp_core_load_buddypress_textdomain() {
    1319     $locale        = apply_filters( 'buddypress_locale', get_locale() );
    1320     $mofile        = sprintf( 'buddypress-%s.mo', $locale );
    1321     $mofile_global = WP_LANG_DIR . '/' . $mofile;
    1322     $mofile_local  = BP_PLUGIN_DIR . 'bp-languages/' . $mofile;
    1323 
    1324     if ( file_exists( $mofile_global ) )
    1325         return load_textdomain( 'buddypress', $mofile_global );
    1326     elseif ( file_exists( $mofile_local ) )
    1327         return load_textdomain( 'buddypress', $mofile_local );
    1328     else
    1329         return false;
     1319    // Try to load via load_plugin_textdomain() first, for future
     1320    // wordpress.org translation downloads
     1321    if ( load_plugin_textdomain( 'buddypress', false, 'buddypress/bp-languages' ) ) {
     1322        return true;
     1323    }
     1324
     1325    // Nothing found in bp-languages, so try to load from WP_LANG_DIR
     1326    $locale = apply_filters( 'buddypress_locale', get_locale() );
     1327    $mofile = WP_LANG_DIR . '/buddypress-' . $locale . '.mo';
     1328
     1329    return load_textdomain( 'buddypress', $mofile );
    13301330}
    13311331add_action ( 'bp_core_loaded', 'bp_core_load_buddypress_textdomain' );
Note: See TracChangeset for help on using the changeset viewer.