JQuery/Globalize: Method for finding best matching locale?

104 Views Asked by At

As an example I have loaded following locales:

  • en
  • de
  • de-CH

As code: Globalize.load( require('cldr-data').entireMainFor('en', 'de', 'de-CH')); When I call const globalize = Globalize(locale); without having set locale loaded I get e.g. Error: Cannot find module './de-AT'

This means that I have to choose one of the existing locales:

  • de-CH -> choose de-CH
  • de-AT -> choose de
  • en-Latn-US -> choose en
  • it -> choose en

Since everybody needs this piece of code I expected this to exist in the library. Could you point me to a proper implementation?

0

There are 0 best solutions below