v1.1.0 — Properly Resolve Parent Locales
In this release parent locales are now properly resolved and exposed in the output data.
The CLDR uses an algorithm to resolve locale data, but there are exceptions. The changes in this release leverage the data for the exceptional cases to now properly resolve a locale's parent locale.
Locale entries with a parent will now contain a parentLocale
property. This can be used by code consuming the data this package outputs to accurately traverse the locale hierarchy. This is very useful since this package will de-duplicate data as much as possible.
Also, a change in this release now guarantees that all locales listed in the locales
option will have entries in the output data.
The following example shows how the locale hierarchy is used to return the unique data:
var extractData = require('formatjs-extract-cldr-data');
var data = extractData({
locales : ['en-US', 'en-GB'],
pluralRules: true
});
console.log(data); // =>
{ 'en-US': { locale: 'en-US', parentLocale: 'en' },
'en-GB': { locale: 'en-GB', parentLocale: 'en-001' },
'en-001': { locale: 'en-001', parentLocale: 'en' } },
en: { locale: 'en', pluralRuleFunction: [Function] }
See: #4 for more details.