Filter
rpress_translation_directories
On this page
Filters the directories searched for RestroPress translation files.
Applied in RestroPress::load_textdomain. The default array lists, in priority order, the Loco Translate folder, the restropress folder and the plugins folder under WP_LANG_DIR, then the plugin languages folder. For each locale the loader looks for restropress-{locale}.mo and restropress-{locale}.l10n.php in each directory in order. Add a directory to ship translations from a custom location.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$dirs | array | Ordered array of directory paths to search for translation files. |
$search_locales | array | Locales that will be searched, for example en_US and en. |
Return value#
array. The ordered list of directories to search.
Example#
function my_add_translation_dir( $dirs, $search_locales ) {
array_unshift( $dirs, WP_CONTENT_DIR . '/my-translations/restropress/' );
return $dirs;
}
add_filter( 'rpress_translation_directories', 'my_add_translation_dir', 10, 2 );
Notes#
The first translation file found for a locale takes precedence, so put custom directories at the start of the array to override the bundled files.
Source#
Applied in:
includes/class-rpress.php(line 427), inRestroPress::load_textdomain()
See also#
Was this page helpful?
