adjustment

This commit is contained in:
2023-07-27 10:03:53 +08:00
parent 3e9ee59178
commit 29209a3a00
17 changed files with 456 additions and 173 deletions

View File

@ -98,7 +98,7 @@ function applyLanguage(dom, result) {
}
}
async function init(dom = document.body, options = {}) {
export async function init(dom = document.body, options = {}) {
const lgid = getCurrentLgId();
let lgres = localStorage.getItem(getStorageKey(lgid));
let result;
@ -139,14 +139,14 @@ async function init(dom = document.body, options = {}) {
}
}
function r(key, defaultValue) {
export function r(key, defaultValue) {
if (cache != null) {
return getLanguage(cache, key, defaultValue);
}
return defaultValue;
}
const lang = {
export const lang = {
get current() {
return getCurrentLgId();
},
@ -156,10 +156,4 @@ const lang = {
get savedSuccessfully() {
return r('savedSuccessfully', 'Saved successfully.');
}
}
export {
init,
r,
lang
}