Skip to content

Commit

Permalink
feat(options): add displaying supported languages
Browse files Browse the repository at this point in the history
  • Loading branch information
crimx committed May 28, 2018
1 parent c39151e commit 6bb345e
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 25 deletions.
35 changes: 25 additions & 10 deletions src/_locales/options/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,21 @@
"zh_CN": "查词面板最高占屏幕比例",
"zh_TW": "查字典介面最高占螢幕高度比例"
},
"dict_panel_lang_en": {
"en": "En",
"zh_CN": "",
"zh_TW": ""
},
"dict_panel_lang_zhs": {
"en": "Zhs",
"zh_CN": "",
"zh_TW": ""
},
"dict_panel_lang_zht": {
"en": "Zht",
"zh_CN": "",
"zh_TW": ""
},
"dict_panel_title": {
"en": "Dict Panel",
"zh_CN": "查词面板",
Expand Down Expand Up @@ -164,6 +179,16 @@
"zh_CN": "词典设置",
"zh_TW": "字典設定"
},
"export": {
"en": "Reset",
"zh_CN": "导出设定",
"zh_TW": "匯出設定"
},
"import": {
"en": "Import",
"zh_CN": "导入设定",
"zh_TW": "匯入設定"
},
"instructions": {
"en": "Instructions",
"zh_CN": "使用说明",
Expand Down Expand Up @@ -319,16 +344,6 @@
"zh_CN": "重置设定",
"zh_TW": "重置設定"
},
"import": {
"en": "Import",
"zh_CN": "导入设定",
"zh_TW": "匯入設定"
},
"export": {
"en": "Reset",
"zh_CN": "导出设定",
"zh_TW": "匯出設定"
},
"reset_modal_content": {
"en": "Reset to default settings. Confirm?",
"zh_CN": "所有设定将还原到默认值,确定?",
Expand Down
80 changes: 80 additions & 0 deletions src/app-config/dicts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { DeepReadonly } from '@/typings/helpers'
export function getALlDicts () {
const allDicts = {
bing: {
/**
* Supported language: en, zh-CN, zh-TW
* `1` for supported
*/
lang: '110',
/**
* Full content page to jump to when user clicks the title.
* %s will be replaced with the current word.
Expand Down Expand Up @@ -38,6 +43,11 @@ export function getALlDicts () {
}
},
cambridge: {
/**
* Supported language: en, zh-CN, zh-TW
* `1` for supported
*/
lang: '111',
/**
* Full content page to jump to when user clicks the title.
* %s will be replaced with the current word.
Expand Down Expand Up @@ -69,6 +79,11 @@ export function getALlDicts () {
},
},
cobuild: {
/**
* Supported language: en, zh-CN, zh-TW
* `1` for supported
*/
lang: '100',
/**
* Full content page to jump to when user clicks the title.
* %s will be replaced with the current word.
Expand Down Expand Up @@ -100,6 +115,11 @@ export function getALlDicts () {
}
},
etymonline: {
/**
* Supported language: en, zh-CN, zh-TW
* `1` for supported
*/
lang: '100',
/**
* Full content page to jump to when user clicks the title.
* %s will be replaced with the current word.
Expand Down Expand Up @@ -131,6 +151,11 @@ export function getALlDicts () {
}
},
eudic: {
/**
* Supported language: en, zh-CN, zh-TW
* `1` for supported
*/
lang: '110',
/**
* Full content page to jump to when user clicks the title.
* %s will be replaced with the current word.
Expand Down Expand Up @@ -162,6 +187,11 @@ export function getALlDicts () {
}
},
google: {
/**
* Supported language: en, zh-CN, zh-TW
* `1` for supported
*/
lang: '111',
/**
* Full content page to jump to when user clicks the title.
* %s will be replaced with the current word.
Expand Down Expand Up @@ -189,6 +219,11 @@ export function getALlDicts () {
}
},
guoyu: {
/**
* Supported language: en, zh-CN, zh-TW
* `1` for supported
*/
lang: '001',
/**
* Full content page to jump to when user clicks the title.
* %s will be replaced with the current word.
Expand Down Expand Up @@ -216,6 +251,11 @@ export function getALlDicts () {
}
},
liangan: {
/**
* Supported language: en, zh-CN, zh-TW
* `1` for supported
*/
lang: '001',
/**
* Full content page to jump to when user clicks the title.
* %s will be replaced with the current word.
Expand Down Expand Up @@ -243,6 +283,11 @@ export function getALlDicts () {
}
},
longman: {
/**
* Supported language: en, zh-CN, zh-TW
* `1` for supported
*/
lang: '100',
/**
* Full content page to jump to when user clicks the title.
* %s will be replaced with the current word.
Expand Down Expand Up @@ -280,6 +325,11 @@ export function getALlDicts () {
}
},
macmillan: {
/**
* Supported language: en, zh-CN, zh-TW
* `1` for supported
*/
lang: '100',
/**
* Full content page to jump to when user clicks the title.
* %s will be replaced with the current word.
Expand Down Expand Up @@ -311,6 +361,11 @@ export function getALlDicts () {
}
},
oald: {
/**
* Supported language: en, zh-CN, zh-TW
* `1` for supported
*/
lang: '100',
/**
* Full content page to jump to when user clicks the title.
* %s will be replaced with the current word.
Expand Down Expand Up @@ -342,6 +397,11 @@ export function getALlDicts () {
},
},
urban: {
/**
* Supported language: en, zh-CN, zh-TW
* `1` for supported
*/
lang: '100',
/**
* Full content page to jump to when user clicks the title.
* %s will be replaced with the current word.
Expand Down Expand Up @@ -373,6 +433,11 @@ export function getALlDicts () {
}
},
vocabulary: {
/**
* Supported language: en, zh-CN, zh-TW
* `1` for supported
*/
lang: '100',
/**
* Full content page to jump to when user clicks the title.
* %s will be replaced with the current word.
Expand Down Expand Up @@ -400,6 +465,11 @@ export function getALlDicts () {
}
},
websterlearner: {
/**
* Supported language: en, zh-CN, zh-TW
* `1` for supported
*/
lang: '100',
/**
* Full content page to jump to when user clicks the title.
* %s will be replaced with the current word.
Expand Down Expand Up @@ -435,6 +505,11 @@ export function getALlDicts () {
},
},
youdao: {
/**
* Supported language: en, zh-CN, zh-TW
* `1` for supported
*/
lang: '110',
/**
* Full content page to jump to when user clicks the title.
* %s will be replaced with the current word.
Expand Down Expand Up @@ -471,6 +546,11 @@ export function getALlDicts () {
}
},
zdic: {
/**
* Supported language: en, zh-CN, zh-TW
* `1` for supported
*/
lang: '010',
/**
* Full content page to jump to when user clicks the title.
* %s will be replaced with the current word.
Expand Down
28 changes: 15 additions & 13 deletions src/options/OptDicts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<div class="panel-list__header" @click="handleAddDict(id)">
<img class="panel-list__icon" :src="dictsPanelInfo[id].favicon">
<strong class="panel-list__title">{{ $t('dict:' + id) }}</strong>
<span class="panel-list__title-lang" v-if="+allDicts[id].lang[0]">{{ $t('opt:dict_panel_lang_en') }}</span>
<span class="panel-list__title-lang" v-if="+allDicts[id].lang[1]">{{ $t('opt:dict_panel_lang_zhs') }}</span>
<span class="panel-list__title-lang" v-if="+allDicts[id].lang[2]">{{ $t('opt:dict_panel_lang_zht') }}</span>
<button type="button" class="close">&#10004;</button>
</div>
</div>
Expand All @@ -47,6 +50,9 @@
<div class="panel-list__header" @click="handlePanelHeadClick(id, i)">
<img class="panel-list__icon" :src="dictsPanelInfo[id].favicon">
<strong class="panel-list__title">{{ $t('dict:' + id) }}</strong>
<span class="panel-list__title-lang" v-if="+allDicts[id].lang[0]">{{ $t('opt:dict_panel_lang_en') }}</span>
<span class="panel-list__title-lang" v-if="+allDicts[id].lang[1]">{{ $t('opt:dict_panel_lang_zhs') }}</span>
<span class="panel-list__title-lang" v-if="+allDicts[id].lang[2]">{{ $t('opt:dict_panel_lang_zht') }}</span>
<button type="button" class="close" @click.stop="dicts.selected.splice(i, 1)">&times;</button>
</div><!--词典名字与图标-->
<div class="panel-list__body" ref="dict" :style="{height: dictsPanelInfo[id].height + 'px'}">
Expand All @@ -73,20 +79,16 @@

<!--词典自定义选项-->
<div class="checkbox" v-if="allDicts[id].options">
<template v-for="(__, optKey) in allDicts[id].options">
<div class="checkbox" v-if="typeof allDicts[id].options[optKey] !== 'boolean'">
<div class="input-group">
<div class="input-group-addon">{{ $t(`dict:${id}_${optKey}`) }}</div>
<input type="number" min="0" class="form-control" v-model.number.lazy="allDicts[id].options[optKey]">
<div class="input-group-addon">{{ $t(`dict:${id}_${optKey}_unit`) }}</div>
</div>
<div v-for="(__, optKey) in allDicts[id].options" :key="optKey" class="checkbox" v-if="typeof allDicts[id].options[optKey] !== 'boolean'">
<div class="input-group">
<div class="input-group-addon">{{ $t(`dict:${id}_${optKey}`) }}</div>
<input type="number" min="0" class="form-control" v-model.number.lazy="allDicts[id].options[optKey]">
<div class="input-group-addon">{{ $t(`dict:${id}_${optKey}_unit`) }}</div>
</div>
</template>
<template v-for="(__, optKey) in allDicts[id].options">
<label class="checkbox-inline" v-if="typeof allDicts[id].options[optKey] === 'boolean'">
<input type="checkbox" v-model="allDicts[id].options[optKey]"> {{ $t(`dict:${id}_${optKey}`) }}
</label>
</template>
</div>
<label v-for="(__, optKey) in allDicts[id].options" :key="optKey" class="checkbox-inline" v-if="typeof allDicts[id].options[optKey] === 'boolean'">
<input type="checkbox" v-model="allDicts[id].options[optKey]"> {{ $t(`dict:${id}_${optKey}`) }}
</label>
</div><!--词典自定义选项-->
</div>
</div>
Expand Down
7 changes: 5 additions & 2 deletions src/options/Options.vue
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,11 @@ kbd {
cursor: move;
}
.panel-list__header {
cursor: move;
.panel-list__title-lang {
margin-left: 5px;
padding: 0 2px;
border: 1px solid #333;
border-radius: 2px;
}
.panel-list__icon {
Expand Down

0 comments on commit 6bb345e

Please sign in to comment.