Summery Summery
Load the theme’s translated strings.
Syntax Syntax
Description Description
If the current locale exists as a .mo file in the theme’s root directory, it will be included in the translated strings by the $domain.
The .mo files must be named based on the locale exactly.
Parameters Parameters
- $domain
-
(Required) Text domain. Unique identifier for retrieving translated strings.
- $path
-
(Optional) Path to the directory containing the .mo file.
Default value: false
Return Return
(bool) True when textdomain is successfully loaded, false otherwise.
Source Source
File: wp-includes/l10n.php
/** * Filters a plugin's locale. * * @since 3.0.0 * * @param string $locale The plugin's current locale. * @param string $domain Text domain. Unique identifier for retrieving translated strings. */ $locale = apply_filters( 'plugin_locale', determine_locale(), $domain ); $mofile = $domain . '-' . $locale . '.mo'; // Try to load from the languages directory first. if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile ) ) { return true; } if ( false !== $plugin_rel_path ) { $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' ); } elseif ( false !== $deprecated ) { _deprecated_argument( __FUNCTION__, '2.7.0' ); $path = ABSPATH . trim( $deprecated, '/' ); } else { $path = WP_PLUGIN_DIR;
Advertisement
Changelog Changelog
Version | Description |
---|---|
4.6.0 | The function now tries to load the .mo file from the languages directory first. |
1.5.0 | Introduced. |