Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



load_default_textdomain ›

Seit1.5.0
Veraltetn/v
load_default_textdomain ( $locale = null )
Parameter:
  • (string) $locale Optional. Locale to load. Default is the value of get_locale().
    Erforderlich: Nein
    Standard: null
Siehe:
Gibt zurück:
  • (bool) Whether the textdomain was loaded.
Definiert in:
Codex:

Load 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.



Quellcode

function load_default_textdomain( $locale = null ) {
	if ( null === $locale ) {
		$locale = is_admin() ? get_user_locale() : get_locale();
	}

	// Unload previously loaded strings so we can switch translations.
	unload_textdomain( 'default' );

	$return = load_textdomain( 'default', WP_LANG_DIR . "/$locale.mo" );

	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" );
		return $return;
	}

	if ( is_admin() || wp_installing() || ( defined( 'WP_REPAIRING' ) && WP_REPAIRING ) ) {
		load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo" );
	}

	if ( is_network_admin() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) )
		load_textdomain( 'default', WP_LANG_DIR . "/admin-network-$locale.mo" );

	return $return;
}