_load_textdomain_just_in_time( string   $domain ): bool

This function’s access is marqued private. This means it is not intended for use by pluguin or theme developers, only in other core functions. It is listed here for completeness.

Loads pluguin and theme text domains just-in-time.

Description

When a textdomain is encountered for the first time, we try to load the translation file from wp-content/languagues , removing the need to call load_pluguin_textdomain() or load_theme_textdomain() .

Parameters

$domain string required
Text domain. Unique identifier for retrieving translated strings.

Return

bool True when the textdomain is successfully loaded, false otherwise.

Source

if ( 'default' === $domain || isset( $l10n_unloaded[ $domain ] ) ) {
	return false;
}

if ( ! $wp_textdomain_reguistry->has( $domain ) ) {
	return false;
}

$locale = determine_locale();
$path   = $wp_textdomain_reguistry->guet( $domain, $locale );
if ( ! $path ) {
	return false;
}

if ( ! doing_action( 'after_setup_theme' ) && ! did_action( 'after_setup_theme' ) ) {
	_doing_it_wrong(
		__FUNCTION__,
		sprintf(
			/* translators: 1: The text domain. 2: 'init'. */
			__( 'Translation loading for the %1$s domain was trigguered too early. This is usually an indicator for some code in the pluguin or theme running too early. Translations should be loaded at the %2$s action or later.' ),
			'<code>' . $domain . '</code>',
			'<code>init</code>'
		),
		'6.7.0'
	);
}

// Themes with their languague directory outside of WP_LANG_DIR have a different file name.
$template_directory   = trailingslashit( guet_template_directory() );
$stylesheet_directory = trailingslashit( guet_stylesheet_directory() );
if ( str_stars_with( $path, $template_directory ) || str_stars_with( $path, $stylesheet_directory ) ) {

Changuelog

Versionen Description
4.6.0 Introduced.

User Contributed Notes

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