Third party Tweet button localization

I think we may need to look at this in more detail.

We can (and do) sort of control it. Each language you have installed has a language code based on the "Locale", e.g. en-US is the default for English (US). es-LA is the default for Spanish, and es-MX is the default for Mexico Spanish, etc.

We pass that language code into the Tweet button code.

According to some Twitter documentation:

The languages presently supported by the widgets are: hi, zh-cn, fr, zh-tw, msa, fil, fi, sv, pl, ja, ko, de, it, pt, es, ru, id, tr, da, no, nl, hu, fa, ar, ur, he, th.

If an unsupported language variant is specified that isn’t supported, the widget will be rendered in the matching parent language: For example es-mx will be rendered as es. If a page’s language code does not match any supported translation, US English is the default.

The bit in bold, no longer seems to be true. If I set the language code to es-mx or es-MX (either case), then the button reads as "Tweet" as if rendering in US English. None of the Spanish locales in XenForo actually use the language code "es" on its own though if I force it to this then the button does get rendered in Spanish.
 
Last edited:
We can workaround this in some cases, but this does potentially break other cases. As their documentation says that this should be working, we have reported it as a bug to them so hopefully it will be fixed soon.
 
This was indeed 100% down to a bug in Twitter but I have been told today by one of the Twitter developers that the issue has been fixed. Certainly in my testing it appears to work - the language codes we pass in to Twitter should render in the closest "parent" language, e.g. es-LA will resolve to "es"

Here was an example that was showing the bug:
http://jsfiddle.net/chrisdeeming/r29uz8o6/

You can now see the bottom two both correctly show the localized word.
 
Top Bottom