Originally asked on the BuddyPress forums:
For distribution purposes I would like to include my customized buddypress language files in my theme alongside my other language files. No matter what I try though I can only get the language files to display if I copy them over to wp-content/languages
as described in the buddypress codex. I thought that the following would work, but it doesnât:
function load_buddypress_language_files() {
load_theme_textdomain('buddypress', get_template_directory() . '/lang');
}
add_action('plugins_loaded', 'load_buddypress_language_files');
This is possible isn’t it?
WP: 3.5.1 BP: 1.7.2
First, actions added to
plugins_loaded
hook will not work from themefunctions.php
or any theme file because at that point it will be already fired (too late from theme files).What you can do is to hook your action into
after_setup_theme
and unloadbuddypress
text domain first and then add your custombuddypress
text domain file. The reason is that WordPress will not load any translation files for text domains that has already been added: