Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/23/2013 01:17:11 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Revert r7097. Will reopen #4857 and leave detailed feedback asap.

File:
1 edited

Legend:

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

    r7097 r7099  
    12681268 */
    12691269function bp_core_load_buddypress_textdomain() {
    1270     $locale      = apply_filters( 'buddypress_locale', get_locale() );
    1271     $mofile      = sprintf( 'buddypress-%s.mo', $locale );
    1272     $uploads_dir = wp_upload_dir();
    1273 
    1274     $translation_paths = array(
    1275         WP_LANG_DIR . "/{$mofile}",
    1276         BP_PLUGIN_DIR . "bp-languages/{$mofile}",
    1277         $uploads_dir['basedir'] . "/buddypress/{$mofile}",
    1278     );
    1279 
    1280     foreach ( $translation_paths as $path )
    1281         load_textdomain( 'buddypress', $path );
    1282 }
    1283 add_action( 'bp_core_loaded', 'bp_core_load_buddypress_textdomain' );
     1270    $locale        = apply_filters( 'buddypress_locale', get_locale() );
     1271    $mofile        = sprintf( 'buddypress-%s.mo', $locale );
     1272    $mofile_global = WP_LANG_DIR . '/' . $mofile;
     1273    $mofile_local  = BP_PLUGIN_DIR . 'bp-languages/' . $mofile;
     1274
     1275    if ( file_exists( $mofile_global ) )
     1276        return load_textdomain( 'buddypress', $mofile_global );
     1277    elseif ( file_exists( $mofile_local ) )
     1278        return load_textdomain( 'buddypress', $mofile_local );
     1279    else
     1280        return false;
     1281}
     1282add_action ( 'bp_core_loaded', 'bp_core_load_buddypress_textdomain' );
    12841283
    12851284/**
     
    13621361}
    13631362add_action( 'wp_footer', 'bp_core_print_generation_time' );
    1364 
    1365 /**
    1366  * Find out if there's a newer translation available for this site on translate.wordpress.org
    1367  *
    1368  * @since BuddyPress (1.8)
    1369  */
    1370 function bp_core_check_for_updated_translation() {
    1371     require( buddypress()->plugin_dir  . 'bp-core/admin/bp-core-translations.php' );
    1372 
    1373     $locale = BP_Translate::get_locale();
    1374     if ( 'en_US' === $locale )
    1375         return;
    1376 
    1377     // No point checking if we know there's an updated translation
    1378     if ( bp_is_translation_update_pending() )
    1379         return;
    1380 
    1381     $locale = BP_Translate::get_glotpress_locale();
    1382     if ( ! $locale )
    1383         return;
    1384 
    1385     $url  = 'https://translate.wordpress.org/projects/buddypress/%1$s/%2$s/default/export-translations?format=mo';
    1386     $args = bp_get_translation_version() ? array( 'headers' => 'If-Modified-Since: ' . gmdate( 'D, d M Y H:i:s', bp_get_translation_version() ) . ' GMT' ) : array();
    1387 
    1388     // Check version of translation on translate.wordpress.org
    1389     $response = wp_remote_head( sprintf( $url, buddypress()->glotpress_version, $locale ), $args );
    1390     if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 304 || wp_remote_retrieve_response_code( $response ) !== 200 )
    1391         return;
    1392 
    1393     // An updated translation is available
    1394     bp_update_option( '_bp_translation_pending', true );
    1395 }
    1396 add_action( 'bp_translate_update_check', 'bp_core_check_for_updated_translation' );
Note: See TracChangeset for help on using the changeset viewer.