customerio-gist-web
Version:
Build beautiful in-app flows with no code and deliver them instantly to your app. http://customer.io
16 lines (14 loc) • 529 B
JavaScript
import { log } from '../utilities/log';
import { setKeyToLocalStore, getKeyFromLocalStore } from '../utilities/local-storage';
const userLocaleLocalStoreName = "gist.web.userLocale";
export function getUserLocale() {
if (getKeyFromLocalStore(userLocaleLocalStoreName) !== null) {
return getKeyFromLocalStore(userLocaleLocalStoreName);
} else {
return navigator.language;
}
}
export function setUserLocale(locale) {
setKeyToLocalStore(userLocaleLocalStoreName, locale);
log(`Set user locate to "${locale}"`);
}