apply_filters( 'load_translation_file', string $file, string $domain, string $locale )
- Since
- 6.5.0, 6.6.0
Filters the file path for loading translations for the given text domain.
Description
Similar to the 'load_textdomain_mofile' filter with the difference that the file path could be for an MO or PHP file.
Compatibility
- WordPress
- since 6.6.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$filestring- Path to the translation file to load.
$domainstring- The text domain.
$localestring- The locale.
Where this hook fires · 1
wp-includes/l10n.php:843load_textdomain()
Source code
* @since 6.6.0 Added the `$locale` parameter. * * @param string $file Path to the translation file to load. * @param string $domain The text domain. * @param string $locale The locale. */ $file = (string) apply_filters( 'load_translation_file', $file, $domain, $locale ); $success = $i18n_controller->load_file( $file, $domain, $locale ); if ( $success ) { if ( isset( $l10n[ $domain ] ) && $l10n[ $domain ] instanceof MO ) { $i18n_controller->load_file( $l10n[ $domain ]->get_filename(), $domain, $locale );Changelog
Introduced in 6.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
6.6.0
Added the
$locale parameter.from the docblock6.5.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.