_get_path_to_translation()WP 4.7.0

Deprecated since 6.1.0. It is no longer supported and may be removed in future releases. It is recommended to replace this function with the same one.

Gets the path to a translation file for loading a textdomain just in time.

Caches the retrieved results internally.

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Returns

String|false. The path to the translation file or false if no translation file was found.

Usage

_get_path_to_translation( $domain, $reset );
$domain(string) (required)
Text domain. Unique identifier for retrieving translated strings.
$reset(true|false)
Whether to reset the internal cache. Used by the switch to locale functionality.
Default: false

Notes

Changelog

Since 4.7.0 Introduced.
Deprecated since 6.1.0

_get_path_to_translation() code WP 6.9

function _get_path_to_translation( $domain, $reset = false ) {
	_deprecated_function( __FUNCTION__, '6.1.0', 'WP_Textdomain_Registry' );

	static $available_translations = array();

	if ( true === $reset ) {
		$available_translations = array();
	}

	if ( ! isset( $available_translations[ $domain ] ) ) {
		$available_translations[ $domain ] = _get_path_to_translation_from_lang_dir( $domain );
	}

	return $available_translations[ $domain ];
}