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

Fix locale data and improve locale resolving #28

Merged
merged 2 commits into from
Mar 10, 2015

Conversation

ericf
Copy link
Collaborator

@ericf ericf commented Mar 10, 2015

This upgrades to intl-messageformat@1.1.0 and grunt-extract-cldr-data@2.1.1 which vastly improves the locale data in the following ways:

  • Added locale data for all leaf locales which differ from their root locale's data; e.g. zh-Hant-HK is not the same as zh-Hant which is not the same as zh.
  • Properly de-duplicate data for all CLDR locales by correctly traversing a locale's hierarchy of ancestor locales.
  • Added data for the following languages:
    aa, agq, bas, bh, ckb, dav, dje, dsb, dua, dv, dyo, ebu, ewo, guw, guz, hsb, ia, in, iu, iw, jbo, ji, jv, jw, kaj, kam, kcg, khq, ki, kln, kok, ksf, ku, lb, lu, luo, luy, mer, mfe, mgh, mo, mua, nah, nmg, no, nqo, nus, ny, pap, prg, qu, rn, rw, sbp, sh, sma, smi, smj, smn, sms, swc, syr, tk, tl, twq, vai, wa, wo, yav, yi, zgh

These changes also include improvements for how locales are resolved. Here are some details of these changes:

  • If no extra locale data is loaded, the locale will always resolved to en.

  • If locale data is missing for a leaf locale like fr-FR, but there is data for the root, fr in this case, then its root will be used.

  • If there's data for the specified locale, then that locale will be resolved; i.e.,

    var rf = new IntlRelativeFormat('en-US');
    assert(rf.resolvedOptions().locale === 'en-US'); // true
  • The resolved locales are now normalized; e.g., en-us will resolve to: en-US.

Fixes #25

This upgrades to `intl-messageformat@1.1.0` and
`grunt-extract-cldr-data@2.1.1` which vastly improves the locale data
in the following ways:

* Added locale data for all leaf locales which differ from their root
  locale's data; e.g. "zh-Hant-TW" is not the same as "zh".

* Properly de-duplicate data for all CLDR locales by correctly
  traversing a locale's hierarchy of ancestor locales.

* Added data for the following languages:
  aa, agq, bas, bh, ckb, dav, dje, dsb, dua, dv, dyo, ebu, ewo, guw,
  guz, hsb, ia, in, iu, iw, jbo, ji, jv, jw, kaj, kam, kcg, khq, ki,
  kln, kok, ksf, ku, lb, lu, luo, luy, mer, mfe, mgh, mo, mua, nah,
  nmg, no, nqo, nus, ny, pap, prg, qu, rn, rw, sbp, sh, sma, smi, smj,
  smn, sms, swc, syr, tk, tl, twq, vai, wa, wo, yav, yi, zgh

----

These changes also include improvements for how locales are resolved.
Here are some details of these changes:

* If no extra locale data is loaded, the locale will _always_ resolved
  to `en`.

* If locale data is missing for a leaf locale like `fr-FR`, but there
  _is_ data for the root, `fr` in this case, then its root will be
  used.

* If there's data for the specified locale, then that locale will be
  resolved; i.e.,

    var rf = new IntlRelativeFormat('en-US');
    assert(rf.resolvedOptions().locale === 'en-US'); // true

* The resolved locales are now normalized; e.g., `en-us` will resolve
  to: `en-US`.

Fixes formatjs#25
@yahoocla
Copy link

CLA is valid!

@ericf
Copy link
Collaborator Author

ericf commented Mar 10, 2015

After this is merged the README docs should be updated.

@caridy
Copy link
Collaborator

caridy commented Mar 10, 2015

🎱

@jasonmit
Copy link
Contributor

:shipit:

ericf added a commit that referenced this pull request Mar 10, 2015
Fix locale data and improve locale resolving
@ericf ericf merged commit 81153f2 into formatjs:master Mar 10, 2015
@ericf ericf deleted the correct-cldr-data branch March 10, 2015 05:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RelativeFormat.__localeData__ needs the full locale name, instead we just take the root locale
4 participants