@@ 723-737 (lines=15) @@ | ||
720 | * file resides. Default empty string. |
|
721 | * @return bool True when textdomain is successfully loaded, false otherwise. |
|
722 | */ |
|
723 | function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) { |
|
724 | /** This filter is documented in wp-includes/l10n.php */ |
|
725 | $locale = apply_filters( 'plugin_locale', get_locale(), $domain ); |
|
726 | ||
727 | $mofile = $domain . '-' . $locale . '.mo'; |
|
728 | ||
729 | // Try to load from the languages directory first. |
|
730 | if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile ) ) { |
|
731 | return true; |
|
732 | } |
|
733 | ||
734 | $path = trailingslashit( WPMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' ) ); |
|
735 | ||
736 | return load_textdomain( $domain, $path . '/' . $mofile ); |
|
737 | } |
|
738 | ||
739 | /** |
|
740 | * Load the theme's translated strings. |
|
@@ 755-778 (lines=24) @@ | ||
752 | * Default false. |
|
753 | * @return bool True when textdomain is successfully loaded, false otherwise. |
|
754 | */ |
|
755 | function load_theme_textdomain( $domain, $path = false ) { |
|
756 | /** |
|
757 | * Filters a theme's locale. |
|
758 | * |
|
759 | * @since 3.0.0 |
|
760 | * |
|
761 | * @param string $locale The theme's current locale. |
|
762 | * @param string $domain Text domain. Unique identifier for retrieving translated strings. |
|
763 | */ |
|
764 | $locale = apply_filters( 'theme_locale', get_locale(), $domain ); |
|
765 | ||
766 | $mofile = $domain . '-' . $locale . '.mo'; |
|
767 | ||
768 | // Try to load from the languages directory first. |
|
769 | if ( load_textdomain( $domain, WP_LANG_DIR . '/themes/' . $mofile ) ) { |
|
770 | return true; |
|
771 | } |
|
772 | ||
773 | if ( ! $path ) { |
|
774 | $path = get_template_directory(); |
|
775 | } |
|
776 | ||
777 | return load_textdomain( $domain, $path . '/' . $locale . '.mo' ); |
|
778 | } |
|
779 | ||
780 | /** |
|
781 | * Load the child themes translated strings. |