dojo / webpack-contrib

Plugins and loaders for webpack used with Dojo
Other
4 stars 19 forks source link

CLDR loader can attempt to require cldr-data that does not exist #252

Closed agubler closed 4 years ago

agubler commented 4 years ago

Bug

In certain scenario's the cldr loader can attempt to load cldr-data that is does not exist, this can be due to incorrect casing of the locale or that data itself is not available.

We should/could probably do some normalisation of the configured locales:

1) Check if cldr-data exists for the locale (by looking at the directories in cldr-data/main?) 1) If exists, convert the import/require to use the correct locale casing, eg if en-gb is passed, which is a valid locale it will us en-GB to require the cldr-data. 1) if doesn't exist, use cldr to determine the correct language to use. I.e. using the attributes from new Cldr(locale).

When setting locale loaders with i18n, normalise the locales to lower case - This would need a complimentary change in i18n to lowercase locales passed.