This commit is contained in:
syuilo 2020-12-26 10:51:00 +09:00
parent 5a8cc7851b
commit 00f3a1e1ec
8 changed files with 35 additions and 35 deletions

View File

@ -227,8 +227,8 @@ stream.on('_disconnected_', async () => {
reloadDialogShowing = true; reloadDialogShowing = true;
const { canceled } = await dialog({ const { canceled } = await dialog({
type: 'warning', type: 'warning',
title: i18n.global.t('disconnectedFromServer'), title: i18n.locale.disconnectedFromServer,
text: i18n.global.t('reloadConfirm'), text: i18n.locale.reloadConfirm,
showCancelButton: true showCancelButton: true
}); });
reloadDialogShowing = false; reloadDialogShowing = false;

View File

@ -66,7 +66,7 @@ export default defineComponent({
setup(props, context) { setup(props, context) {
const INFO = ref({ const INFO = ref({
title: i18n.global.t('settings'), title: i18n.locale.settings,
icon: faCog icon: faCog
}); });
const narrow = ref(false); const narrow = ref(false);

View File

@ -89,7 +89,7 @@ export default defineComponent({
setup(props, { emit }) { setup(props, { emit }) {
const INFO = { const INFO = {
title: i18n.global.t('theme'), title: i18n.locale.theme,
icon: faPalette icon: faPalette
}; };

View File

@ -13,12 +13,12 @@ export function getUserMenu(user) {
const meId = $i ? $i.id : null; const meId = $i ? $i.id : null;
async function pushList() { async function pushList() {
const t = i18n.global.t('selectList'); // なぜか後で参照すると null になるので最初にメモリに確保しておく const t = i18n.locale.selectList; // なぜか後で参照すると null になるので最初にメモリに確保しておく
const lists = await os.api('users/lists/list'); const lists = await os.api('users/lists/list');
if (lists.length === 0) { if (lists.length === 0) {
os.dialog({ os.dialog({
type: 'error', type: 'error',
text: i18n.global.t('youHaveNoLists') text: i18n.locale.youHaveNoLists
}); });
return; return;
} }
@ -44,13 +44,13 @@ export function getUserMenu(user) {
if (groups.length === 0) { if (groups.length === 0) {
os.dialog({ os.dialog({
type: 'error', type: 'error',
text: i18n.global.t('youHaveNoGroups') text: i18n.locale.youHaveNoGroups
}); });
return; return;
} }
const { canceled, result: groupId } = await os.dialog({ const { canceled, result: groupId } = await os.dialog({
type: null, type: null,
title: i18n.global.t('group'), title: i18n.locale.group,
select: { select: {
items: groups.map(group => ({ items: groups.map(group => ({
value: group.id, text: group.name value: group.id, text: group.name
@ -74,7 +74,7 @@ export function getUserMenu(user) {
} }
async function toggleBlock() { 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', { os.apiWithDialog(user.isBlocking ? 'blocking/delete' : 'blocking/create', {
userId: user.id userId: user.id
@ -84,7 +84,7 @@ export function getUserMenu(user) {
} }
async function toggleSilence() { 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', { os.apiWithDialog(user.isSilenced ? 'admin/unsilence-user' : 'admin/silence-user', {
userId: user.id userId: user.id
@ -94,7 +94,7 @@ export function getUserMenu(user) {
} }
async function toggleSuspend() { 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', { os.apiWithDialog(user.isSuspended ? 'admin/unsuspend-user' : 'admin/suspend-user', {
userId: user.id userId: user.id
@ -122,56 +122,56 @@ export function getUserMenu(user) {
let menu = [{ let menu = [{
icon: faAt, icon: faAt,
text: i18n.global.t('copyUsername'), text: i18n.locale.copyUsername,
action: () => { action: () => {
copyToClipboard(`@${user.username}@${user.host || host}`); copyToClipboard(`@${user.username}@${user.host || host}`);
} }
}, { }, {
icon: faEnvelope, icon: faEnvelope,
text: i18n.global.t('sendMessage'), text: i18n.locale.sendMessage,
action: () => { action: () => {
os.post({ specified: user }); os.post({ specified: user });
} }
}, meId != user.id ? { }, meId != user.id ? {
type: 'link', type: 'link',
icon: faComments, icon: faComments,
text: i18n.global.t('startMessaging'), text: i18n.locale.startMessaging,
to: '/my/messaging/' + getAcct(user), to: '/my/messaging/' + getAcct(user),
} : undefined, null, { } : undefined, null, {
icon: faListUl, icon: faListUl,
text: i18n.global.t('addToList'), text: i18n.locale.addToList,
action: pushList action: pushList
}, meId != user.id ? { }, meId != user.id ? {
icon: faUsers, icon: faUsers,
text: i18n.global.t('inviteToGroup'), text: i18n.locale.inviteToGroup,
action: inviteGroup action: inviteGroup
} : undefined] as any; } : undefined] as any;
if ($i && meId != user.id) { if ($i && meId != user.id) {
menu = menu.concat([null, { menu = menu.concat([null, {
icon: user.isMuted ? faEye : faEyeSlash, 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 action: toggleMute
}, { }, {
icon: faBan, icon: faBan,
text: user.isBlocking ? i18n.global.t('unblock') : i18n.global.t('block'), text: user.isBlocking ? i18n.locale.unblock : i18n.locale.block,
action: toggleBlock action: toggleBlock
}]); }]);
menu = menu.concat([null, { menu = menu.concat([null, {
icon: faExclamationCircle, icon: faExclamationCircle,
text: i18n.global.t('reportAbuse'), text: i18n.locale.reportAbuse,
action: reportAbuse action: reportAbuse
}]); }]);
if ($i && ($i.isAdmin || $i.isModerator)) { if ($i && ($i.isAdmin || $i.isModerator)) {
menu = menu.concat([null, { menu = menu.concat([null, {
icon: faMicrophoneSlash, icon: faMicrophoneSlash,
text: user.isSilenced ? i18n.global.t('unsilence') : i18n.global.t('silence'), text: user.isSilenced ? i18n.locale.unsilence : i18n.locale.silence,
action: toggleSilence action: toggleSilence
}, { }, {
icon: faSnowflake, icon: faSnowflake,
text: user.isSuspended ? i18n.global.t('unsuspend') : i18n.global.t('suspend'), text: user.isSuspended ? i18n.locale.unsuspend : i18n.locale.suspend,
action: toggleSuspend action: toggleSuspend
}]); }]);
} }
@ -180,7 +180,7 @@ export function getUserMenu(user) {
if ($i && meId === user.id) { if ($i && meId === user.id) {
menu = menu.concat([null, { menu = menu.concat([null, {
icon: faPencilAlt, icon: faPencilAlt,
text: i18n.global.t('editProfile'), text: i18n.locale.editProfile,
action: () => { action: () => {
router.push('/settings/profile'); router.push('/settings/profile');
} }

View File

@ -6,7 +6,7 @@ export function pleaseLogin() {
if ($i) return; if ($i) return;
dialog({ dialog({
title: i18n.global.t('signinRequired'), title: i18n.locale.signinRequired,
text: null text: null
}); });

View File

@ -6,7 +6,7 @@ import { router } from '@/router';
export async function search(q?: string | null | undefined) { export async function search(q?: string | null | undefined) {
if (q == null) { if (q == null) {
const { canceled, result: query } = await os.dialog({ const { canceled, result: query } = await os.dialog({
title: i18n.global.t('search'), title: i18n.locale.search,
input: true input: true
}); });
@ -52,7 +52,7 @@ export async function search(q?: string | null | undefined) {
uri: q uri: q
}); });
os.promiseDialog(promise, null, null, i18n.global.t('fetchingAsApObject')); os.promiseDialog(promise, null, null, i18n.locale.fetchingAsApObject);
const res = await promise; const res = await promise;

View File

@ -39,9 +39,9 @@ export function selectFile(src: any, label: string | null, multiple = false) {
const chooseFileFromUrl = () => { const chooseFileFromUrl = () => {
os.dialog({ os.dialog({
title: i18n.global.t('uploadFromUrl'), title: i18n.locale.uploadFromUrl,
input: { input: {
placeholder: i18n.global.t('uploadFromUrlDescription') placeholder: i18n.locale.uploadFromUrlDescription
} }
}).then(({ canceled, result: url }) => { }).then(({ canceled, result: url }) => {
if (canceled) return; if (canceled) return;
@ -62,8 +62,8 @@ export function selectFile(src: any, label: string | null, multiple = false) {
}); });
os.dialog({ os.dialog({
title: i18n.global.t('uploadFromUrlRequested'), title: i18n.locale.uploadFromUrlRequested,
text: i18n.global.t('uploadFromUrlMayTakeTime') text: i18n.locale.uploadFromUrlMayTakeTime
}); });
}); });
}; };
@ -72,15 +72,15 @@ export function selectFile(src: any, label: string | null, multiple = false) {
text: label, text: label,
type: 'label' type: 'label'
} : undefined, { } : undefined, {
text: i18n.global.t('upload'), text: i18n.locale.upload,
icon: faUpload, icon: faUpload,
action: chooseFileFromPc action: chooseFileFromPc
}, { }, {
text: i18n.global.t('fromDrive'), text: i18n.locale.fromDrive,
icon: faCloud, icon: faCloud,
action: chooseFileFromDrive action: chooseFileFromDrive
}, { }, {
text: i18n.global.t('fromUrl'), text: i18n.locale.fromUrl,
icon: faLink, icon: faLink,
action: chooseFileFromUrl action: chooseFileFromUrl
}], src); }], src);

View File

@ -130,19 +130,19 @@ export const sidebarDef = {
icon: faColumns, icon: faColumns,
action: (ev) => { action: (ev) => {
os.modalMenu([{ os.modalMenu([{
text: i18n.global.t('default'), text: i18n.locale.default,
action: () => { action: () => {
localStorage.setItem('ui', 'default'); localStorage.setItem('ui', 'default');
location.reload(); location.reload();
} }
}, { }, {
text: i18n.global.t('deck'), text: i18n.locale.deck,
action: () => { action: () => {
localStorage.setItem('ui', 'deck'); localStorage.setItem('ui', 'deck');
location.reload(); location.reload();
} }
}, { }, {
text: i18n.global.t('desktop') + ' (β)', text: i18n.locale.desktop + ' (β)',
action: () => { action: () => {
localStorage.setItem('ui', 'desktop'); localStorage.setItem('ui', 'desktop');
location.reload(); location.reload();