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;
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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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