2017-05-22 22:06:06 +09:00
|
|
|
let theLocale;
|
2017-05-03 09:04:16 +09:00
|
|
|
|
2017-05-22 22:06:06 +09:00
|
|
|
export function setLocale(locale) {
|
|
|
|
theLocale = locale;
|
|
|
|
}
|
2017-05-03 09:04:16 +09:00
|
|
|
|
2017-05-22 22:06:06 +09:00
|
|
|
export function getLocale() {
|
|
|
|
return theLocale;
|
|
|
|
}
|
2023-06-01 06:43:39 +09: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);
|
|
|
|
}
|