mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-29 02:51:20 -08:00
优化整体结构
This commit is contained in:
1 parent
9f9cb0e036
commit
487e865017
34 files changed
+505
-427
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import { mergeDeep } from '../utils';
|
||||
import zhCn from './zh-cn';
|
||||
import zhTw from './zh-tw';
|
||||
|
||||
export default class I18n {
|
||||
constructor(art) {
|
||||
this.art = art;
|
||||
this.languages = {
|
||||
'zh-cn': zhCn,
|
||||
'zh-tw': zhTw,
|
||||
};
|
||||
this.init();
|
||||
}
|
||||
|
||||
init() {
|
||||
this.language = this.languages[this.art.option.lang.toLowerCase()] || {};
|
||||
}
|
||||
|
||||
get(key) {
|
||||
return this.language[key] || key;
|
||||
}
|
||||
|
||||
update(value) {
|
||||
this.languages = mergeDeep(this.languages, value);
|
||||
this.init();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user