2017-05-22 16:06:06 +03:00
|
|
|
let theLocale;
|
2017-05-03 03:04:16 +03:00
|
|
|
|
2017-05-22 16:06:06 +03:00
|
|
|
export function setLocale(locale) {
|
|
|
|
theLocale = locale;
|
|
|
|
}
|
2017-05-03 03:04:16 +03:00
|
|
|
|
2017-05-22 16:06:06 +03:00
|
|
|
export function getLocale() {
|
|
|
|
return theLocale;
|
|
|
|
}
|
2023-06-01 00:43:39 +03:00
|
|
|
|
|
|
|
export function onProviderError(error) {
|
|
|
|
// Silent the error, like upstream does
|
|
|
|
if(process.env.NODE_ENV === 'production') return;
|
|
|
|
|
|
|
|
// This browser does not advertise Intl support for this locale, we only print a warning
|
|
|
|
// As-per the spec, the browser should select the best matching locale
|
|
|
|
if(typeof error === "object" && error.message.match("MISSING_DATA")) {
|
|
|
|
console.warn(error.message);
|
|
|
|
}
|
|
|
|
|
|
|
|
console.error(error);
|
|
|
|
}
|