This commit is contained in:
Harvey Zack committed 2018-10-21 14:20:35 +08:00
1 parent 1b3b2de8d4
commit 0c6a297ee7
12 files changed
+374 -308

No files matched your search

+20 -10
View File
@@ -1,32 +1,42 @@
const i18nMap = {
let i18nMap = {
'zh-cn': {
'About author': '关于作者',
'Video info': '视频统计信息',
'Close': '关闭',
'Video load failed': '视频加载失败',
'Fast forward 10 seconds': '快进10秒',
'Rewind 10 seconds': '快退10秒',
'10% increase in volume': '音量增加10%',
'10% reduction in volume': '音量减少10%'
'Volume': '音量',
'Start': '开始',
'Pause': '暂停',
'Rate': '速度'
},
'zh-tw': {
'About author': '關於作者',
'Video info': '影片統計訊息',
'Close': '關閉',
'Video load failed': '影片載入失敗',
'Fast forward 10 seconds': '快進10秒',
'Rewind 10 seconds': '快退10秒',
'10% increase in volume': '音量增加10%',
'10% reduction in volume': '音量減少10%'
'Volume': '音量',
'Start': '開始',
'Pause': '暫停',
'Rate': '速度'
}
};
export default class I18n {
constructor({ option }) {
this.language = i18nMap[option.lang.toLowerCase()] || {};
this.option = option;
this.init();
}
init() {
this.language = i18nMap[this.option.lang.toLowerCase()] || {};
}
get(key) {
return this.language[key] || key;
}
update(callback) {
i18nMap = callback(i18nMap);
this.init();
}
}