refactor(client): i18n.locale -> i18n.ts

This commit is contained in:
syuilo
2022-01-28 11:39:49 +09:00
parent 6ebab5f577
commit 57ec04d9ec
74 changed files with 424 additions and 424 deletions

View File

@@ -62,7 +62,7 @@ export default defineComponent({
const emailAddress = ref($i.email);
const INFO = {
title: i18n.locale.email,
title: i18n.ts.email,
icon: 'fas fa-envelope',
bg: 'var(--bg)',
};
@@ -75,7 +75,7 @@ export default defineComponent({
const saveEmailAddress = () => {
os.inputText({
title: i18n.locale.password,
title: i18n.ts.password,
type: 'password'
}).then(({ canceled, result: password }) => {
if (canceled) return;

View File

@@ -60,7 +60,7 @@ export default defineComponent({
setup(props, context) {
const INFO = {
title: i18n.locale.importAndExport,
title: i18n.ts.importAndExport,
icon: 'fas fa-boxes',
bg: 'var(--bg)',
};
@@ -71,14 +71,14 @@ export default defineComponent({
const onExportSuccess = () => {
os.alert({
type: 'info',
text: i18n.locale.exportRequested,
text: i18n.ts.exportRequested,
});
};
const onImportSuccess = () => {
os.alert({
type: 'info',
text: i18n.locale.importRequested,
text: i18n.ts.importRequested,
});
};

View File

@@ -49,7 +49,7 @@ export default defineComponent({
setup(props, context) {
const indexInfo = {
title: i18n.locale.settings,
title: i18n.ts.settings,
icon: 'fas fa-cog',
bg: 'var(--bg)',
hideHeader: true,
@@ -61,96 +61,96 @@ export default defineComponent({
const el = ref(null);
const childInfo = ref(null);
const menuDef = computed(() => [{
title: i18n.locale.basicSettings,
title: i18n.ts.basicSettings,
items: [{
icon: 'fas fa-user',
text: i18n.locale.profile,
text: i18n.ts.profile,
to: '/settings/profile',
active: page.value === 'profile',
}, {
icon: 'fas fa-lock-open',
text: i18n.locale.privacy,
text: i18n.ts.privacy,
to: '/settings/privacy',
active: page.value === 'privacy',
}, {
icon: 'fas fa-laugh',
text: i18n.locale.reaction,
text: i18n.ts.reaction,
to: '/settings/reaction',
active: page.value === 'reaction',
}, {
icon: 'fas fa-cloud',
text: i18n.locale.drive,
text: i18n.ts.drive,
to: '/settings/drive',
active: page.value === 'drive',
}, {
icon: 'fas fa-bell',
text: i18n.locale.notifications,
text: i18n.ts.notifications,
to: '/settings/notifications',
active: page.value === 'notifications',
}, {
icon: 'fas fa-envelope',
text: i18n.locale.email,
text: i18n.ts.email,
to: '/settings/email',
active: page.value === 'email',
}, {
icon: 'fas fa-share-alt',
text: i18n.locale.integration,
text: i18n.ts.integration,
to: '/settings/integration',
active: page.value === 'integration',
}, {
icon: 'fas fa-lock',
text: i18n.locale.security,
text: i18n.ts.security,
to: '/settings/security',
active: page.value === 'security',
}],
}, {
title: i18n.locale.clientSettings,
title: i18n.ts.clientSettings,
items: [{
icon: 'fas fa-cogs',
text: i18n.locale.general,
text: i18n.ts.general,
to: '/settings/general',
active: page.value === 'general',
}, {
icon: 'fas fa-palette',
text: i18n.locale.theme,
text: i18n.ts.theme,
to: '/settings/theme',
active: page.value === 'theme',
}, {
icon: 'fas fa-list-ul',
text: i18n.locale.menu,
text: i18n.ts.menu,
to: '/settings/menu',
active: page.value === 'menu',
}, {
icon: 'fas fa-music',
text: i18n.locale.sounds,
text: i18n.ts.sounds,
to: '/settings/sounds',
active: page.value === 'sounds',
}, {
icon: 'fas fa-plug',
text: i18n.locale.plugins,
text: i18n.ts.plugins,
to: '/settings/plugin',
active: page.value === 'plugin',
}],
}, {
title: i18n.locale.otherSettings,
title: i18n.ts.otherSettings,
items: [{
icon: 'fas fa-boxes',
text: i18n.locale.importAndExport,
text: i18n.ts.importAndExport,
to: '/settings/import-export',
active: page.value === 'import-export',
}, {
icon: 'fas fa-volume-mute',
text: i18n.locale.instanceMute,
text: i18n.ts.instanceMute,
to: '/settings/instance-mute',
active: page.value === 'instance-mute',
}, {
icon: 'fas fa-ban',
text: i18n.locale.muteAndBlock,
text: i18n.ts.muteAndBlock,
to: '/settings/mute-block',
active: page.value === 'mute-block',
}, {
icon: 'fas fa-comment-slash',
text: i18n.locale.wordMute,
text: i18n.ts.wordMute,
to: '/settings/word-mute',
active: page.value === 'word-mute',
}, {
@@ -160,7 +160,7 @@ export default defineComponent({
active: page.value === 'api',
}, {
icon: 'fas fa-ellipsis-h',
text: i18n.locale.other,
text: i18n.ts.other,
to: '/settings/other',
active: page.value === 'other',
}],
@@ -168,7 +168,7 @@ export default defineComponent({
items: [{
type: 'button',
icon: 'fas fa-trash',
text: i18n.locale.clearCache,
text: i18n.ts.clearCache,
action: () => {
localStorage.removeItem('locale');
localStorage.removeItem('theme');
@@ -177,7 +177,7 @@ export default defineComponent({
}, {
type: 'button',
icon: 'fas fa-sign-in-alt fa-flip-horizontal',
text: i18n.locale.logout,
text: i18n.ts.logout,
action: () => {
signout();
},

View File

@@ -52,7 +52,7 @@ const blockingPagination = {
defineExpose({
[symbols.PAGE_INFO]: {
title: i18n.locale.muteAndBlock,
title: i18n.ts.muteAndBlock,
icon: 'fas fa-ban',
bg: 'var(--bg)',
},

View File

@@ -86,7 +86,7 @@ function save() {
defineExpose({
[symbols.PAGE_INFO]: {
title: i18n.locale.privacy,
title: i18n.ts.privacy,
icon: 'fas fa-lock-open',
bg: 'var(--bg)',
},

View File

@@ -3,45 +3,45 @@
<div class="llvierxe" :style="{ backgroundImage: $i.bannerUrl ? `url(${ $i.bannerUrl })` : null }">
<div class="avatar _acrylic">
<MkAvatar class="avatar" :user="$i" :disable-link="true" @click="changeAvatar"/>
<MkButton primary class="avatarEdit" @click="changeAvatar">{{ i18n.locale._profile.changeAvatar }}</MkButton>
<MkButton primary class="avatarEdit" @click="changeAvatar">{{ i18n.ts._profile.changeAvatar }}</MkButton>
</div>
<MkButton primary class="bannerEdit" @click="changeBanner">{{ i18n.locale._profile.changeBanner }}</MkButton>
<MkButton primary class="bannerEdit" @click="changeBanner">{{ i18n.ts._profile.changeBanner }}</MkButton>
</div>
<FormInput v-model="profile.name" :max="30" manual-save class="_formBlock">
<template #label>{{ i18n.locale._profile.name }}</template>
<template #label>{{ i18n.ts._profile.name }}</template>
</FormInput>
<FormTextarea v-model="profile.description" :max="500" tall manual-save class="_formBlock">
<template #label>{{ i18n.locale._profile.description }}</template>
<template #caption>{{ i18n.locale._profile.youCanIncludeHashtags }}</template>
<template #label>{{ i18n.ts._profile.description }}</template>
<template #caption>{{ i18n.ts._profile.youCanIncludeHashtags }}</template>
</FormTextarea>
<FormInput v-model="profile.location" manual-save class="_formBlock">
<template #label>{{ i18n.locale.location }}</template>
<template #label>{{ i18n.ts.location }}</template>
<template #prefix><i class="fas fa-map-marker-alt"></i></template>
</FormInput>
<FormInput v-model="profile.birthday" type="date" manual-save class="_formBlock">
<template #label>{{ i18n.locale.birthday }}</template>
<template #label>{{ i18n.ts.birthday }}</template>
<template #prefix><i class="fas fa-birthday-cake"></i></template>
</FormInput>
<FormSelect v-model="profile.lang" class="_formBlock">
<template #label>{{ i18n.locale.language }}</template>
<template #label>{{ i18n.ts.language }}</template>
<option v-for="x in langs" :key="x[0]" :value="x[0]">{{ x[1] }}</option>
</FormSelect>
<FormSlot>
<MkButton @click="editMetadata">{{ i18n.locale._profile.metadataEdit }}</MkButton>
<template #caption>{{ i18n.locale._profile.metadataDescription }}</template>
<MkButton @click="editMetadata">{{ i18n.ts._profile.metadataEdit }}</MkButton>
<template #caption>{{ i18n.ts._profile.metadataDescription }}</template>
</FormSlot>
<FormSwitch v-model="profile.isCat" class="_formBlock">{{ i18n.locale.flagAsCat }}<template #caption>{{ i18n.locale.flagAsCatDescription }}</template></FormSwitch>
<FormSwitch v-model="profile.isCat" class="_formBlock">{{ i18n.ts.flagAsCat }}<template #caption>{{ i18n.ts.flagAsCatDescription }}</template></FormSwitch>
<FormSwitch v-model="profile.isBot" class="_formBlock">{{ i18n.locale.flagAsBot }}<template #caption>{{ i18n.locale.flagAsBotDescription }}</template></FormSwitch>
<FormSwitch v-model="profile.isBot" class="_formBlock">{{ i18n.ts.flagAsBot }}<template #caption>{{ i18n.ts.flagAsBotDescription }}</template></FormSwitch>
<FormSwitch v-model="profile.alwaysMarkNsfw" class="_formBlock">{{ i18n.locale.alwaysMarkSensitive }}</FormSwitch>
<FormSwitch v-model="profile.alwaysMarkNsfw" class="_formBlock">{{ i18n.ts.alwaysMarkSensitive }}</FormSwitch>
</div>
</template>
@@ -102,7 +102,7 @@ function save() {
}
function changeAvatar(ev) {
selectFile(ev.currentTarget || ev.target, i18n.locale.avatar).then(async (file) => {
selectFile(ev.currentTarget || ev.target, i18n.ts.avatar).then(async (file) => {
const i = await os.apiWithDialog('i/update', {
avatarId: file.id,
});
@@ -112,7 +112,7 @@ function changeAvatar(ev) {
}
function changeBanner(ev) {
selectFile(ev.currentTarget || ev.target, i18n.locale.banner).then(async (file) => {
selectFile(ev.currentTarget || ev.target, i18n.ts.banner).then(async (file) => {
const i = await os.apiWithDialog('i/update', {
bannerId: file.id,
});
@@ -122,45 +122,45 @@ function changeBanner(ev) {
}
async function editMetadata() {
const { canceled, result } = await os.form(i18n.locale._profile.metadata, {
const { canceled, result } = await os.form(i18n.ts._profile.metadata, {
fieldName0: {
type: 'string',
label: i18n.locale._profile.metadataLabel + ' 1',
label: i18n.ts._profile.metadataLabel + ' 1',
default: additionalFields.fieldName0,
},
fieldValue0: {
type: 'string',
label: i18n.locale._profile.metadataContent + ' 1',
label: i18n.ts._profile.metadataContent + ' 1',
default: additionalFields.fieldValue0,
},
fieldName1: {
type: 'string',
label: i18n.locale._profile.metadataLabel + ' 2',
label: i18n.ts._profile.metadataLabel + ' 2',
default: additionalFields.fieldName1,
},
fieldValue1: {
type: 'string',
label: i18n.locale._profile.metadataContent + ' 2',
label: i18n.ts._profile.metadataContent + ' 2',
default: additionalFields.fieldValue1,
},
fieldName2: {
type: 'string',
label: i18n.locale._profile.metadataLabel + ' 3',
label: i18n.ts._profile.metadataLabel + ' 3',
default: additionalFields.fieldName2,
},
fieldValue2: {
type: 'string',
label: i18n.locale._profile.metadataContent + ' 3',
label: i18n.ts._profile.metadataContent + ' 3',
default: additionalFields.fieldValue2,
},
fieldName3: {
type: 'string',
label: i18n.locale._profile.metadataLabel + ' 4',
label: i18n.ts._profile.metadataLabel + ' 4',
default: additionalFields.fieldName3,
},
fieldValue3: {
type: 'string',
label: i18n.locale._profile.metadataContent + ' 4',
label: i18n.ts._profile.metadataContent + ' 4',
default: additionalFields.fieldValue3,
},
});
@@ -196,7 +196,7 @@ async function editMetadata() {
defineExpose({
[symbols.PAGE_INFO]: {
title: i18n.locale.profile,
title: i18n.ts.profile,
icon: 'fas fa-user',
bg: 'var(--bg)',
},

View File

@@ -1,12 +1,12 @@
<template>
<div class="_formRoot">
<FormTextarea v-model="installThemeCode" class="_formBlock">
<template #label>{{ i18n.locale._theme.code }}</template>
<template #label>{{ i18n.ts._theme.code }}</template>
</FormTextarea>
<div class="_formBlock" style="display: flex; gap: var(--margin); flex-wrap: wrap;">
<FormButton :disabled="installThemeCode == null" inline @click="() => preview(installThemeCode)"><i class="fas fa-eye"></i> {{ i18n.locale.preview }}</FormButton>
<FormButton :disabled="installThemeCode == null" primary inline @click="() => install(installThemeCode)"><i class="fas fa-check"></i> {{ i18n.locale.install }}</FormButton>
<FormButton :disabled="installThemeCode == null" inline @click="() => preview(installThemeCode)"><i class="fas fa-eye"></i> {{ i18n.ts.preview }}</FormButton>
<FormButton :disabled="installThemeCode == null" primary inline @click="() => install(installThemeCode)"><i class="fas fa-check"></i> {{ i18n.ts.install }}</FormButton>
</div>
</div>
</template>
@@ -32,21 +32,21 @@ function parseThemeCode(code: string) {
} catch (e) {
os.alert({
type: 'error',
text: i18n.locale._theme.invalid
text: i18n.ts._theme.invalid
});
return false;
}
if (!validateTheme(theme)) {
os.alert({
type: 'error',
text: i18n.locale._theme.invalid
text: i18n.ts._theme.invalid
});
return false;
}
if (getThemes().some(t => t.id === theme.id)) {
os.alert({
type: 'info',
text: i18n.locale._theme.alreadyInstalled
text: i18n.ts._theme.alreadyInstalled
});
return false;
}
@@ -71,7 +71,7 @@ async function install(code: string): Promise<void> {
defineExpose({
[symbols.PAGE_INFO]: {
title: i18n.locale._theme.install,
title: i18n.ts._theme.install,
icon: 'fas fa-download',
bg: 'var(--bg)',
},

View File

@@ -116,7 +116,7 @@ export default defineComponent({
setup(props, { emit }) {
const INFO = {
title: i18n.locale.theme,
title: i18n.ts.theme,
icon: 'fas fa-palette',
bg: 'var(--bg)',
};