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)

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