bp_core_load_buddypress_textdomain()
Load the buddyboss translation file for current language.
Description
See also
- load_textdomain(): for a description of return values.
Return
(bool) True on success, false on failure.
Source
File: bp-core/bp-core-functions.php
function bp_core_load_buddypress_textdomain() {
$domain = 'buddyboss';
/**
* Filters the locale to be loaded for the language files.
*
* @since BuddyPress 1.0.2
*
* @param string $value Current locale for the install.
*/
$mofile_custom = sprintf( '%s-%s.mo', $domain, apply_filters( 'buddypress_locale', get_locale() ) );
/**
* Filters the locations to load language files from.
*
* @since BuddyPress 2.2.0
*
* @param array $value Array of directories to check for language files in.
*/
$locations = apply_filters( 'buddypress_locale_locations', array(
trailingslashit( WP_LANG_DIR . '/' . $domain ),
trailingslashit( WP_LANG_DIR ),
) );
// Try custom locations in WP_LANG_DIR.
foreach ( $locations as $location ) {
if ( load_textdomain( 'buddyboss', $location . $mofile_custom ) ) {
return true;
}
}
// Default to WP and glotpress.
return load_plugin_textdomain( $domain );
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 1.0.2 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.