Skip to content

Commit 4534995

Browse files
committed
jyutping depends on chinese-addons
1 parent 14f6458 commit 4534995

File tree

4 files changed

+49
-6
lines changed

4 files changed

+49
-6
lines changed

src/InfoIcon.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script lang="ts">
2+
export default {
3+
name: 'MaterialSymbolsInfo',
4+
}
5+
</script>
6+
7+
<template>
8+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><!-- Icon from Material Symbols by Google - https://github.com/google/material-design-icons/blob/master/LICENSE --><path fill="currentColor" d="M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22" /></svg>
9+
</template>

src/MustInstall.vue

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<script setup lang="ts">
2+
import { NIcon, NTooltip } from 'naive-ui'
3+
import { t } from './i18n'
4+
import InfoIcon from './InfoIcon.vue'
5+
6+
defineProps<{
7+
plugin?: string
8+
}>()
9+
</script>
10+
11+
<template>
12+
<div style="display: flex; align-items: center; gap: 8px">
13+
<slot />
14+
<NTooltip v-if="plugin" trigger="click">
15+
<template #trigger>
16+
<NIcon size="16px">
17+
<InfoIcon />
18+
</NIcon>
19+
</template>
20+
{{ t('Must install {plugin}', { plugin }) }}
21+
</NTooltip>
22+
</div>
23+
</template>

src/PluginManager.vue

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<script setup lang="ts">
22
import type { UploadFileInfo } from 'naive-ui'
3-
import { NA, NFlex, NList, NListItem, NUpload, NUploadDragger, useMessage } from 'naive-ui'
3+
import { NA, NFlex, NList, NListItem, NText, NUpload, NUploadDragger, useMessage } from 'naive-ui'
44
import { computed, ref } from 'vue'
55
import { t } from './i18n'
6+
import MustInstall from './MustInstall.vue'
67
78
defineProps<{
89
disabled: boolean
@@ -14,7 +15,7 @@ function getInstalledPlugins() {
1415
return window.fcitx.getInstalledPlugins().sort()
1516
}
1617
17-
const allPlugins = ['anthy', 'chewing', 'chinese-addons', 'hallelujah', 'hangul', 'lua', 'm17n', 'mozc', 'rime', 'sayura', 'skk', 'thai', 'unikey']
18+
const allPlugins = ['anthy', 'chewing', 'chinese-addons', 'hallelujah', 'hangul', 'jyutping', 'lua', 'm17n', 'mozc', 'rime', 'sayura', 'skk', 'thai', 'unikey']
1819
const installedPlugins = ref<string[]>(getInstalledPlugins())
1920
const availablePlugins = computed(() => allPlugins.filter(plugin => !installedPlugins.value.includes(plugin)))
2021
@@ -54,17 +55,26 @@ async function onUpload(files: UploadFileInfo[]) {
5455
{{ t('Installed') }}
5556
</template>
5657
<NListItem v-for="plugin in installedPlugins" :key="plugin">
57-
{{ plugin }}
58+
<MustInstall v-if="plugin === 'jyutping' && !installedPlugins.includes('chinese-addons')" plugin="chinese-addons">
59+
<NText delete>
60+
{{ plugin }}
61+
</NText>
62+
</MustInstall>
63+
<template v-else>
64+
{{ plugin }}
65+
</template>
5866
</NListItem>
5967
</NList>
6068
<NList style="min-width: 100px">
6169
<template #header>
6270
{{ t('Available') }}
6371
</template>
6472
<NListItem v-for="plugin in availablePlugins" :key="plugin">
65-
<NA :href="`https://github.com/fcitx-contrib/fcitx5-plugins/releases/download/js/${plugin}.zip`">
66-
{{ plugin }}
67-
</NA>
73+
<MustInstall :plugin="plugin === 'jyutping' ? 'chinese-addons' : undefined">
74+
<NA :href="`https://github.com/fcitx-contrib/fcitx5-plugins/releases/download/js/${plugin}.zip`">
75+
{{ plugin }}
76+
</NA>
77+
</MustInstall>
6878
</NListItem>
6979
</NList>
7080
</NFlex>

src/locales/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"Input Method": "输入法",
1111
"Installed": "已安装",
1212
"Installed {plugin}": "已安装 {plugin}",
13+
"Must install {plugin}": "必须安装 {plugin}",
1314
"Only show current language": "只显示当前语言",
1415
"OK": "确定",
1516
"Plugin Manager": "插件管理器",

0 commit comments

Comments
 (0)