You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 1, 2018. It is now read-only.
I had an issue with the facebook button not appearing on a french page.
The problem is that the html lang attribute follow the "BCP47" format, and facebook want something like "ISO language and country codes respectively, concatenated by an underscore".
The BCP format concatenate the language and country with a "-" if i'm right. At least, on a french wordpress the language attribute is "fr-FR".
Eventually simply replacing the "-" with an underscore is not really enough. In switzerland for instance there is a french part and the country code is CH. But I tried with "fr_CH" and facebook was still not showing up, changing it to "fr_FR" worked.
So one option would be to add a "data-locale" attribute to the social count container. This is not ideal but would be the most flexible solution.
Another option would be to have a function to convert BCP47 format to facebook format, but it may not be enough for some combination of language and country.
I had an issue with the facebook button not appearing on a french page.
The problem is that the html lang attribute follow the "BCP47" format, and facebook want something like "ISO language and country codes respectively, concatenated by an underscore".
The BCP format concatenate the language and country with a "-" if i'm right. At least, on a french wordpress the language attribute is "fr-FR".
Eventually simply replacing the "-" with an underscore is not really enough. In switzerland for instance there is a french part and the country code is CH. But I tried with "fr_CH" and facebook was still not showing up, changing it to "fr_FR" worked.
So one option would be to add a "data-locale" attribute to the social count container. This is not ideal but would be the most flexible solution.
Another option would be to have a function to convert BCP47 format to facebook format, but it may not be enough for some combination of language and country.
Sources:
https://developer.mozilla.org/en/docs/HTML/Global_attributes#attr-lang
https://developers.facebook.com/docs/internationalization/
edit: I'm not sure "fr-CH" is a valid BCP47 format and fr-FR is most common, so maybe just replacing the "-" with a "_" is a good solution"
The text was updated successfully, but these errors were encountered: