papandreou / node-cldr

node.js library for extracting data from CLDR (the Unicode Common Locale Data Repository)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Territoryinformation - language population wrong

weeco opened this issue · comments

I am not sure if it's just because of different cldr data or actually a bug with this library.

var territoryInfo = cldr.extractTerritoryInfo()
console.log(territoryInfo['BE'])

This will show that 'de' populationPercent is 1.4:
{ id: 'de', populationPercent: 1.4, officialStatus: 'official' }

However cldr says in their xml that it is 22: http://img04.imgland.net/CCRnykE.png
CLDR link: http://www.unicode.org/repos/cldr/trunk/common/supplemental/supplementalData.xml

Edit: Another weird result for Denmark:
console.log(territoryInfo['DK']) -> shows populationPercent: 0.43, for Germany, it should be 47 instead.

Edit 2: In Czech populationPercent should be 15 for Germany, instead it is 0.49

This module defaults to use a checked in copy of CLDR (presently 30.0.3), so the numbers are correct:

<territory type="BE" gdp="483300000000" literacyPercent="99" population="11324000"> <!--Belgium-->
<languagePopulation type="en" populationPercent="59" references="R1052"/> <!--English-->
<languagePopulation type="nl" populationPercent="55" officialStatus="official" references="R1004"/> <!--Dutch-->
<languagePopulation type="fr" populationPercent="38" officialStatus="official"/> <!--French-->
<languagePopulation type="vls" populationPercent="10"/> <!--West Flemish-->
<languagePopulation type="wa" writingPercent="5" populationPercent="5.8" references="R1005"/> <!--Walloon-->
<languagePopulation type="de" populationPercent="1.4" officialStatus="official"/> <!--German-->
</territory>

Looks like there has been a new release 31 in the mean time, so that's probably the reason for the discrepancy. Let's see about upgrading to that.

In the mean time you can try using a local copy of the newer CLDR:

var cldr = require('cldr').load('/path/to/my/cldr');

... but YMMV. I've found that it's easier to follow along with the changes that happen in CLDR itself by concentrating on supporting one release at a time.

I upgraded CLDR to 31.0.1 and made a 4.5.0 release. Could you try that and see if the numbers match what you expected now?

Yes that did it. THese must have been bugs in CLDR itself then. I doubt the population percent would jump from 0.43 to 47% within such a short time :D. Thanks for taking a look into it