wojtekmaj / get-user-locale

A function that returns user's locale as an IETF language tag, based on all available sources.
MIT License
58 stars 9 forks source link

Unsupported locales #16

Closed 0x54321 closed 1 year ago

0x54321 commented 3 years ago

Hi, thanks for the great package. 🙂

I've noticed a couple of errors in my site's error log due to getUserLocale strings that are incompatible with the Intl.NumberFormat constructor. The ones that I've seen so far are:

I'm not quite sure what systems are generating those locales, but they really should be filtered out, since they apparently aren't compatible with the Intl standard.

Cheers

wojtekmaj commented 3 years ago

Hi @0x54321, that's interesting! Do you have any more information, e.g. browser/OS on which these errors happened? That would be hugely helpful.

0x54321 commented 3 years ago

Some recent examples - "en-US,en" was generated by Mac OS X 10.15.3 / Safari 13.0.5 and Windows 10 / Firefox 81.0 "en-US@posix" was generated by Linux / Chrome 80.0.3987

I can't find the info for "C", but I think it was also Linux-related.

osdiab commented 3 years ago

I found one as well - Huawei's PetalBot search crawler apparently returns en-US.UTF-8 which blows up when you try to pass that to an Intl method.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days.