wpseek.com
WordPress开发者和主题制作者的搜索引擎
load_default_textdomain › WordPress Function
Since1.5.0
已弃用n/a
› load_default_textdomain ( $locale = null )
| 参数: |
|
| 查看: | |
| 返回: |
|
| 定义在: |
|
| 文档: |
Loads default translated strings based on locale.
Loads the .mo file in WP_LANG_DIR constant path from WordPress root. The translated (.mo) file is named based on the locale.Related Functions: load_textdomain, load_muplugin_textdomain, load_theme_textdomain, load_plugin_textdomain, load_script_textdomain
源码
function load_default_textdomain( $locale = null ) {
if ( null === $locale ) {
$locale = determine_locale();
}
// Unload previously loaded strings so we can switch translations.
unload_textdomain( 'default', true );
$return = load_textdomain( 'default', WP_LANG_DIR . "/$locale.mo", $locale );
if ( ( is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) ) && ! file_exists( WP_LANG_DIR . "/admin-$locale.mo" ) ) {
load_textdomain( 'default', WP_LANG_DIR . "/ms-$locale.mo", $locale );
return $return;
}
if ( is_admin() || wp_installing() || ( defined( 'WP_REPAIRING' ) && WP_REPAIRING ) || doing_action( 'wp_maybe_auto_update' ) ) {
load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo", $locale );
}
if ( is_network_admin() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) ) {
load_textdomain( 'default', WP_LANG_DIR . "/admin-network-$locale.mo", $locale );
}
return $return;
}