merge: teach eslint to check translations (!695)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/695

Approved-by: Marie <github@yuugi.dev>
Approved-by: Hazelnoot <acomputerdog@gmail.com>
This commit is contained in:
Hazelnoot 2024-10-25 15:23:14 +00:00
commit 55df1ad10f
13 changed files with 337 additions and 7 deletions

View file

@ -4,6 +4,8 @@ import parser from 'vue-eslint-parser';
import pluginVue from 'eslint-plugin-vue';
import pluginMisskey from '@misskey-dev/eslint-plugin';
import sharedConfig from '../shared/eslint.config.js';
import localeRule from '../../eslint/locale.js';
import { build as buildLocales } from '../../locales/index.js';
export default [
...sharedConfig,
@ -14,6 +16,7 @@ export default [
...pluginVue.configs['flat/recommended'],
{
files: ['{src,test,js,@types}/**/*.{ts,vue}'],
plugins: { sharkey: { rules: { locale: localeRule } } },
languageOptions: {
globals: {
...Object.fromEntries(Object.entries(globals.node).map(([key]) => [key, 'off'])),
@ -44,6 +47,8 @@ export default [
},
},
rules: {
'sharkey/locale': ['error', buildLocales()['en-US']],
'@typescript-eslint/no-empty-interface': ['error', {
allowSingleExtends: true,
}],

View file

@ -4,6 +4,8 @@ import parser from 'vue-eslint-parser';
import pluginVue from 'eslint-plugin-vue';
import pluginMisskey from '@misskey-dev/eslint-plugin';
import sharedConfig from '../shared/eslint.config.js';
import localeRule from '../../eslint/locale.js';
import { build as buildLocales } from '../../locales/index.js';
export default [
...sharedConfig,
@ -14,6 +16,7 @@ export default [
...pluginVue.configs['flat/recommended'],
{
files: ['{src,test,js,@types}/**/*.{ts,vue}'],
plugins: { sharkey: { rules: { locale: localeRule } } },
languageOptions: {
globals: {
...Object.fromEntries(Object.entries(globals.node).map(([key]) => [key, 'off'])),
@ -44,6 +47,8 @@ export default [
},
},
rules: {
'sharkey/locale': ['error', buildLocales()['en-US']],
'@typescript-eslint/no-empty-interface': ['error', {
allowSingleExtends: true,
}],

View file

@ -138,7 +138,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
<div v-else-if="tab === 'announcements'" class="_gaps">
<MkButton primary rounded @click="createAnnouncement"><i class="ti ti-plus"></i> {{ i18n.ts.new }}</MkButton>
<MkButton primary rounded @click="createAnnouncement"><i class="ti ti-plus"></i> {{ i18n.ts._announcement.new }}</MkButton>
<MkPagination :pagination="announcementsPagination">
<template #default="{ items }">

View file

@ -100,7 +100,7 @@ async function init() {
async function testEmail() {
const { canceled, result: destination } = await os.inputText({
title: i18n.ts.destination,
title: i18n.ts.emailDestination,
type: 'email',
default: instance.maintainerEmail ?? '',
placeholder: 'test@example.com',

View file

@ -25,7 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<h1>{{ i18n.ts._auth.denied }}</h1>
</div>
<div v-if="state == 'accepted' && session">
<h1>{{ session.app.isAuthorized ? i18n.ts['already-authorized'] : i18n.ts.allowed }}</h1>
<h1>{{ session.app.isAuthorized ? i18n.ts['already-authorized'] : i18n.ts._auth.allowed }}</h1>
<p v-if="session.app.callbackUrl">
{{ i18n.ts._auth.callback }}
<MkEllipsis/>

View file

@ -266,7 +266,7 @@ function showMenu(ev: MouseEvent) {
if ($i && $i.id === page.value.userId) {
menuItems.push({
icon: 'ti ti-pencil',
text: i18n.ts.editThisPage,
text: i18n.ts._pages.editThisPage,
action: () => router.push(`/pages/edit/${page.value.id}`),
});

View file

@ -22,7 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkButton primary @click="createKey">{{ i18n.ts._registry.createKey }}</MkButton>
<FormSection v-if="keys">
<template #label>{{ i18n.ts.keys }}</template>
<template #label>{{ i18n.ts._registry.keys }}</template>
<div class="_gaps_s">
<FormLink v-for="key in keys" :to="`/registry/value/${props.domain}/${scope.join('/')}/${key[0]}`" class="_monospace">{{ key[0] }}<template #suffix>{{ key[1].toUpperCase() }}</template></FormLink>
</div>

View file

@ -11,7 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div class="top">
<p class="name"><MkLoading :em="true"/>{{ ctx.name }}</p>
<p class="status">
<span v-if="ctx.progressValue === undefined" class="initing">{{ i18n.ts.waiting }}<MkEllipsis/></span>
<span v-if="ctx.progressValue === undefined" class="initing">{{ i18n.ts.uploading }}</span>
<span v-if="ctx.progressValue !== undefined" class="kb">{{ String(Math.floor(ctx.progressValue / 1024)).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,') }}<i>KB</i> / {{ String(Math.floor(ctx.progressMax / 1024)).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,') }}<i>KB</i></span>
<span v-if="ctx.progressValue !== undefined" class="percentage">{{ Math.floor((ctx.progressValue / ctx.progressMax) * 100) }}</span>
</p>

View file

@ -9,7 +9,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #header>{{ i18n.ts._widgets.memo }}</template>
<div :class="$style.root">
<textarea v-model="text" :style="`height: ${widgetProps.height}px;`" :class="$style.textarea" :placeholder="i18n.ts.placeholder" @input="onChange"></textarea>
<textarea v-model="text" :style="`height: ${widgetProps.height}px;`" :class="$style.textarea" @input="onChange"></textarea>
<button :class="$style.save" :disabled="!changed" class="_buttonPrimary" @click="saveMemo">{{ i18n.ts.save }}</button>
</div>
</MkContainer>

View file

@ -7,6 +7,8 @@ import { describe, expect, it } from 'vitest';
import { I18n } from '../../frontend-shared/js/i18n.js'; // @@で参照できなかったので
import { ParameterizedString } from '../../../locales/index.js';
/* eslint "sharkey/locale":"off" */
// TODO: このテストはfrontend-sharedに移動する
describe('i18n', () => {