Bug? data-lang now only accepts "parent" language codes


We have had a bug reported to us by one of our users about the localisation of the Tweet button. Until recent weeks, in their language (Spanish) the Tweet button rendered the text “Twittear”, it now renders as “Tweet”.

Our language codes for the Spanish locale are es-LA, es-MX and es-ES (for example), an it is these that we pass in to the Tweet button.

This should work because:

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.

It is the part in bold that no longer appears to be working correctly.

Please see this Fiddle:

Note the first two are typically what we would render in our application. The first has a language code of en-US for our default language English (US) - this obviously works fine. The second has a language code of es-MX. Up until recently this would work and display the word “Twittear”. Now, it seems, the unsupported language variant mentioned above is ingored, and instead renders the button in English. The third example with the language code of “es” is exactly how we would expect the second tweet button in the example to look.

With this change being undocumented, and breaking suddenly, I would suggest this could be a bug that may need to be looked into.

Any advice greatly appreciated.




Pass data-lang when you know the Twitter locale value and want to explicitly set. Twitter may infer from the language code specified in the page.

The lang data-* attribute should match the Twitter locale code, provided in the list. If a language can be inferred from the page or section, such as a lang attribute on a parent element of es-MX, a version of the language without the country-specific localization may be used instead.


Hence my report. This bit isn’t working. See my Fiddle I posted above http://jsfiddle.net/chrisdeeming/r29uz8o6/


I just want to reiterate for clarity: it was working until recently, and stopped working in the last 2-3 weeks.


Thanks so much for alerting us to this, Chris. We’ve deployed a fix for the regression today.


Fall back of unsupported language variant to parent language is not working

This topic was automatically closed after 8 hours. New replies are no longer allowed.