UNPKG

@adyen/adyen-platform-experience-web

Version:

![Platform Experience header](https://github.com/Adyen/adyen-platform-experience-web/assets/7926613/18094965-9e01-450e-8dc9-ea84e6b22c2b)

38 lines (37 loc) 1.18 kB
import i from "./Localization.js"; import { loadTranslations as a, formatLocale as l, parseLocale as n } from "./utils.js"; import { FALLBACK_LOCALE as c, EXCLUDE_PROPS as p } from "./constants/localization.js"; import { struct as f } from "../../utils/struct/main.js"; import { isFunction as s } from "../../utils/value/is.js"; function h() { let o = this.locale, r = o, t = [...this.supportedLocales]; return f({ load: { value: (e) => a(o, this.preferredTranslations, e) }, locale: { get: () => o, set: (e) => { r = e, o = l(e) || n(e, t) || c; } }, supportedLocales: { get: () => t, set(e) { t = e, this.locale = r; } } }); } function b() { var r; const o = {}; for (const [t, e] of Object.entries(Object.getOwnPropertyDescriptors(i.prototype))) p.includes(t) || (s(e.get) ? o[t] = { get: e.get.bind(this), ...t === "timezone" && { set: (r = e.set) == null ? void 0 : r.bind(this) } } : s(e.value) ? o[t] = { value: e.value.bind(this) } : o[t] = { get: () => this[t] }); return o; } export { h as createTranslationsLoader, b as getLocalizationProxyDescriptors };