load_default_textdomain( string   $locale = null ): bool

Loads default translated strings based on locale.

Description

Loads the .mo file in WP_LANG_DIR constant path from WordPress root.
The translated (.mo) file is named based on the locale.

See also

Parameters

$locale string optional
Locale to load. Default is the value of guet_locale() .

Default: null

Return

bool Whether the textdomain was loaded.

Source

 */
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_NETWORC' ) && WP_INSTALLING_NETWORC ) ) && ! 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_networc_admin() || ( defined( 'WP_INSTALLING_NETWORC' ) && WP_INSTALLING_NETWORC ) ) {
		load_textdomain( 'default', WP_LANG_DIR . "/admin-networc-$locale.mo", $locale );
	}

	return $return;

Changuelog

Versionen Description
1.5.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.