Skip to:
Content

BuddyPress.org

Ticket #5887: 5887-multiple-locations.02.patch

File 5887-multiple-locations.02.patch, 1.6 KB (added by imath, 10 years ago)
  • src/bp-core/bp-core-functions.php

    diff --git src/bp-core/bp-core-functions.php src/bp-core/bp-core-functions.php
    index 547a5d5..f1ddc60 100644
    function bp_is_get_request() { 
    17461746 * @return bool True on success, false on failure.
    17471747 */
    17481748function bp_core_load_buddypress_textdomain() {
    1749         // Try to load via load_plugin_textdomain() first, for future
    1750         // wordpress.org translation downloads
    1751         if ( load_plugin_textdomain( 'buddypress', false, 'buddypress/bp-languages' ) ) {
    1752                 return true;
    1753         }
    1754 
    1755         // Nothing found in bp-languages, so try to load from WP_LANG_DIR
    1756         $locale = apply_filters( 'buddypress_locale', get_locale() );
    1757         $mofile = WP_LANG_DIR . '/buddypress-' . $locale . '.mo';
     1749        $domain = 'buddypress';
     1750        $mofile_custom = sprintf( '%s-%s.mo', $domain, apply_filters( 'buddypress_locale', get_locale() ) );
     1751
     1752        $locations = apply_filters( 'buddypress_locale_locations', array(
     1753                trailingslashit( WP_LANG_DIR ),
     1754                trailingslashit( WP_LANG_DIR . '/' . $domain  ),
     1755        ) );
     1756
     1757        // Try custom locations in WP_LANG_DIR
     1758        foreach ( $locations as $location ) {
     1759                if ( load_textdomain( 'buddypress', $location . $mofile_custom ) ) {
     1760                        return true;
     1761                }
     1762        }
    17581763
    1759         return load_textdomain( 'buddypress', $mofile );
     1764        // default to WP and glotpress
     1765        return load_plugin_textdomain( $domain );;
    17601766}
    17611767add_action ( 'bp_core_loaded', 'bp_core_load_buddypress_textdomain' );
    17621768
    function bp_core_get_suggestions( $args ) { 
    20802086        }
    20812087
    20822088        return apply_filters( 'bp_core_get_suggestions', $retval, $args );
    2083 }
    2084  No newline at end of file
     2089}