@braze/web-sdk
Version:
Braze SDK for web sites and other JS platforms.
36 lines (35 loc) • 889 B
JavaScript
import { logger as E } from "../../shared-lib/index.js";
import zt from "../common/translations.js";
export default class lr {
constructor(t, e = !1) {
if (
((this.language = t),
null != t && (t = t.toLowerCase()),
null != t && null == zt[t])
) {
const e = t.indexOf("-");
e > 0 && (t = t.substring(0, e));
}
if (null == zt[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 ? E.error(a) : E.info(a), (t = "en");
}
this.language = t;
}
get(t) {
return zt[this.language][t];
}
Ho() {
switch (this.language) {
case "ar":
case "he":
case "fa":
return "rtl";
default:
return "ltr";
}
}
}