twitter/twitter-cldr-js

TimespanFormatter throws error in en-GB

Closed this issue · 3 comments

After having loaded the en-GB locale, the following snippet of code throws an exception:

new TwitterCldr.TimespanFormatter().format(new Date(5 * 60 * 60), { direction: 'none', type: 'abbreviated', unit: 'hour'});

What's interesting is that this isn't the case for en or fr - I would expect en-GB to have at least the same level of support as American English.

Ah I see the problem. For all locales in twitter-cldr-rb, we had to include abbreviation translations from the Twitter Translation Center because they weren't supported by CLDR - the best you can get is "short", eg. "5 hrs" instead of the abbreviated "5h". When we added support for en-GB, we didn't add the abbreviated timestamps because we probably didn't have translations. That said, en-GB should have exactly the same translations as en, so I'll port 'em over. Not sure when I'll have time since I'll be at RailsConf all next week, will try to get this done this weekend before the conference.

twitter-cldr-rb v2.4.3 and v3.0.1 published along with twitter-cldr-js 2.2.4, issue should be resolved.

I confirm the issue is resolved with the updated versions.