decord/source/intl/IntlLoaderStore.tsx

126 lines
3.8 KiB
TypeScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 1922
2026-07-24 07:16:23 +00:00
// Function ID: 21751
2026-07-20 16:05:17 +00:00
// Name: _setAppLocale
2026-07-23 10:11:24 +00:00
// Dependencies: [5, 677, 1923, 1212, 1933, 1250, 3204, 3679, 3710, 3712, 1184, 2]
2026-07-20 16:05:17 +00:00
// Exports: setAppLocale, subscribeToIntlLoadingSuccess, useLocaleData
// Module 1922 (_setAppLocale)
2026-07-23 10:11:24 +00:00
import module_1250 from "module_1250";
import useStoreWithEqualityFn from "useStoreWithEqualityFn";
const require = arg1;
async function _setAppLocale(arg0, arg1) {
let closure_0 = arg0;
2026-07-20 16:05:17 +00:00
let state;
2026-07-23 10:11:24 +00:00
state = outer2_4.getState();
state.setLoadingStarted(arg0);
2026-07-20 16:05:17 +00:00
const items = [];
2026-07-23 10:11:24 +00:00
const intl = outer2_0(outer2_2[3]).intl;
intl.setLocale(arg0);
2026-07-20 16:05:17 +00:00
items.push();
2026-07-23 10:11:24 +00:00
items.push(outer2_3(async () => {
yield outer4_0(outer4_2[4]).preloadAllIntlMessageFiles();
const obj = outer4_0(outer4_2[4]);
yield outer4_0(outer4_2[5]).loadAllMessagesInLocale(outer1_0);
2026-07-20 16:05:17 +00:00
})());
2026-07-23 10:11:24 +00:00
items.push((function loadDateFnsLocale(locale) {
return outer3_6(...arguments);
})(arg0));
items.push((function loadFormatJsLocale(locale) {
return outer3_7(...arguments);
})(arg0));
items.push((function setMomentLocale(locale) {
return outer3_8(...arguments);
})(arg0));
outer2_0(outer2_2[10]).default.setTags({ locale: arg0 });
2026-07-20 16:05:17 +00:00
items.push(Promise.resolve());
2026-07-23 10:11:24 +00:00
yield Promise.all(items).catch((error) => state.setLoadingFailed(error, closure_0));
state.setLoadingSucceeded(arg0);
2026-07-20 16:05:17 +00:00
}
async function _loadDateFnsLocale(arg0, arg1) {
2026-07-23 10:11:24 +00:00
const state = outer2_4.getState();
const tmp = outer2_0(outer2_2[6]).dateFnsLocales[arg0];
2026-07-20 16:05:17 +00:00
if (null != tmp) {
state.setLocaleData(yield tmp());
} else {
2026-07-23 10:11:24 +00:00
state.setLocaleData(outer2_1(outer2_2[2]));
2026-07-20 16:05:17 +00:00
}
}
async function _loadFormatJsLocale(arg0, arg1) {
2026-07-23 10:11:24 +00:00
const tmp = outer2_0(outer2_2[7]).formatjsLocales[arg0];
2026-07-20 16:05:17 +00:00
if (null != tmp) {
yield tmp();
}
}
async function _setMomentLocale(arg0, arg1) {
let length;
2026-07-23 10:11:24 +00:00
const tmp = outer2_0(outer2_2[8]).momentLocales[arg0];
2026-07-20 16:05:17 +00:00
if (null != tmp) {
yield tmp();
}
const items = [];
let str = "nb";
if ("no" !== arg0) {
str = arg0;
}
const parts = str.split("-");
if (parts.length > 0) {
do {
let arr = items.push(parts.join("-"));
arr = parts.pop();
length = parts.length;
} while (length > 0);
}
items.push("en-US");
2026-07-23 10:11:24 +00:00
outer2_0(outer2_2[9]).locale(items);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const withEqualityFn = useStoreWithEqualityFn.createWithEqualityFn((arg0, arg1) => {
let closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const importDefault = arg1;
return {
isLoading: false,
inProgressLocale: undefined,
error: undefined,
2026-07-23 10:11:24 +00:00
localeData: importDefault(1923),
2026-07-20 16:05:17 +00:00
setLoadingStarted(inProgressLocale) {
2026-07-23 10:11:24 +00:00
return callback({ isLoading: true, inProgressLocale });
2026-07-20 16:05:17 +00:00
},
setLoadingSucceeded(locale) {
2026-07-23 10:11:24 +00:00
if (callback2().inProgressLocale === locale) {
2026-07-20 16:05:17 +00:00
const obj = { isLoading: false, inProgressLocale: undefined, error: undefined };
2026-07-23 10:11:24 +00:00
callback(obj);
2026-07-20 16:05:17 +00:00
}
},
2026-07-23 10:11:24 +00:00
setLoadingFailed(error, closure_0) {
if (callback2().inProgressLocale === closure_0) {
2026-07-20 16:05:17 +00:00
const obj = { isLoading: false, inProgressLocale: undefined, error };
2026-07-23 10:11:24 +00:00
callback(obj);
2026-07-20 16:05:17 +00:00
}
},
setLocaleData(localeData) {
2026-07-23 10:11:24 +00:00
callback({ localeData });
2026-07-20 16:05:17 +00:00
}
};
});
2026-07-23 10:11:24 +00:00
const result = require("module_1923").fileFinishedImporting("intl/IntlLoaderStore.tsx");
2026-07-20 16:05:17 +00:00
export const useIntlLoaderStore = withEqualityFn;
export const subscribeToIntlLoadingSuccess = function subscribeToIntlLoadingSuccess(arg0) {
2026-07-23 10:11:24 +00:00
let closure_0 = arg0;
2026-07-20 16:05:17 +00:00
return withEqualityFn.subscribe((inProgressLocale, inProgressLocale2) => {
if (tmp) {
2026-07-23 10:11:24 +00:00
callback(inProgressLocale2.inProgressLocale);
2026-07-20 16:05:17 +00:00
}
});
};
export const setAppLocale = function setAppLocale() {
return _setAppLocale(...arguments);
};
export const useLocaleData = function useLocaleData() {
let tmp = withEqualityFn((localeData) => localeData.localeData);
if (null == tmp) {
2026-07-23 10:11:24 +00:00
tmp = importDefault(1923);
2026-07-20 16:05:17 +00:00
}
return tmp;
};