eversport / intl-codegen

generate code and type definitions from translations
MIT License
15 stars 1 forks source link

Do not throw on invalid language tags #39

Closed Swatinem closed 5 years ago

Swatinem commented 5 years ago

When using loadLanguage(["*"]), I get the following error:

    RangeError: Invalid language tag: *
        at new NumberFormat (native)

We should try/catch that if possible and make sure that loadLanguage never throws.

Discovered using headless puppeteer, as that does not send any Accept-Language header… https://github.com/GoogleChrome/puppeteer/issues/665#issuecomment-356634721