Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Multi-language edition


Carlos Perez
Participant

@carlosepp

I think the best solution is to have two separate .mo files with the interface translation and set the translation on wp-content/plugins/bp-custom.php (If you havent the file, create one) with the following code
$lang = substr($_SERVER, 0, 2);
switch ($lang){
case ‘en’:
define( ‘BPLANG’, ‘en’ );
if ( file_exists( BP_PLUGIN_DIR . ‘/bp-languages/buddypress-en.mo’ ) ) {
load_textdomain( ‘buddypress’, BP_PLUGIN_DIR . ‘/bp-languages/buddypress-en.mo’ );
}
break;
case ‘es’:
define( ‘BPLANG’, ‘es’ );
if ( file_exists( BP_PLUGIN_DIR . ‘/bp-languages/buddypress-es.mo’ ) ) {
load_textdomain( ‘buddypress’, BP_PLUGIN_DIR . ‘/bp-languages/buddypress-es.mo’ );
}
break;
}
Check that the filenames are the same

This code detects automatically the browser language and defines the language.

Follow this article to find more about this
https://codex.buddypress.org/buddypress-site-administration/customizing-labels-messages-and-urls/

Skip to toolbar