WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
функция не описана

_load_textdomain_just_in_time() WP 4.6.0

Loads plugin and theme textdomains just-in-time.

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

Хуков нет.

Возвращает

true/false. True when the textdomain is successfully loaded, false otherwise.

Использование

_load_textdomain_just_in_time( $domain );
$domain(строка) (обязательный)
Text domain. Unique identifier for retrieving translated strings.

Заметки

  • Смотрите: get_translations_for_domain()
  • Global. MO[]. $l10n_unloaded An array of all text domains that have been unloaded again.

Список изменений

С версии 4.6.0 Введена.

Код _load_textdomain_just_in_time() WP 5.5.1

<?php
function _load_textdomain_just_in_time( $domain ) {
	global $l10n_unloaded;

	$l10n_unloaded = (array) $l10n_unloaded;

	// Short-circuit if domain is 'default' which is reserved for core.
	if ( 'default' === $domain || isset( $l10n_unloaded[ $domain ] ) ) {
		return false;
	}

	$translation_path = _get_path_to_translation( $domain );
	if ( false === $translation_path ) {
		return false;
	}

	return load_textdomain( $domain, $translation_path );
}