Exactly, now I have Polylang API back for this plugin, it was an Ajax call that was hiding it.
Google is really friendly when it comes to get good answers. I found this here
function gce_load_polylang_on_ajax() {
?>
<script type="text/javascript">
if (typeof jQuery != 'undefined') {
jQuery.ajaxSetup({
data: { pll_load_front: true }
});
}
</script>
<?php
}
add_action( 'wp_head', 'gce_load_polylang_on_ajax' );
With this function that I’ve pasted at my child theme functions.php there’s no need to hardcore .js files at least to set the variable ‘pll_load_front’ in the request.
The cherry in the top of the cake would be to extend that function to set the ‘lang’ variable with the ‘pll_current_language()’, which I don’t have any idea of how it could be done.
I’ve tried one thing but couldn’t go any further, which was get the language statement at the begining of the document (eg.)'<html lang=”fr-FR” …. > and set the whole display result with that.
lang: document.getElementsByTagName('html')[0]
It would return fr-FR for the example above and is consistent with our frontend wanted language, instead of the wp-config.php defined language.
So for now I’m using Polylang API that hopefuly will solve the whole thing.