Skip to:
Content

BuddyPress.org

Ticket #5887: 5887.bp_folder_language_file.patch

File 5887.bp_folder_language_file.patch, 1.5 KB (added by imath, 10 years ago)
  • src/bp-core/bp-core-functions.php

    diff --git a/src/bp-core/bp-core-functions.php b/src/bp-core/bp-core-functions.php
    index 5b93f9c..be23500 100644
    a b function bp_is_get_request() { 
    17001700 * @return bool True on success, false on failure.
    17011701 */
    17021702function bp_core_load_buddypress_textdomain() {
    1703         // Try to load via load_plugin_textdomain() first, for future
    1704         // wordpress.org translation downloads
    1705         if ( load_plugin_textdomain( 'buddypress', false, 'buddypress/bp-languages' ) ) {
    1706                 return true;
    1707         }
     1703        $domain = 'buddypress';
     1704        $mofile_custom = trailingslashit( WP_LANG_DIR . '/' . $domain  ) . sprintf( '%s-%s.mo', $domain, apply_filters( 'buddypress_locale', get_locale() ) );
    17081705
    1709         // Nothing found in bp-languages, so try to load from WP_LANG_DIR
    1710         $locale = apply_filters( 'buddypress_locale', get_locale() );
    1711         $mofile = WP_LANG_DIR . '/buddypress-' . $locale . '.mo';
     1706        // load custom language file if available
     1707        // custom language files reside in WP_LANG_DIR/buddypress
     1708        if ( is_readable( $mofile_custom ) ) {
     1709                load_textdomain( $domain, $mofile_custom );
    17121710
    1713         return load_textdomain( 'buddypress', $mofile );
     1711        // default to WP and glotpress
     1712        } else {
     1713                load_plugin_textdomain( $domain );
     1714        }
    17141715}
    17151716add_action ( 'bp_core_loaded', 'bp_core_load_buddypress_textdomain' );
    17161717
    function bp_core_get_suggestions( $args ) { 
    20342035        }
    20352036
    20362037        return apply_filters( 'bp_core_get_suggestions', $retval, $args );
    2037 }
    2038  No newline at end of file
     2038}