This thread is resolved. Here is a description of the problem and solution.
Problem:
The client is unable to translate the content of the gender field (Male / Female) in BuddyPress, even though the word "Gender" gets translated.
Solution:
We recommend using the following custom code to translate BuddyPress profile fields:
//WPML Workaround wpml_compsupp-7149 add_filter( 'bp_get_the_profile_field_value', 'wpml_compsupp6144_translate_buddypress_profile_fields', 10, 3 ); function wpml_compsupp6144_translate_buddypress_profile_fields( $value, $type, $id ) { if ($type == 'textbox' || $type == 'wp-textbox' || $type == 'wp-biography' || $type == 'gender') { //remove html tags from value and limit it's size, so we can use it as string name $filtered_value = substr(strip_tags($value), 0, 60); //register string do_action( 'wpml_register_single_string', 'BuddyPress Profile Fields', $type.' - '.$filtered_value , $value ); //translate string $value = apply_filters('wpml_translate_single_string', $value, 'BuddyPress Profile Fields', $type.' - '.$filtered_value ); } return $value; }
Please add this code to your theme's functions.php file or a custom plugin. For more information, you can refer to our errata page: https://wpml.org/errata/buddypress-profile-fields-are-not-being-translated-on-the-frontend/.
If this solution doesn't look relevant, please open a new support ticket at our support forum.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.