I18N: Add the `get_available_languages` filter.
Sometimes, a language file may not exist in exactly the format or location that `get_available_languages()` expects it to be in - for sites with this level of customisation, they need to be able to add their own language files to the list of those available. Props yoavf. Fixes #38788. git-svn-id: https://develop.svn.wordpress.org/trunk@39235 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
32325e8e1d
commit
80bd60fb88
|
@ -948,6 +948,7 @@ function translate_user_role( $name ) {
|
||||||
* The default directory is WP_LANG_DIR.
|
* The default directory is WP_LANG_DIR.
|
||||||
*
|
*
|
||||||
* @since 3.0.0
|
* @since 3.0.0
|
||||||
|
* @since 4.7.0 The results are now filterable with the get_available_languages filter.
|
||||||
*
|
*
|
||||||
* @param string $dir A directory to search for language files.
|
* @param string $dir A directory to search for language files.
|
||||||
* Default WP_LANG_DIR.
|
* Default WP_LANG_DIR.
|
||||||
|
@ -967,7 +968,15 @@ function get_available_languages( $dir = null ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $languages;
|
/**
|
||||||
|
* Filters the list of available language codes
|
||||||
|
*
|
||||||
|
* @since 4.7.0
|
||||||
|
*
|
||||||
|
* @param array $languages An array of available language codes.
|
||||||
|
* @param string $dir The directory where the language files were found.
|
||||||
|
*/
|
||||||
|
return apply_filters( 'get_available_languages', $languages, $dir );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue