load_default_textdomain
函数
load_default_textdomain ( $locale = null )
- 参数
-
-
(string)
$locale
Optional. Locale to load. Default is the value of get_locale().- Required: 否
- Default: null
-
(string)
- 返回值
-
- (bool) Whether the textdomain was loaded.
- 相关
-
- load_textdomain()
- 定义位置
-
-
wp-includes/l10n.php
, line 864
-
wp-includes/l10n.php
- 引入
- 1.5.0
- 弃用
- –
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.
function load_default_textdomain( $locale = null ) { if ( null === $locale ) { $locale = determine_locale(); } // Unload previously loaded strings so we can switch translations. unload_textdomain( 'default' ); $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 ) ) { 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; }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。