decord/source/intl/util.tsx

76 lines
2.3 KiB
TypeScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 1237
// Function ID: 1238
// Name: getAvailableLocales
// Dependencies: [19, 1238, 1274, 1296, 2]
// Exports: getAvailableLocales, getLanguages, getNormalizedLocale, useSyncMessages
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
// Module 1237 (getAvailableLocales)
2026-08-24 06:08:38 +00:00
import closure_2 from "noop" /* 19 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("intl/util.tsx");
2026-07-20 16:05:17 +00:00
export const getAvailableLocales = function getAvailableLocales() {
2026-07-29 08:29:29 +00:00
_require = _require(1238).default;
const found = _require(1296).filter((enabled) => enabled.enabled);
2026-07-20 16:05:17 +00:00
const mapped = found.map((code) => {
code = code.code;
2026-07-29 08:29:29 +00:00
const obj = { value: code, name: code.name, localizedName: null };
2026-08-24 06:08:38 +00:00
const obj2 = dependencyMap(closure_1_1[2]);
2026-07-29 08:29:29 +00:00
obj[2] = dependencyMap[obj2.runtimeHashMessageKey(obj2, code)];
2026-07-20 16:05:17 +00:00
return obj;
});
return mapped.sort((name, name2) => {
const formatted = name.name.toLowerCase();
const formatted1 = name2.name.toLowerCase();
let num = -1;
if (formatted >= formatted1) {
let num2 = 0;
if (formatted > formatted1) {
num2 = 1;
}
num = num2;
}
return num;
});
};
2026-07-29 08:29:29 +00:00
export const getLanguages = function getLanguages() {
return require(1296) /* items */;
};
export const getNormalizedLocale = function getNormalizedLocale(str, arg1) {
const found = parts(1296).filter((enabled) => enabled.enabled);
2026-07-20 16:05:17 +00:00
const mapped = found.map((code) => code.code);
2026-07-29 08:29:29 +00:00
if (mapped.includes(str)) {
return str;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
parts = str.split("-");
2026-07-20 16:05:17 +00:00
const first = parts[0];
if (mapped.includes(parts[0])) {
2026-07-29 08:29:29 +00:00
let found2 = first;
2026-07-20 16:05:17 +00:00
} else {
if ("zh" === first) {
if (parts.length > 1) {
if ("Hant" === parts[1]) {
2026-07-29 08:29:29 +00:00
let found1 = mapped.find((arg0) => "zh-TW" === arg0);
if (found1 == null) {
found1 = arg1;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
found2 = found1;
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
found2 = mapped.find((arg0) => arg0.split("-")[0] === parts[0]);
if (found2 == null) {
found2 = arg1;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
return found2;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const arr = parts(1296);
2026-07-20 16:05:17 +00:00
};
export const useSyncMessages = function useSyncMessages(arg0, arg1) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
const syncExternalStore = closure_2.useSyncExternalStore((arg0) => closure_0.onChange(arg0), () => closure_0.isLocaleLoaded(currentLocale.currentLocale));
2026-07-20 16:05:17 +00:00
};