mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-23 13:33:10 +02:00
enhance(frontend) 日本語の拡張絵文字辞書を追加 (#12855)
* Create ja-JP.json * Update general.vue * Update ja-JP.json * Update ja-JP.json * Update ja-JP.json * fix * fix design * (Add) ひらがな [wip] * fix lint * Apply suggestions from code review Co-authored-by: 1Step621 <86859447+1STEP621@users.noreply.github.com> * (add) ja-JP_hira Co-authored-by: 1Step621 <86859447+1STEP621@users.noreply.github.com> * (enhance) 言語名をちゃんと表示するように --------- Co-authored-by: 1Step621 <86859447+1STEP621@users.noreply.github.com>
This commit is contained in:
parent
ec4e57bb67
commit
0ea8e0c25c
3 changed files with 3751 additions and 5 deletions
|
@ -206,9 +206,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<div class="_gaps">
|
||||
<MkFolder>
|
||||
<template #label>{{ i18n.ts.additionalEmojiDictionary }}</template>
|
||||
<div v-for="lang in emojiIndexLangs" class="_buttons">
|
||||
<MkButton @click="downloadEmojiIndex(lang)"><i class="ti ti-download"></i> {{ lang }}{{ defaultStore.reactiveState.additionalUnicodeEmojiIndexes.value[lang] ? ` (${ i18n.ts.installed })` : '' }}</MkButton>
|
||||
<MkButton v-if="defaultStore.reactiveState.additionalUnicodeEmojiIndexes.value[lang]" danger @click="removeEmojiIndex(lang)"><i class="ti ti-trash"></i> {{ i18n.ts.remove }}</MkButton>
|
||||
<div class="_buttons">
|
||||
<template v-for="lang in emojiIndexLangs" :key="lang">
|
||||
<MkButton v-if="defaultStore.reactiveState.additionalUnicodeEmojiIndexes.value[lang]" danger @click="removeEmojiIndex(lang)"><i class="ti ti-trash"></i> {{ i18n.ts.remove }} ({{ getEmojiIndexLangName(lang) }})</MkButton>
|
||||
<MkButton v-else @click="downloadEmojiIndex(lang)"><i class="ti ti-download"></i> {{ getEmojiIndexLangName(lang) }}{{ defaultStore.reactiveState.additionalUnicodeEmojiIndexes.value[lang] ? ` (${ i18n.ts.installed })` : '' }}</MkButton>
|
||||
</template>
|
||||
</div>
|
||||
</MkFolder>
|
||||
<FormLink to="/settings/deck">{{ i18n.ts.deck }}</FormLink>
|
||||
|
@ -338,15 +340,29 @@ watch([
|
|||
await reloadAsk();
|
||||
});
|
||||
|
||||
const emojiIndexLangs = ['en-US'];
|
||||
const emojiIndexLangs = ['en-US', 'ja-JP', 'ja-JP_hira'] as const;
|
||||
|
||||
function downloadEmojiIndex(lang: string) {
|
||||
function getEmojiIndexLangName(targetLang: typeof emojiIndexLangs[number]) {
|
||||
if (langs.find(x => x[0] === targetLang)) {
|
||||
return langs.find(x => x[0] === targetLang)![1];
|
||||
} else {
|
||||
// 絵文字辞書限定の言語定義
|
||||
switch (targetLang) {
|
||||
case 'ja-JP_hira': return 'ひらがな';
|
||||
default: return targetLang;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function downloadEmojiIndex(lang: typeof emojiIndexLangs[number]) {
|
||||
async function main() {
|
||||
const currentIndexes = defaultStore.state.additionalUnicodeEmojiIndexes;
|
||||
|
||||
function download() {
|
||||
switch (lang) {
|
||||
case 'en-US': return import('../../unicode-emoji-indexes/en-US.json').then(x => x.default);
|
||||
case 'ja-JP': return import('../../unicode-emoji-indexes/ja-JP.json').then(x => x.default);
|
||||
case 'ja-JP_hira': return import('../../unicode-emoji-indexes/ja-JP_hira.json').then(x => x.default);
|
||||
default: throw new Error('unrecognized lang: ' + lang);
|
||||
}
|
||||
}
|
||||
|
|
1865
packages/frontend/src/unicode-emoji-indexes/ja-JP.json
Normal file
1865
packages/frontend/src/unicode-emoji-indexes/ja-JP.json
Normal file
File diff suppressed because it is too large
Load diff
1865
packages/frontend/src/unicode-emoji-indexes/ja-JP_hira.json
Normal file
1865
packages/frontend/src/unicode-emoji-indexes/ja-JP_hira.json
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue