Changeset 13330
- Timestamp:
- 02/23/2010 11:14:35 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/l10n.php
r13304 r13330 316 316 317 317 /** 318 * Unloads translations for a domain 319 * 320 * @since 3.0.0 321 * @param string $domain Textdomain to be unloaded 322 * @return bool Whether textdomain was unloaded 323 */ 324 function unload_textdomain( $domain ) { 325 global $l10n; 326 327 $plugin_override = apply_filters( 'override_unload_textdomain', false, $domain ); 328 329 if ( $plugin_override ) 330 return true; 331 332 do_action( 'unload_textdomain', $domain ); 333 334 if ( isset( $l10n[$domain] ) ) { 335 unset( $l10n[$domain] ); 336 return true; 337 } 338 339 return false; 340 } 341 342 /** 318 343 * Loads default translated strings based on locale. 319 344 * … … 345 370 */ 346 371 function load_plugin_textdomain( $domain, $abs_rel_path = false, $plugin_rel_path = false ) { 347 $locale = get_locale();372 $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); 348 373 349 374 if ( false !== $plugin_rel_path ) { … … 367 392 * @param string $domain Unique identifier for retrieving translated strings 368 393 */ 369 function load_muplugin_textdomain($domain, $path = false) { 370 $locale = get_locale(); 371 if ( empty($locale) ) 372 $locale = 'en_US'; 373 374 /* @todo $path is not used. Was it ever used and was it expected to be an arbitrary absolute dir? 375 * Ideally, it should be relative to WPMU_PLUGIN_DUR. 376 if ( false === $path ) 377 $path = WPMU_PLUGIN_DIR; 378 */ 394 function load_muplugin_textdomain( $domain, $path = false ) { 395 $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); 379 396 380 397 $mofile = WPMU_PLUGIN_DIR . "/$domain-$locale.mo"; 381 load_textdomain( $domain, $mofile);398 load_textdomain( $domain, $mofile ); 382 399 } 383 400 … … 394 411 * @param string $domain Unique identifier for retrieving translated strings 395 412 */ 396 function load_theme_textdomain( $domain, $path = false) {397 $locale = get_locale();413 function load_theme_textdomain( $domain, $path = false ) { 414 $locale = apply_filters( 'theme_locale', get_locale(), $domain ); 398 415 399 416 $path = ( empty( $path ) ) ? get_template_directory() : $path; … … 415 432 * @param string $domain Unique identifier for retrieving translated strings 416 433 */ 417 function load_child_theme_textdomain( $domain, $path = false) {418 $locale = get_locale();419 420 421 422 423 434 function load_child_theme_textdomain( $domain, $path = false ) { 435 $locale = apply_filters( 'theme_locale', get_locale(), $domain ); 436 437 $path = ( empty( $path ) ) ? get_stylesheet_directory() : $path; 438 439 $mofile = "$path/$locale.mo"; 440 return load_textdomain($domain, $mofile); 424 441 } 425 442
Note: See TracChangeset
for help on using the changeset viewer.