react-native-web-internals
Version:
React Native for Web
92 lines (91 loc) • 2.03 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: !0 });
}, __copyProps = (to, from, except, desc) => {
if (from && typeof from == "object" || typeof from == "function")
for (let key of __getOwnPropNames(from))
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
var isLocaleRTL_exports = {};
__export(isLocaleRTL_exports, {
isLocaleRTL: () => isLocaleRTL
});
module.exports = __toCommonJS(isLocaleRTL_exports);
const rtlScripts = /* @__PURE__ */ new Set([
"Arab",
"Syrc",
"Samr",
"Mand",
"Thaa",
"Mend",
"Nkoo",
"Adlm",
"Rohg",
"Hebr"
]), rtlLangs = /* @__PURE__ */ new Set([
"ae",
// Avestan
"ar",
// Arabic
"arc",
// Aramaic
"bcc",
// Southern Balochi
"bqi",
// Bakthiari
"ckb",
// Sorani
"dv",
// Dhivehi
"fa",
"far",
// Persian
"glk",
// Gilaki
"he",
"iw",
// Hebrew
"khw",
// Khowar
"ks",
// Kashmiri
"ku",
// Kurdish
"mzn",
// Mazanderani
"nqo",
// N'Ko
"pnb",
// Western Punjabi
"ps",
// Pashto
"sd",
// Sindhi
"ug",
// Uyghur
"ur",
// Urdu
"yi"
// Yiddish
]), cache = /* @__PURE__ */ new Map();
function isLocaleRTL(locale) {
const cachedRTL = cache.get(locale);
if (cachedRTL)
return cachedRTL;
let isRTL = !1;
if (Intl.Locale) {
const script = new Intl.Locale(locale).maximize().script;
isRTL = rtlScripts.has(script);
} else {
const lang = locale.split("-")[0];
isRTL = rtlLangs.has(lang);
}
return cache.set(locale, isRTL), isRTL;
}
//# sourceMappingURL=isLocaleRTL.js.map