@braze/web-sdk
Version:
Braze SDK for web sites and other JS platforms.
36 lines (35 loc) • 889 B
JavaScript
import { logger as N } from "../../shared-lib/index.js";
import xt from "../common/translations.js";
export default class lr {
constructor(t, e = !1) {
if (
((this.language = t),
null != t && (t = t.toLowerCase()),
null != t && null == xt[t])
) {
const e = t.indexOf("-");
e > 0 && (t = t.substring(0, e));
}
if (null == xt[t]) {
const a =
"Braze does not yet have a localization for language " +
t +
", defaulting to English. Please contact us if you are willing and able to help us translate our SDK into this language.";
e ? N.error(a) : N.info(a), (t = "en");
}
this.language = t;
}
get(t) {
return xt[this.language][t];
}
Oo() {
switch (this.language) {
case "ar":
case "he":
case "fa":
return "rtl";
default:
return "ltr";
}
}
}