@@ 745-759 (lines=15) @@ | ||
742 | * file resides. Default empty string. |
|
743 | * @return bool True when textdomain is successfully loaded, false otherwise. |
|
744 | */ |
|
745 | function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) { |
|
746 | /** This filter is documented in wp-includes/l10n.php */ |
|
747 | $locale = apply_filters( 'plugin_locale', is_admin() ? get_user_locale() : get_locale(), $domain ); |
|
748 | ||
749 | $mofile = $domain . '-' . $locale . '.mo'; |
|
750 | ||
751 | // Try to load from the languages directory first. |
|
752 | if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile ) ) { |
|
753 | return true; |
|
754 | } |
|
755 | ||
756 | $path = WPMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' ); |
|
757 | ||
758 | return load_textdomain( $domain, $path . '/' . $mofile ); |
|
759 | } |
|
760 | ||
761 | /** |
|
762 | * Load the theme's translated strings. |
|
@@ 777-800 (lines=24) @@ | ||
774 | * Default false. |
|
775 | * @return bool True when textdomain is successfully loaded, false otherwise. |
|
776 | */ |
|
777 | function load_theme_textdomain( $domain, $path = false ) { |
|
778 | /** |
|
779 | * Filters a theme's locale. |
|
780 | * |
|
781 | * @since 3.0.0 |
|
782 | * |
|
783 | * @param string $locale The theme's current locale. |
|
784 | * @param string $domain Text domain. Unique identifier for retrieving translated strings. |
|
785 | */ |
|
786 | $locale = apply_filters( 'theme_locale', is_admin() ? get_user_locale() : get_locale(), $domain ); |
|
787 | ||
788 | $mofile = $domain . '-' . $locale . '.mo'; |
|
789 | ||
790 | // Try to load from the languages directory first. |
|
791 | if ( load_textdomain( $domain, WP_LANG_DIR . '/themes/' . $mofile ) ) { |
|
792 | return true; |
|
793 | } |
|
794 | ||
795 | if ( ! $path ) { |
|
796 | $path = get_template_directory(); |
|
797 | } |
|
798 | ||
799 | return load_textdomain( $domain, $path . '/' . $locale . '.mo' ); |
|
800 | } |
|
801 | ||
802 | /** |
|
803 | * Load the child themes translated strings. |