diff --git src/wp-includes/l10n.php src/wp-includes/l10n.php
index 6a88fbb..878619a 100644
|
|
|
function load_default_textdomain( $locale = null ) { |
| 655 | 655 | * The .mo file should be named based on the text domain with a dash, and then the locale exactly. |
| 656 | 656 | * |
| 657 | 657 | * @since 1.5.0 |
| | 658 | * @since 4.6.0 The function now tries to load the .mo file from the languages directory first. |
| 658 | 659 | * |
| 659 | 660 | * @param string $domain Unique identifier for retrieving translated strings |
| 660 | 661 | * @param string $deprecated Use the $plugin_rel_path parameter instead. |
| … |
… |
function load_default_textdomain( $locale = null ) { |
| 663 | 664 | * @return bool True when textdomain is successfully loaded, false otherwise. |
| 664 | 665 | */ |
| 665 | 666 | function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path = false ) { |
| 666 | | $locale = get_locale(); |
| 667 | 667 | /** |
| 668 | 668 | * Filter a plugin's locale. |
| 669 | 669 | * |
| … |
… |
function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path |
| 672 | 672 | * @param string $locale The plugin's current locale. |
| 673 | 673 | * @param string $domain Text domain. Unique identifier for retrieving translated strings. |
| 674 | 674 | */ |
| 675 | | $locale = apply_filters( 'plugin_locale', $locale, $domain ); |
| | 675 | $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); |
| | 676 | |
| | 677 | $mofile = $domain . '-' . $locale . '.mo'; |
| | 678 | |
| | 679 | // Try to load from the languages directory first. |
| | 680 | if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile ) ) { |
| | 681 | return true; |
| | 682 | } |
| 676 | 683 | |
| 677 | | if ( false !== $plugin_rel_path ) { |
| | 684 | if ( false !== $plugin_rel_path ) { |
| 678 | 685 | $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' ); |
| 679 | 686 | } elseif ( false !== $deprecated ) { |
| 680 | 687 | _deprecated_argument( __FUNCTION__, '2.7' ); |
| … |
… |
function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path |
| 683 | 690 | $path = WP_PLUGIN_DIR; |
| 684 | 691 | } |
| 685 | 692 | |
| 686 | | // Load the textdomain according to the plugin first |
| 687 | | $mofile = $domain . '-' . $locale . '.mo'; |
| 688 | | if ( $loaded = load_textdomain( $domain, $path . '/'. $mofile ) ) |
| 689 | | return $loaded; |
| 690 | | |
| 691 | | // Otherwise, load from the languages directory |
| 692 | | $mofile = WP_LANG_DIR . '/plugins/' . $mofile; |
| 693 | | return load_textdomain( $domain, $mofile ); |
| | 693 | return load_textdomain( $domain, $path . '/' . $mofile ); |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | 696 | /** |
| 697 | 697 | * Load the translated strings for a plugin residing in the mu-plugins directory. |
| 698 | 698 | * |
| 699 | 699 | * @since 3.0.0 |
| | 700 | * @since 4.6.0 The function now tries to load the .mo file from the languages directory first. |
| 700 | 701 | * |
| 701 | 702 | * @param string $domain Text domain. Unique identifier for retrieving translated strings. |
| 702 | 703 | * @param string $mu_plugin_rel_path Relative to WPMU_PLUGIN_DIR directory in which the .mo file resides. |
| … |
… |
function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path |
| 706 | 707 | function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) { |
| 707 | 708 | /** This filter is documented in wp-includes/l10n.php */ |
| 708 | 709 | $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); |
| 709 | | $path = trailingslashit( WPMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' ) ); |
| 710 | 710 | |
| 711 | | // Load the textdomain according to the plugin first |
| 712 | 711 | $mofile = $domain . '-' . $locale . '.mo'; |
| 713 | | if ( $loaded = load_textdomain( $domain, $path . $mofile ) ) |
| 714 | | return $loaded; |
| 715 | 712 | |
| 716 | | // Otherwise, load from the languages directory |
| 717 | | $mofile = WP_LANG_DIR . '/plugins/' . $mofile; |
| 718 | | return load_textdomain( $domain, $mofile ); |
| | 713 | // Try to load from the languages directory first. |
| | 714 | if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile ) ) { |
| | 715 | return true; |
| | 716 | } |
| | 717 | |
| | 718 | $path = trailingslashit( WPMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' ) ); |
| | 719 | |
| | 720 | return load_textdomain( $domain, $path . '/' . $mofile ); |
| 719 | 721 | } |
| 720 | 722 | |
| 721 | 723 | /** |
| … |
… |
function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) { |
| 727 | 729 | * The .mo files must be named based on the locale exactly. |
| 728 | 730 | * |
| 729 | 731 | * @since 1.5.0 |
| | 732 | * @since 4.6.0 The function now tries to load the .mo file from the languages directory first. |
| 730 | 733 | * |
| 731 | 734 | * @param string $domain Text domain. Unique identifier for retrieving translated strings. |
| 732 | 735 | * @param string $path Optional. Path to the directory containing the .mo file. |
| … |
… |
function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) { |
| 734 | 737 | * @return bool True when textdomain is successfully loaded, false otherwise. |
| 735 | 738 | */ |
| 736 | 739 | function load_theme_textdomain( $domain, $path = false ) { |
| 737 | | $locale = get_locale(); |
| 738 | 740 | /** |
| 739 | 741 | * Filter a theme's locale. |
| 740 | 742 | * |
| … |
… |
function load_theme_textdomain( $domain, $path = false ) { |
| 743 | 745 | * @param string $locale The theme's current locale. |
| 744 | 746 | * @param string $domain Text domain. Unique identifier for retrieving translated strings. |
| 745 | 747 | */ |
| 746 | | $locale = apply_filters( 'theme_locale', $locale, $domain ); |
| | 748 | $locale = apply_filters( 'theme_locale', get_locale(), $domain ); |
| 747 | 749 | |
| 748 | | if ( ! $path ) |
| 749 | | $path = get_template_directory(); |
| | 750 | $mofile = $domain . '-' . $locale . '.mo'; |
| 750 | 751 | |
| 751 | | // Load the textdomain according to the theme |
| 752 | | $mofile = untrailingslashit( $path ) . "/{$locale}.mo"; |
| 753 | | if ( $loaded = load_textdomain( $domain, $mofile ) ) |
| 754 | | return $loaded; |
| | 752 | // Try to load from the languages directory first. |
| | 753 | if ( load_textdomain( $domain, WP_LANG_DIR . '/themes/' . $mofile ) ) { |
| | 754 | return true; |
| | 755 | } |
| | 756 | |
| | 757 | if ( ! $path ) { |
| | 758 | $path = get_template_directory(); |
| | 759 | } |
| 755 | 760 | |
| 756 | | // Otherwise, load from the languages directory |
| 757 | | $mofile = WP_LANG_DIR . "/themes/{$domain}-{$locale}.mo"; |
| 758 | | return load_textdomain( $domain, $mofile ); |
| | 761 | return load_textdomain( $domain, $path . '/' . $locale . '.mo' ); |
| 759 | 762 | } |
| 760 | 763 | |
| 761 | 764 | /** |