2023-03-07 23:12:41 +00:00
|
|
|
import { FluxDispatcher, moment } from "@metro/common";
|
2024-02-28 14:09:42 +08:00
|
|
|
import logger from "@lib/utils/logger";
|
2023-03-07 23:12:41 +00:00
|
|
|
|
|
|
|
|
function onDispatch({ locale }: { locale: string }) {
|
|
|
|
|
// Timestamps
|
|
|
|
|
try {
|
|
|
|
|
// TODO: Test if this works with all locales
|
|
|
|
|
moment.locale(locale.toLowerCase());
|
|
|
|
|
} catch(e) {
|
|
|
|
|
logger.error("Failed to fix timestamps...", e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// We're done here!
|
2023-03-08 20:49:41 +00:00
|
|
|
FluxDispatcher.unsubscribe("I18N_LOAD_SUCCESS", onDispatch);
|
2023-03-07 23:12:41 +00:00
|
|
|
}
|
|
|
|
|
|
2023-03-08 20:49:41 +00:00
|
|
|
export default () => FluxDispatcher.subscribe("I18N_LOAD_SUCCESS", onDispatch);
|