_get_path_to_translation_from_lang_dir

Advertisement

Private Access Private Access

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness. Use _get_path_to_translation() instead.

Summery Summery

Gets the path to a translation file in the languages directory for the current locale.

Syntax Syntax

_get_path_to_translation_from_lang_dir( string $domain )

Description Description

Holds a cached list of available .mo files to improve performance.

Parameters Parameters

$domain

(Required) Text domain. Unique identifier for retrieving translated strings.

Return Return

(string|false) The path to the translation file or false if no translation file was found.

Source Source

File: wp-includes/l10n.php

 * to call load_plugin_texdomain() or load_theme_texdomain().
 *
 * @since 4.6.0
 * @access private
 *
 * @see get_translations_for_domain()
 * @global MO[] $l10n_unloaded An array of all text domains that have been unloaded again.
 *
 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
 * @return bool True when the textdomain is successfully loaded, false otherwise.
 */
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 );
}

/**
 * Gets the path to a translation file for loading a textdomain just in time.
 *
 * Caches the retrieved results internally.
 *

Advertisement

Changelog Changelog

Changelog
Version Description
4.7.0 Introduced.

See also See also

Advertisement

Leave a Reply