twitter/twitter-cldr-js

Unexpected space in zh-tw LongDecimalFormatter thousands

Opened this issue · 2 comments

Describe the bug

LongDecimalFormatter with locale zh-tw for numbers 1000..9000 gives an unexpected space:

zh-cn: 1千, 2千, 3千, 4千, 5千, 6千, 7千, 8千, 9千
zh-tw: 1 千, 2 千, 3 千, 4 千, 5 千, 6 千, 7 千, 8 千, 9 千

Multiples of <100 and >10,000 are unaffected.

To Reproduce

console.log(
	['zh-cn', 'zh-tw'].map((locale) => `${locale}: ${Array.from({ length: 9 }, (_, i) => i + 1).map(n => {
		const TwitterCldr = require('twitter_cldr').load(locale)

		return new TwitterCldr.LongDecimalFormatter().format(n * 1000)
	}).join(', ')}`).join('\n')
)

Expected behavior

Results for zh-tw's 1000..9000 should look identical to those for zh-cn for that same range.

Environment

twitter_cldr 2.2.0, Node v16.13.0

Very curious. It looks like the data itself is wrong. Must be a bug with the Ruby code that generates the data.

Turns out the data in twitter-cldr-rb is wrong in v3.1.2, the version -js uses. The problem has since been fixed, but later versions of twitter-cldr-rb don't work because a number of internal classes etc have changed in the intervening years. We will need to upgrade the -rb dependency, which is going to be a project.