Profile Builder to add support for PolyLang plugin in field titles

Shortcode to add support for PolyLang plugin in field titles, descriptions and labels.

Make sure to:

  • Change Label name in Manage Fields (click image):

1

Label name must be (for English and Francais):

UsernameNom d’utilizateur

You can add as many languages as you need.

You must translate each field like in the e.g. above.

  • Add shortcode at the top of your page:

[wppb_polylang_compat]

Now when you change language with Language Switcher the fields language will change.

This is more like a hack to make it work.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
* Shortcode to add support for PolyLang plugin in field titles, descriptions and labels.
*/

add_shortcode('wppb_polylang_compat', 'wppb_polylang_compat');
function wppb_polylang_compat($atts,$content=null){
return "
jQuery(document).ready(function(){
curr_lang = jQuery('html')[0].lang;
jQuery('.wppb-user-forms li label > span, .wppb-user-forms li .wppb-description-delimiter > span').each(function(element){
jQuery(this).hide();
if ( jQuery(this).attr('lang') == curr_lang ){
jQuery(this).show();
}
})
});
";
}