WordPress.org

Make WordPress Core

Ticket #10527: 10527.patch

File 10527.patch, 1.8 KB (added by hakre, 9 years ago)
  • wp-includes/l10n.php

     
    314314 *
    315315 * @param string $domain Unique identifier for retrieving translated strings
    316316 * @param string $mofile Path to the .mo file
     317 * @param bool   $merge (optional) flag wether or not to merge the .mo file with an textdomain in nemory. default is false.
    317318 * @return bool true on success, false on failure
    318319 */
    319 function load_textdomain($domain, $mofile) {
     320function load_textdomain($domain, $mofile, $merge = false) {
    320321        global $l10n;
    321322
    322323        if ( !is_readable( $mofile ) ) return false;
     324       
     325        if ( isset( $l10n[$domain] ) && false == $merge )
     326                return true;
    323327
    324328        $mo = new MO();
    325329        if ( !$mo->import_from_file( $mofile ) ) return false;
     
    359363 * @param string $abs_rel_path Optional. Relative path to ABSPATH of a folder,
    360364 *      where the .mo file resides. Deprecated, but still functional until 2.7
    361365 * @param string $plugin_rel_path Optional. Relative path to WP_PLUGIN_DIR. This is the preferred argument to use. It takes precendence over $abs_rel_path
     366 * @param bool   $merge (optional) flag wether or not to merge the .mo file with an textdomain in nemory. default is false.
     367 * @return bool  true on success, false on failure 
    362368 */
    363 function load_plugin_textdomain($domain, $abs_rel_path = false, $plugin_rel_path = false) {
     369function load_plugin_textdomain($domain, $abs_rel_path = false, $plugin_rel_path = false, $merge = false) {
    364370        $locale = get_locale();
    365371
    366372        if ( false !== $plugin_rel_path )
     
    371377                $path = WP_PLUGIN_DIR;
    372378
    373379        $mofile = $path . '/'. $domain . '-' . $locale . '.mo';
    374         return load_textdomain($domain, $mofile);
     380        return load_textdomain($domain, $mofile, $merge);
    375381}
    376382
    377383/**