mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 09:33:21 -08:00
1 parent
45ec17798f
commit
2fc9d4d3e9
144 files changed
+732
-1472
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import { mergeDeep } from '../utils';
|
||||
import zhCn from './zh-cn';
|
||||
|
||||
export default class I18n {
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
|
||||
this.languages = {
|
||||
'zh-cn': zhCn,
|
||||
};
|
||||
|
||||
this.language = {};
|
||||
|
||||
this.update(art.option.i18n);
|
||||
}
|
||||
|
||||
init() {
|
||||
const lang = this.art.option.lang.toLowerCase();
|
||||
this.language = this.languages[lang] ?? {};
|
||||
}
|
||||
|
||||
get(key) {
|
||||
return this.language[key] ?? key;
|
||||
}
|
||||
|
||||
update(value) {
|
||||
this.languages = mergeDeep(this.languages, value);
|
||||
this.init();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user