Changeset 11680
- Timestamp:
- 07/01/2009 08:05:14 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/l10n.php
r11640 r11680 302 302 303 303 /** 304 * Loads MO file into the list of domains.305 * 306 * If the domain already exists, the inclusion will fail. If the MO file is not307 * readable, the inclusion will fail.304 * Loads a MO file into the domain $domain. 305 * 306 * If the domain already exists, the translations will be merged. If both 307 * sets have the same string, the translation from the original value will be taken. 308 308 * 309 309 * On success, the .mo file will be placed in the $l10n global by $domain 310 * and will be a n gettext_readerobject.310 * and will be a MO object. 311 311 * 312 312 * @since 1.5.0 313 * @uses $l10n Gets list of domain translated string (gettext_reader) objects 314 * @uses CacheFileReader Reads the MO file 315 * @uses gettext_reader Allows for retrieving translated strings 313 * @uses $l10n Gets list of domain translated string objects 316 314 * 317 315 * @param string $domain Unique identifier for retrieving translated strings 318 316 * @param string $mofile Path to the .mo file 319 * @return null On failure returns null and also on success returns nothing.317 * @return bool true on success, false on failure 320 318 */ 321 319 function load_textdomain($domain, $mofile) { 322 320 global $l10n; 323 321 324 if ( !is_readable( $mofile)) return;322 if ( !is_readable( $mofile ) ) return false; 325 323 326 324 $mo = new MO(); 327 $mo->import_from_file( $mofile );328 329 if ( isset($l10n[$domain]))325 if ( !$mo->import_from_file( $mofile ) ) return false; 326 327 if ( isset( $l10n[$domain] ) ) 330 328 $mo->merge_with( $l10n[$domain] ); 331 329 332 330 $l10n[$domain] = &$mo; 331 return true; 333 332 } 334 333 … … 346 345 $mofile = WP_LANG_DIR . "/$locale.mo"; 347 346 348 load_textdomain('default', $mofile);347 return load_textdomain('default', $mofile); 349 348 } 350 349 … … 373 372 374 373 $mofile = $path . '/'. $domain . '-' . $locale . '.mo'; 375 load_textdomain($domain, $mofile);374 return load_textdomain($domain, $mofile); 376 375 } 377 376 … … 394 393 395 394 $mofile = "$path/$locale.mo"; 396 load_textdomain($domain, $mofile);395 return load_textdomain($domain, $mofile); 397 396 } 398 397
Note: See TracChangeset
for help on using the changeset viewer.