WP_Translation_Controller::is_textdomain_loaded()publicWP 6.5.0

Determines whether translations are loaded for a given text domain.

Method of the class: WP_Translation_Controller{}

No Hooks.

Return

true|false. True if there are any loaded translations, false otherwise.

Usage

$WP_Translation_Controller = new WP_Translation_Controller();
$WP_Translation_Controller->is_textdomain_loaded( $textdomain, ?string $locale ): bool;
$textdomain(string)
Text domain.
Default: 'default'
?string $locale **
-
Default: null

Changelog

Since 6.5.0 Introduced.

WP_Translation_Controller::is_textdomain_loaded() code WP 6.7.1

public function is_textdomain_loaded( string $textdomain = 'default', ?string $locale = null ): bool {
	if ( null === $locale ) {
		$locale = $this->current_locale;
	}

	return isset( $this->loaded_translations[ $locale ][ $textdomain ] ) &&
		array() !== $this->loaded_translations[ $locale ][ $textdomain ];
}