Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

refactor cldr data collector #71

Closed
caridy opened this issue Sep 12, 2014 · 2 comments
Closed

refactor cldr data collector #71

caridy opened this issue Sep 12, 2014 · 2 comments

Comments

@caridy
Copy link
Collaborator

caridy commented Sep 12, 2014

Locales

This pkg only consume root locales. This means we don't care (maybe we should jejejeje), about fr-FR, or en-BR, we only care about en and fr as the top level locales. The routine to analyze all locales in CLDR and pick up the root locales is here:
https://github.com/yahoo/intl-messageformat/blob/master/tasks/build-data.js#L7-L16

Plural rules extraction

This pkg uses cldr.extractPluralRuleFunction() to collect "a function" that contains the pluralization and gender rules:
https://github.com/yahoo/intl-messageformat/blob/master/tasks/build-data.js#L98

This is where things gets funky, because we will like to collect data instead and creating the logic around the data rather than a function that we don't know how it works. The content of that function is something along these lines:

// require('cldr').extractPluralRuleFunction('en') returns:
function anonymous(n) {
  var i=Math.floor(Math.abs(n)),
        v=n.toString().replace(/^[^.]*\\.?/,"").length;
  if (typeof n==="string") n=parseInt(n,10);
  if (i===1&&v===0) return"one";
  return"other"
}
@ericf
Copy link
Collaborator

ericf commented Mar 6, 2015

Improvements to the locale data are in PR #102

@longlho
Copy link
Member

longlho commented May 16, 2019

close since we use Intl.PluralRules now

@longlho longlho closed this as completed May 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants