From 00f3a1e1ec776168adfdf87fbfcc59e2034eb2b1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 26 Dec 2020 10:51:00 +0900 Subject: [PATCH] wip --- src/client/init.ts | 4 ++-- src/client/pages/settings/index.vue | 2 +- src/client/pages/settings/theme.vue | 2 +- src/client/scripts/get-user-menu.ts | 36 ++++++++++++++--------------- src/client/scripts/please-login.ts | 2 +- src/client/scripts/search.ts | 4 ++-- src/client/scripts/select-file.ts | 14 +++++------ src/client/sidebar.ts | 6 ++--- 8 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/client/init.ts b/src/client/init.ts index c5f147ca6..5d9828af0 100644 --- a/src/client/init.ts +++ b/src/client/init.ts @@ -227,8 +227,8 @@ stream.on('_disconnected_', async () => { reloadDialogShowing = true; const { canceled } = await dialog({ type: 'warning', - title: i18n.global.t('disconnectedFromServer'), - text: i18n.global.t('reloadConfirm'), + title: i18n.locale.disconnectedFromServer, + text: i18n.locale.reloadConfirm, showCancelButton: true }); reloadDialogShowing = false; diff --git a/src/client/pages/settings/index.vue b/src/client/pages/settings/index.vue index b42a51112..05756716d 100644 --- a/src/client/pages/settings/index.vue +++ b/src/client/pages/settings/index.vue @@ -66,7 +66,7 @@ export default defineComponent({ setup(props, context) { const INFO = ref({ - title: i18n.global.t('settings'), + title: i18n.locale.settings, icon: faCog }); const narrow = ref(false); diff --git a/src/client/pages/settings/theme.vue b/src/client/pages/settings/theme.vue index e98a9f77b..720874fd5 100644 --- a/src/client/pages/settings/theme.vue +++ b/src/client/pages/settings/theme.vue @@ -89,7 +89,7 @@ export default defineComponent({ setup(props, { emit }) { const INFO = { - title: i18n.global.t('theme'), + title: i18n.locale.theme, icon: faPalette }; diff --git a/src/client/scripts/get-user-menu.ts b/src/client/scripts/get-user-menu.ts index bac944aa0..0e4e4af5d 100644 --- a/src/client/scripts/get-user-menu.ts +++ b/src/client/scripts/get-user-menu.ts @@ -13,12 +13,12 @@ export function getUserMenu(user) { const meId = $i ? $i.id : null; async function pushList() { - const t = i18n.global.t('selectList'); // なぜか後で参照すると null になるので最初にメモリに確保しておく + const t = i18n.locale.selectList; // なぜか後で参照すると null になるので最初にメモリに確保しておく const lists = await os.api('users/lists/list'); if (lists.length === 0) { os.dialog({ type: 'error', - text: i18n.global.t('youHaveNoLists') + text: i18n.locale.youHaveNoLists }); return; } @@ -44,13 +44,13 @@ export function getUserMenu(user) { if (groups.length === 0) { os.dialog({ type: 'error', - text: i18n.global.t('youHaveNoGroups') + text: i18n.locale.youHaveNoGroups }); return; } const { canceled, result: groupId } = await os.dialog({ type: null, - title: i18n.global.t('group'), + title: i18n.locale.group, select: { items: groups.map(group => ({ value: group.id, text: group.name @@ -74,7 +74,7 @@ export function getUserMenu(user) { } async function toggleBlock() { - if (!await getConfirmed(user.isBlocking ? i18n.global.t('unblockConfirm') : i18n.global.t('blockConfirm'))) return; + if (!await getConfirmed(user.isBlocking ? i18n.locale.unblockConfirm : i18n.locale.blockConfirm)) return; os.apiWithDialog(user.isBlocking ? 'blocking/delete' : 'blocking/create', { userId: user.id @@ -84,7 +84,7 @@ export function getUserMenu(user) { } async function toggleSilence() { - if (!await getConfirmed(i18n.global.t(user.isSilenced ? 'unsilenceConfirm' : 'silenceConfirm'))) return; + if (!await getConfirmed(i18n.t(user.isSilenced ? 'unsilenceConfirm' : 'silenceConfirm'))) return; os.apiWithDialog(user.isSilenced ? 'admin/unsilence-user' : 'admin/silence-user', { userId: user.id @@ -94,7 +94,7 @@ export function getUserMenu(user) { } async function toggleSuspend() { - if (!await getConfirmed(i18n.global.t(user.isSuspended ? 'unsuspendConfirm' : 'suspendConfirm'))) return; + if (!await getConfirmed(i18n.t(user.isSuspended ? 'unsuspendConfirm' : 'suspendConfirm'))) return; os.apiWithDialog(user.isSuspended ? 'admin/unsuspend-user' : 'admin/suspend-user', { userId: user.id @@ -122,56 +122,56 @@ export function getUserMenu(user) { let menu = [{ icon: faAt, - text: i18n.global.t('copyUsername'), + text: i18n.locale.copyUsername, action: () => { copyToClipboard(`@${user.username}@${user.host || host}`); } }, { icon: faEnvelope, - text: i18n.global.t('sendMessage'), + text: i18n.locale.sendMessage, action: () => { os.post({ specified: user }); } }, meId != user.id ? { type: 'link', icon: faComments, - text: i18n.global.t('startMessaging'), + text: i18n.locale.startMessaging, to: '/my/messaging/' + getAcct(user), } : undefined, null, { icon: faListUl, - text: i18n.global.t('addToList'), + text: i18n.locale.addToList, action: pushList }, meId != user.id ? { icon: faUsers, - text: i18n.global.t('inviteToGroup'), + text: i18n.locale.inviteToGroup, action: inviteGroup } : undefined] as any; if ($i && meId != user.id) { menu = menu.concat([null, { icon: user.isMuted ? faEye : faEyeSlash, - text: user.isMuted ? i18n.global.t('unmute') : i18n.global.t('mute'), + text: user.isMuted ? i18n.locale.unmute : i18n.locale.mute, action: toggleMute }, { icon: faBan, - text: user.isBlocking ? i18n.global.t('unblock') : i18n.global.t('block'), + text: user.isBlocking ? i18n.locale.unblock : i18n.locale.block, action: toggleBlock }]); menu = menu.concat([null, { icon: faExclamationCircle, - text: i18n.global.t('reportAbuse'), + text: i18n.locale.reportAbuse, action: reportAbuse }]); if ($i && ($i.isAdmin || $i.isModerator)) { menu = menu.concat([null, { icon: faMicrophoneSlash, - text: user.isSilenced ? i18n.global.t('unsilence') : i18n.global.t('silence'), + text: user.isSilenced ? i18n.locale.unsilence : i18n.locale.silence, action: toggleSilence }, { icon: faSnowflake, - text: user.isSuspended ? i18n.global.t('unsuspend') : i18n.global.t('suspend'), + text: user.isSuspended ? i18n.locale.unsuspend : i18n.locale.suspend, action: toggleSuspend }]); } @@ -180,7 +180,7 @@ export function getUserMenu(user) { if ($i && meId === user.id) { menu = menu.concat([null, { icon: faPencilAlt, - text: i18n.global.t('editProfile'), + text: i18n.locale.editProfile, action: () => { router.push('/settings/profile'); } diff --git a/src/client/scripts/please-login.ts b/src/client/scripts/please-login.ts index 1d27de2c7..928f6ec0f 100644 --- a/src/client/scripts/please-login.ts +++ b/src/client/scripts/please-login.ts @@ -6,7 +6,7 @@ export function pleaseLogin() { if ($i) return; dialog({ - title: i18n.global.t('signinRequired'), + title: i18n.locale.signinRequired, text: null }); diff --git a/src/client/scripts/search.ts b/src/client/scripts/search.ts index 540aba2a9..960700371 100644 --- a/src/client/scripts/search.ts +++ b/src/client/scripts/search.ts @@ -6,7 +6,7 @@ import { router } from '@/router'; export async function search(q?: string | null | undefined) { if (q == null) { const { canceled, result: query } = await os.dialog({ - title: i18n.global.t('search'), + title: i18n.locale.search, input: true }); @@ -52,7 +52,7 @@ export async function search(q?: string | null | undefined) { uri: q }); - os.promiseDialog(promise, null, null, i18n.global.t('fetchingAsApObject')); + os.promiseDialog(promise, null, null, i18n.locale.fetchingAsApObject); const res = await promise; diff --git a/src/client/scripts/select-file.ts b/src/client/scripts/select-file.ts index 80f9d25a2..c083e1ef8 100644 --- a/src/client/scripts/select-file.ts +++ b/src/client/scripts/select-file.ts @@ -39,9 +39,9 @@ export function selectFile(src: any, label: string | null, multiple = false) { const chooseFileFromUrl = () => { os.dialog({ - title: i18n.global.t('uploadFromUrl'), + title: i18n.locale.uploadFromUrl, input: { - placeholder: i18n.global.t('uploadFromUrlDescription') + placeholder: i18n.locale.uploadFromUrlDescription } }).then(({ canceled, result: url }) => { if (canceled) return; @@ -62,8 +62,8 @@ export function selectFile(src: any, label: string | null, multiple = false) { }); os.dialog({ - title: i18n.global.t('uploadFromUrlRequested'), - text: i18n.global.t('uploadFromUrlMayTakeTime') + title: i18n.locale.uploadFromUrlRequested, + text: i18n.locale.uploadFromUrlMayTakeTime }); }); }; @@ -72,15 +72,15 @@ export function selectFile(src: any, label: string | null, multiple = false) { text: label, type: 'label' } : undefined, { - text: i18n.global.t('upload'), + text: i18n.locale.upload, icon: faUpload, action: chooseFileFromPc }, { - text: i18n.global.t('fromDrive'), + text: i18n.locale.fromDrive, icon: faCloud, action: chooseFileFromDrive }, { - text: i18n.global.t('fromUrl'), + text: i18n.locale.fromUrl, icon: faLink, action: chooseFileFromUrl }], src); diff --git a/src/client/sidebar.ts b/src/client/sidebar.ts index 318c0c533..98a70d2d1 100644 --- a/src/client/sidebar.ts +++ b/src/client/sidebar.ts @@ -130,19 +130,19 @@ export const sidebarDef = { icon: faColumns, action: (ev) => { os.modalMenu([{ - text: i18n.global.t('default'), + text: i18n.locale.default, action: () => { localStorage.setItem('ui', 'default'); location.reload(); } }, { - text: i18n.global.t('deck'), + text: i18n.locale.deck, action: () => { localStorage.setItem('ui', 'deck'); location.reload(); } }, { - text: i18n.global.t('desktop') + ' (β)', + text: i18n.locale.desktop + ' (β)', action: () => { localStorage.setItem('ui', 'desktop'); location.reload();