add pari settings and autoTranslateButton

This commit is contained in:
fly_mc 2024-10-18 22:03:41 +08:00
parent 1d48c39342
commit 7b1b5aeafb
8 changed files with 42 additions and 2 deletions

View file

@ -1279,6 +1279,7 @@ noteOfThisUser: "Notes by this user"
clipNoteLimitExceeded: "No more notes can be added to this clip."
timeTravel: "Time Travel"
timeTravelDescription: "Show posts before this date."
autoTranslateButton: "Display translation function on posts in different languages"
performance: "Performance"
modified: "Modified"
discard: "Discard"

View file

@ -1288,6 +1288,7 @@ passkeyVerificationFailed: "验证通行密钥失败。"
passkeyVerificationSucceededButPasswordlessLoginDisabled: "通行密钥验证成功,但账户未开启无密码登录。"
timeTravel: "时光机"
timeTravelDescription: "显示该日期以前的帖子"
autoTranslateButton: "在不同语言的帖文上显示翻译功能"
messageToFollower: "给关注者的消息"
target: "对象"
testCaptchaWarning: "此功能为测试 CAPTCHA 用。<strong>请勿在正式环境中使用。</strong>"

View file

@ -1288,6 +1288,7 @@ passkeyVerificationFailed: "驗證金鑰失敗。"
passkeyVerificationSucceededButPasswordlessLoginDisabled: "雖然驗證金鑰成功,但是無密碼登入的方式是停用的。"
timeTravel: "時光機"
timeTravelDescription: "回到指定的日期"
autoTranslateButton: "在不同語言的帖文上顯示翻譯功能"
messageToFollower: "給追隨者的訊息"
target: "目標 "
testCaptchaWarning: "此功能用於 CAPTCHA 的測試。<strong>請勿在正式環境中使用。</strong>"

View file

@ -80,7 +80,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:enableEmojiMenu="true"
:enableEmojiMenuReaction="true"
/>
<div v-if="$i.policies.canUseTranslator && appearNote.text && isForeignLanguage" style="padding-top: 5px; color: var(--MI_THEME-accent);">
<div v-if="defaultStore.state.autoTranslateButton && $i.policies.canUseTranslator && appearNote.text && isForeignLanguage" style="padding-top: 5px; color: var(--MI_THEME-accent);">
<button v-if="!(translating || translation)" ref="translateButton" class="_button" @click.stop="translate()"><i class="ti ti-language-hiragana"></i>{{ i18n.ts.translate }}</button>
<button v-else class="_button" @click.stop="translation= null">{{ i18n.ts.close }}</button>
</div>

View file

@ -92,7 +92,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:enableEmojiMenuReaction="true"
/>
<a v-if="appearNote.renote != null" :class="$style.rn">RN:</a>
<div v-if="$i.policies.canUseTranslator && appearNote.text && isForeignLanguage" style="padding-top: 5px; color: var(--MI_THEME-accent);">
<div v-if="defaultStore.state.autoTranslateButton && $i.policies.canUseTranslator && appearNote.text && isForeignLanguage" style="padding-top: 5px; color: var(--MI_THEME-accent);">
<button v-if="!(translating || translation)" ref="translateButton" class="_button" @click.stop="translate()"><i class="ti ti-language-hiragana"></i>{{ i18n.ts.translate }}</button>
<button v-else class="_button" @click.stop="translation= null">{{ i18n.ts.close }}</button>
</div>

View file

@ -130,6 +130,11 @@ const menuDef = computed(() => [{
text: i18n.ts.plugins,
to: '/settings/plugin',
active: currentPage.value?.route.name === 'plugin',
}, {
icon: 'ti ti-light-bulb',
text: 'Pari Cafe',
to: '/settings/pari',
active: currentPage.value?.route.name === 'pari',
}],
}, {
title: i18n.ts.otherSettings,

View file

@ -0,0 +1,28 @@
<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<div class="_gaps_m">
<MkSwitch v-model="autoTranslateButton">
<template #label>{{ i18n.ts.autoTranslateButton }}</template>
</MkSwitch>
</div>
</template>
<script lang="ts" setup>
import { computed } from 'vue';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { defaultStore } from '@/store.js';
import MkSwitch from '@/components/MkSwitch.vue';
const autoTranslateButton = computed(defaultStore.makeGetterSetter('autoTranslateButton'));
definePageMetadata(() => ({
title: 'Pari Cafe',
icon: 'ti ti-light-bulb',
}));
</script>

View file

@ -503,6 +503,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device',
default: { type: 'syuilo/bubble1', volume: 1 } as SoundStore,
},
autoTranslateButton: {
where: 'device',
default: true,
},
}));
// TODO: 他のタブと永続化されたstateを同期