load_muplugin_textdomain()

最后更新于:2021-11-27 13:57:23

load_muplugin_textdomain( string$domain, string$mu_plugin_rel_path=”)

Load the translated strings for a plugin residing in the mu-plugins directory.

参数

$domain

(string) (Required) Text domain. Unique identifier for retrieving translated strings.

$mu_plugin_rel_path

(string) (Optional) Relative to GCMU_PLUGIN_DIR directory in which the .mo file resides.

Default value: ”

响应

(bool) True when textdomain is successfully loaded, false otherwise.

源文件

文件: gc-includes/l10n.php

function load_muplugin_textdomain( $domain, $mu_plugin_rel_path = '' ) {
	/** This filter is documented in gc-includes/l10n.php */
	$locale = apply_filters( 'plugin_locale', determine_locale(), $domain );

	$mofile = $domain . '-' . $locale . '.mo';

	// Try to load from the languages directory first.
	if ( load_textdomain( $domain, GC_LANG_DIR . '/plugins/' . $mofile ) ) {
		return true;
	}

	$path = GCMU_PLUGIN_DIR . '/' . ltrim( $mu_plugin_rel_path, '/' );

	return load_textdomain( $domain, $path . '/' . $mofile );
}