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:
かっこかり 2024-01-14 16:04:48 +09:00 committed by GitHub
parent ec4e57bb67
commit 0ea8e0c25c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3751 additions and 5 deletions

View File

@ -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);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff