0

I'm really stumpted here.

I've got this code to load my textdomains for the english version of the site I'm working on.

The following code is in the Functions.php theme file.

if(ICL_LANGUAGE_CODE == 'en'){
    $textdomainLoad = load_textdomain( SHIROI_THEME_DOMAIN, get_template_directory().'/lang/en_US.mo' );
    load_textdomain( "site", get_template_directory().'/lang/en_US.mo' );
    echo '<!--textdomainloadednohook '.$textdomainLoad.'-->';
}

This usually works. But on this website, it doesnt. I checked, and my textdomain is correct.

The echo underneath echoes at the beginning of the page, meaning the file is OK and loaded correctly.

But on this site in particular, it doesn't. In my footer, text is still in french, which is the language my strings start as.

What could I use to test, and figure out where the hitch is?

PS: Even weirder: We run the sameish code on a staging environnement, on stage it works. On production it doesnt.

1 Answer 1

1

Would have loved to know that beforehand. Here is the solution to my problem, so others that are stuck might not be stuck on this for hours.

WPML has a String Translation plugin. If it is activated, it seems that it passes before the load_textdomain in priority. And so, load_textdomain works in loading the file (giving the true) but String Translation throws all of it in the trash when it loads itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.