mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-25 14:09:03 -04:00
Merge branch 'check-noun-templates' into 'main'
check noun templates, noun templates subpage and filter possibility See merge request PronounsPage/PronounsPage!476
This commit is contained in:
commit
d1d051c72d
@ -80,7 +80,7 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<template v-if="$config.nouns.templates">
|
||||
<template v-if="$config.nouns.templates?.enabled">
|
||||
<a v-if="!templateVisible" href="#" class="btn btn-outline-primary w-100 mb-3" @click.prevent="templateVisible = true">
|
||||
<Icon v="copy" />
|
||||
<T>nouns.template.header</T>
|
||||
@ -91,58 +91,50 @@
|
||||
<T>nouns.template.header</T>
|
||||
</a>
|
||||
<div class="card-body">
|
||||
<T>nouns.template.root</T><T>quotation.colon</T>
|
||||
<input v-model="templateBase" class="form-control form-control-sm d-inline-block w-auto" autofocus>
|
||||
<table class="table table-striped table-hover table-fixed-3 mt-2">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-nowrap">
|
||||
<Icon v="mars" />
|
||||
<span class="d-none d-md-inline"><T>nouns.masculine</T></span>
|
||||
<span class="d-md-none"><T>nouns.masculineShort</T></span>
|
||||
</th>
|
||||
<th class="text-nowrap">
|
||||
<Icon v="venus" />
|
||||
<span class="d-none d-md-inline"><T>nouns.feminine</T></span>
|
||||
<span class="d-md-none"><T>nouns.feminineShort</T></span>
|
||||
</th>
|
||||
<th class="text-nowrap">
|
||||
<Icon v="neuter" />
|
||||
<span class="d-none d-md-inline"><T>nouns.neuter</T></span>
|
||||
<span class="d-md-none"><T>nouns.neuterShort</T></span>
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(template, i) in templates" :key="i">
|
||||
<td>
|
||||
<Noun :noun="template" gender="masc" />
|
||||
</td>
|
||||
<td>
|
||||
<Noun :noun="template" gender="fem" />
|
||||
</td>
|
||||
<td>
|
||||
<Noun :noun="template" gender="neutr" />
|
||||
</td>
|
||||
<th>
|
||||
<ul class="list-unstyled list-btn-concise">
|
||||
<li>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-concise btn-outline-primary btn-sm"
|
||||
:disabled="!templateBase"
|
||||
@click="applyTemplate(template)"
|
||||
>
|
||||
<Icon v="copy" />
|
||||
<span class="btn-label"><T>nouns.template.apply</T></span>
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="input-group mb-3 bg-white">
|
||||
<span class="input-group-text">
|
||||
<Icon v="scroll-old" />
|
||||
</span>
|
||||
<input
|
||||
v-model="templateBase"
|
||||
class="form-control form-control-sm border-primary"
|
||||
autofocus
|
||||
:placeholder="$t('nouns.template.root')"
|
||||
>
|
||||
<template v-if="$config.nouns.templates.filter">
|
||||
<span class="input-group-text">
|
||||
<Icon v="filter" />
|
||||
</span>
|
||||
<input
|
||||
ref="templateFilter"
|
||||
v-model="templateFilter"
|
||||
class="form-control form-control-sm border-primary"
|
||||
:placeholder="$t('crud.filterLong')"
|
||||
>
|
||||
<button
|
||||
v-if="templateFilter"
|
||||
class="btn btn-sm btn-outline-danger"
|
||||
@click="templateFilter = ''; $tRefs.templateFilter?.focus()"
|
||||
>
|
||||
<Icon v="times" />
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
<NounTemplatesTable :template-base="templateBase" :filter="templateFilter">
|
||||
<template #buttons="{ template }">
|
||||
<li>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-concise btn-outline-primary btn-sm"
|
||||
:disabled="!templateBase"
|
||||
@click="applyTemplate(template)"
|
||||
>
|
||||
<Icon v="copy" />
|
||||
<span class="btn-label"><T>nouns.template.apply</T></span>
|
||||
</button>
|
||||
</li>
|
||||
</template>
|
||||
</NounTemplatesTable>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -175,10 +167,14 @@
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import { nounTemplates, abbreviations } from '../src/data.ts';
|
||||
import { abbreviations } from '../src/data.ts';
|
||||
import type { Noun, MinimalNoun } from '../src/classes.ts';
|
||||
import type { Config } from '../locale/config.ts';
|
||||
|
||||
interface Refs {
|
||||
templateFilter: HTMLInputElement | undefined;
|
||||
}
|
||||
|
||||
const emptyForm = (config: Config): MinimalNoun => {
|
||||
return {
|
||||
masc: [''],
|
||||
@ -199,15 +195,14 @@ export default Vue.extend({
|
||||
submitting: false,
|
||||
afterSubmit: false,
|
||||
templateBase: '',
|
||||
templateFilter: '',
|
||||
templateVisible: false,
|
||||
abbreviations,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
templates() {
|
||||
return nounTemplates.map((template) => {
|
||||
return template.fill(this.templateBase || '-');
|
||||
});
|
||||
$tRefs(): Refs {
|
||||
return this.$refs as unknown as Refs;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
69
components/NounTemplatesTable.vue
Normal file
69
components/NounTemplatesTable.vue
Normal file
@ -0,0 +1,69 @@
|
||||
<template>
|
||||
<Table :data="templates" :columns="3" fixed>
|
||||
<template #header>
|
||||
<th class="text-nowrap">
|
||||
<Icon v="mars" />
|
||||
<T>nouns.masculine</T>
|
||||
</th>
|
||||
<th class="text-nowrap">
|
||||
<Icon v="venus" />
|
||||
<T>nouns.feminine</T>
|
||||
</th>
|
||||
<th class="text-nowrap">
|
||||
<Icon v="neuter" />
|
||||
<T>nouns.neuter</T>
|
||||
</th>
|
||||
<th></th>
|
||||
</template>
|
||||
<template #row="{ el: template }">
|
||||
<td>
|
||||
<Noun :noun="template" gender="masc" />
|
||||
</td>
|
||||
<td>
|
||||
<Noun :noun="template" gender="fem" />
|
||||
</td>
|
||||
<td>
|
||||
<Noun :noun="template" gender="neutr" />
|
||||
</td>
|
||||
<th>
|
||||
<ul class="list-unstyled list-btn-concise">
|
||||
<slot name="buttons" :template="template"></slot>
|
||||
</ul>
|
||||
</th>
|
||||
</template>
|
||||
|
||||
<template #empty>
|
||||
<Icon v="search" />
|
||||
<T>nouns.empty</T>
|
||||
</template>
|
||||
</Table>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import type { MinimalNoun } from '../src/classes.ts';
|
||||
import { gendersWithNumerus } from '../src/classes.ts';
|
||||
import { nounTemplates } from '../src/data.ts';
|
||||
|
||||
export default Vue.extend({
|
||||
props: {
|
||||
templateBase: { default: '', type: String },
|
||||
filter: { default: '', type: String },
|
||||
},
|
||||
computed: {
|
||||
templates(): MinimalNoun[] {
|
||||
return nounTemplates.filter((template) => {
|
||||
for (const field of gendersWithNumerus) {
|
||||
for (const value of template[field]) {
|
||||
if (value.toLowerCase().includes(this.filter)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}).map((template) => {
|
||||
return template.fill(this.templateBase || '-');
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
@ -120,7 +120,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: true
|
||||
|
||||
community:
|
||||
route: 'terminology'
|
||||
|
@ -60,7 +60,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: false
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
community:
|
||||
route: 'المصطلحات'
|
||||
|
@ -381,7 +381,19 @@ interface NounsConfig {
|
||||
/**
|
||||
* whether the configured locale uses noun templates in `nouns/nounTemplates.tsv`
|
||||
*/
|
||||
templates: boolean;
|
||||
templates: Toggable<NounTemplatesConfig>;
|
||||
}
|
||||
|
||||
interface NounTemplatesConfig {
|
||||
/**
|
||||
* route path for noun templates (translated)
|
||||
*/
|
||||
route?: string;
|
||||
/**
|
||||
* whether a filter is shown for templates, useful when the language has several templates
|
||||
* @default false
|
||||
*/
|
||||
filter?: boolean;
|
||||
}
|
||||
|
||||
interface CommunityConfig {
|
||||
|
@ -285,7 +285,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: true
|
||||
|
||||
community:
|
||||
route: 'kalender'
|
||||
|
@ -145,7 +145,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: true
|
||||
|
||||
community:
|
||||
route: 'terminology'
|
||||
|
@ -107,7 +107,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
community:
|
||||
route: 'terminologio'
|
||||
|
@ -101,7 +101,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: false
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
community:
|
||||
route: 'terminologia'
|
||||
|
@ -100,7 +100,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: true
|
||||
|
||||
# community:
|
||||
# route: 'terminology'
|
||||
|
@ -57,7 +57,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
inclusive:
|
||||
enabled: false
|
||||
|
@ -39,7 +39,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: false
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
community:
|
||||
route: 'terminologia'
|
||||
|
@ -119,7 +119,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
community:
|
||||
route: 'terminology'
|
||||
|
@ -118,7 +118,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
community:
|
||||
route: 'Terminologia'
|
||||
|
@ -60,7 +60,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
community:
|
||||
route: '用語'
|
||||
|
@ -65,7 +65,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
community:
|
||||
route: '술어'
|
||||
|
@ -37,7 +37,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: false
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
community:
|
||||
route: 'terminolojia'
|
||||
|
@ -64,7 +64,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
community:
|
||||
route: 'terminologie'
|
||||
|
@ -1,3 +1 @@
|
||||
masc fem neutr mascPl femPl neutrPl
|
||||
-mann -frau -person -männer -frauen -leute
|
||||
- -in -In/-:in/-*in -e -innen -Innen/-:innen/-*innen
|
||||
|
|
@ -45,7 +45,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
inclusive:
|
||||
enabled: false
|
||||
|
@ -224,7 +224,9 @@ nouns:
|
||||
pluralsRequired: true
|
||||
declension: true
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: true
|
||||
filter: true
|
||||
subroutes:
|
||||
- 'neutratywy'
|
||||
- 'dukatywy'
|
||||
|
@ -47,7 +47,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: false
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
community:
|
||||
route: 'terminologia'
|
||||
|
@ -116,7 +116,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: true
|
||||
|
||||
community:
|
||||
route: 'terminologie'
|
||||
|
@ -102,7 +102,10 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: true
|
||||
route: 'endings'
|
||||
filter: true
|
||||
|
||||
community:
|
||||
route: 'terminology'
|
||||
|
@ -1,7 +1,7 @@
|
||||
masc fem neutr mascPl femPl neutrPl
|
||||
-ак -ачиня -аче(в) -аки -ачини -аче(ва)
|
||||
-ак -ачица -аче(в) -аки -ачицы -аче(ва)
|
||||
-ал -алка -альт –алы -алки -альты
|
||||
-ал -алка -альт -алы -алки -альты
|
||||
-ал -алка -альче(в) -алы -алки -альче(ва)
|
||||
-ал -анка -альт -алы -анки -альты
|
||||
-ан -анка -альче(в) -аны -анки -альче(ва)
|
||||
@ -134,7 +134,7 @@ masc fem neutr mascPl femPl neutrPl
|
||||
-чик -чица -чикс -чики -чицы -чиксы
|
||||
-чик -чица -чикс -чики -чицы -чиксы
|
||||
-чик -чица -чина -чики -чицы -чины
|
||||
-чик -чица -щина -чики -чицы –щины
|
||||
-чик -чица -щина -чики -чицы -щины
|
||||
-щик -щица -че -щики -щицы -че
|
||||
-щик -щица -щикс -щики -щицы -щиксы
|
||||
-ыка -ычица -ыка -ик -ычиц -ык
|
||||
|
|
@ -46,7 +46,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
community:
|
||||
route: 'terminologi'
|
||||
|
@ -41,7 +41,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
community:
|
||||
route: 'kulupu-pi-nasin-toki'
|
||||
|
@ -28,7 +28,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
community:
|
||||
route: 'terminoloji'
|
||||
|
@ -97,7 +97,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
community:
|
||||
route: 'terminology'
|
||||
|
@ -1,153 +1 @@
|
||||
masc fem neutr mascPl femPl neutrPl
|
||||
-ак -ачиня -аче(в) -аки -ачини -аче(ва)
|
||||
-ак -ачица -аче(в) -аки -ачицы -аче(ва)
|
||||
-ал -алка -альт –алы -алки -альты
|
||||
-ал -алка -альче(в) -алы -алки -альче(ва)
|
||||
-ал -анка -альт -алы -анки -альты
|
||||
-ан -анка -альче(в) -аны -анки -альче(ва)
|
||||
-анин -анка -аже -ане -анки -аже
|
||||
-анин -анка -альт -ане -анки -альты
|
||||
-анин -анка -анче(в) -ане -анки -анче(ва)
|
||||
-ант -антка -альт -анты -антки -альты
|
||||
-ант -е́нта -е́нта -анты -е́нты -е́нты
|
||||
-ар -е́ра -арев -ара -е́ры -арева
|
||||
-ар -е́ра -арекс -ара -е́ры -арексы
|
||||
-ар -е́ра -арикс -ара -е́ры -ариксы
|
||||
-ар -е́ра -ире -ара -е́ры -ире
|
||||
-арь -арица -арев -ари -арицы -арева
|
||||
-арь -арица -арче -ари -арицы -арче
|
||||
-арь -арыня -арев -ари -арыни -арева
|
||||
-арь -арыня -арче -ари -арыни -арче
|
||||
-ач -ачиня -аче -ачи -ачини -аче
|
||||
-ач -ачиня -ачикс -ачи -ачини -ачиксы
|
||||
-ач -ачиня -ачина -ачи -ачини -ачины
|
||||
-ач -ачиня -яга -ачи -ачини -яги
|
||||
-ач -ачица -аче -ачи -ачицы -аче
|
||||
-ач -ачица -ачикс -ачи -ачицы -ачиксы
|
||||
-ач -ачица -ачина -ачи -ачицы -ачины
|
||||
-ач -ачица -яга -ачи -ачицы -яги
|
||||
-ач -ачка -аче -ачи -ачки -аче
|
||||
-граф -графиня -гра́фос -графы -графини -гра́фос
|
||||
-евт -евтесса -евтикс -евты -евтессы -евтиксы
|
||||
-ей -ея -ейче -еи -еи -еи
|
||||
-ей -ея -ейше -еи -еи -еи
|
||||
-ек -ка -ушко -ки -ки -ки
|
||||
-ент -ентка -екс -енты -ентки -ексы
|
||||
-ент -ентка -ентикс -енты -ентки -ентиксы
|
||||
-ент -ентка -иже -енты -ентки -иже
|
||||
-ент -ентка -икс -енты -ентки -иксы
|
||||
-ент -ея -екс -енты -еи -ексы
|
||||
-ент -ея -ентикс -енты -еи -ентиксы
|
||||
-ент -ея -иже -енты -еи -иже
|
||||
-ент -ея -икс -енты -еи -иксы
|
||||
-ент -инта -екс -енты -инты -ексы
|
||||
-ент -инта -ентикс -енты -инты -ентиксы
|
||||
-ент -инта -иже -енты -инты -иже
|
||||
-ент -инта -икс -енты -инты -иксы
|
||||
-ент -иня -екс -инты -ини -ексы
|
||||
-ент -иня -ентикс -инты -ини -ентиксы
|
||||
-ент -иня -иже -инты -ини -иже
|
||||
-ент -иня -икс -инты -ини -иксы
|
||||
-ер -ерка -ерикс -еры -ерки -ериксы
|
||||
-ер -ерка -и́ре -еры -ерки -и́ре
|
||||
-ер -и́ра -ерикс -еры -и́ры -ериксы
|
||||
-ер -и́ра -и́ре -еры -и́ры -и́ре
|
||||
-ец -ея -еже -еи -еи -еи
|
||||
-ец -ея -ече -еи -еи -еи
|
||||
-ец -ея -ечев -еи -еи -ечева
|
||||
-ец -ея -ечина -еи -еи -еи
|
||||
-ец -ица -(ь)же -(ь)цы -ицы -(ь)же
|
||||
-ец -ица -(ь)че -(ь)цы -ицы -(ь)че
|
||||
-ец -ица -(ь)чев -(ь)цы -ицы -(ь)чева
|
||||
-ец -ица -(ь)чина -(ь)цы -ицы -(ь)чины
|
||||
-ец -ица -екс -(ь)цы -ицы -ексы
|
||||
-ец -ица -икс -(ь)цы -ицы -иксы
|
||||
-ец -ка -(ь)же -ец -ка -(ь)же
|
||||
-ец -ка -(ь)че -ец -ка -(ь)че
|
||||
-ец -ка -(ь)чев -ец -ка -чева
|
||||
-ец -ка -(ь)чина -ец -ка -(ь)чины
|
||||
-ец -ка -екс -ец -ка -ексы
|
||||
-ец -ка -икс -ец -ка -иксы
|
||||
-ец -чиня -же -цы -чини -же
|
||||
-ец -чиня -че -цы -чини -че
|
||||
-ец -чиня -чев -чи -чини -чева
|
||||
-ец -чиня -чина -цы -чини -чины
|
||||
-ец -чиха -же -цы -чихи -же
|
||||
-ец -чиха -че -цы -чихи -че
|
||||
-ец -чиха -чина -цы -чихи -чины
|
||||
-ик -ица -кин(с) -ики -ицы -кин(с)ы
|
||||
-ик -ица -икс -ики -ицы -иксы
|
||||
-ик -ица -ира -ики -ицы -иры
|
||||
-ик -ица -ирь -ики -ицы -ирь
|
||||
-ик -ица -че(в) -ики -ицы -че(ва)
|
||||
-ик -ица -яга -ики -ицы -яги
|
||||
-ик -ка -кин(с) -ики -ицы -кин(с)ы
|
||||
-ик -ка -икс -ики -ки -иксы
|
||||
-ик -ка -ира -ики -ки -иры
|
||||
-ик -ка -ирь -ики -ки -ирь
|
||||
-ик -ка -че(в) -ики -ки -че(ва)
|
||||
-ик -ка -яга -ики -ки -яги
|
||||
-ил -илка -ильче -илы -илки -ильче
|
||||
-ир -ера -рикс -иры -еры -рикс
|
||||
-ист -истка -икс -исты -истки -иксы
|
||||
-ист -истка -иста -исты -истки -иста
|
||||
-ист -ина -икс -исты -ины -иксы
|
||||
-ист -ина -иста -исты -ины -иста
|
||||
-ич -ичка -иже(в) -ичи -ички -иже(ва)
|
||||
-ич -ичка -иче(в) -ичи -ички -иче(ва)
|
||||
-лог -логиня -ло́гос -логи -логини -ло́гос
|
||||
-ник -ница -не -ники -ницы -же
|
||||
-ник -ница -не -ники -ницы -не
|
||||
-ник -ница -никс -ники -ницы -никсы
|
||||
-ник -ница -нира -ники -ницы -ниры
|
||||
-ник -ница -нирь -ники -ницы -нирь
|
||||
-ник -ница -няга -ники -ницы -няги
|
||||
-ок -ка -кин(с) -ки -ки -ки(нсы)
|
||||
-ок -ка -ко -ки -ки -ки
|
||||
-онок -онка -оня -ята -ята -ята
|
||||
-ор -е́ра -е́ри -оров -е́р -е́ри
|
||||
-ор -е́ра -о́ра -оров -е́р -о́ра
|
||||
-ор -е́ра -орекс -оров -е́р -орекс
|
||||
-ор -е́ра -орче -оров -е́р -орче
|
||||
-ор -орица -е́ри -ора -орицы -е́ри
|
||||
-ор -орица -о́ра -ора -орицы -о́ра
|
||||
-ор -орица -орекс -ора -орицы -орексы
|
||||
-ор -орица -орче -ора -орицы -орче
|
||||
-ор -орка -е́ри -оров -орок -е́ри
|
||||
-ор -орка -о́ра -оров -орок -о́ра
|
||||
-ор -орка -орекс -оров -орок -орекс
|
||||
-ор -орка -орче -оров -орок -орче
|
||||
-ор -риня -рикс -ры -рини -риксы
|
||||
-ор -риса -рикс -ора -рисы -риксы
|
||||
-тель -тельница -текс -тели -тельницы -тексы
|
||||
-тель -тельница -тельже -тели -тельницы -тельже
|
||||
-тель -тчица -тче(в) -тели -тчицы -тче(ва)
|
||||
-тель -тчица -тчикс -тели -тчицы -тчиксы
|
||||
-ун -ина -унь -уны -ины -уни
|
||||
-ун -ина -уш -уны -ины -уш(к)и
|
||||
-ун -унья -уш -уны -ины -уш(к)и
|
||||
-ун -ушка -уш -уны -ины -уш(к)и
|
||||
-чик -очка -оня -чики -очки -они
|
||||
-чик -чица -(ь)ма -чики -чицы -(ь)мы
|
||||
-чик -чица -че(в) -чики -чицы -че(ва)
|
||||
-чик -чица -че(в) -чики -чицы -че(ва)
|
||||
-чик -чица -чикс -чики -чицы -чиксы
|
||||
-чик -чица -чикс -чики -чицы -чиксы
|
||||
-чик -чица -чина -чики -чицы -чины
|
||||
-чик -чица -щина -чики -чицы –щины
|
||||
-щик -щица -че -щики -щицы -че
|
||||
-щик -щица -щикс -щики -щицы -щиксы
|
||||
-ыка -ычица -ыка -ик -ычиц -ык
|
||||
-язь -ягиня -яже -язья -ягини -яже
|
||||
-яин -яйка -яев -яева -яева -яева
|
||||
-як -ячица -яга -яки -ячицы -яга
|
||||
-як -ячица -яже -яки -ячицы -яже
|
||||
-як -ячица -яче(в) -яки -ячицы -яче(ва)
|
||||
-як -ячка -яга -яки -ячки -яги
|
||||
-як -ячка -яже -яки -ячки -яже
|
||||
-як -ячка -яче -яки -ячки -яче
|
||||
-янин -янка -янже -яне -янки -янже
|
||||
-янин -янка -янче(в) -яне -янки -янче(ва)
|
||||
-янин -янка -ячев -яне -янки -ячева
|
||||
-ян -янка -яжь -яне -янки -яжи
|
||||
-ёнок -ёнка -ёня -ята -ята -ята
|
||||
|
|
@ -98,7 +98,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
community:
|
||||
route: 'thuật-ngữ'
|
||||
|
@ -50,7 +50,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
inclusive:
|
||||
enabled: false
|
||||
|
@ -49,7 +49,8 @@ nouns:
|
||||
pluralsRequired: false
|
||||
declension: false
|
||||
submit: true
|
||||
templates: true
|
||||
templates:
|
||||
enabled: false
|
||||
|
||||
inclusive:
|
||||
enabled: false
|
||||
|
@ -363,6 +363,12 @@ const nuxtConfig: NuxtConfig = {
|
||||
component: resolve(__dirname, `data/nouns/${subroute}.vue`),
|
||||
});
|
||||
}
|
||||
if (config.nouns.templates.enabled && config.nouns.templates.route) {
|
||||
routes.push({
|
||||
path: `/${encodeURIComponent(config.nouns.templates.route)}`,
|
||||
component: resolve(__dirname, 'routes/nounTemplates.vue'),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (config.inclusive.enabled) {
|
||||
|
14
plugins/data.d.ts
vendored
14
plugins/data.d.ts
vendored
@ -22,6 +22,15 @@ export interface PronounExamplesData {
|
||||
isHonorific?: boolean;
|
||||
}
|
||||
|
||||
export interface NounTemplatesData {
|
||||
masc: string;
|
||||
fem: string;
|
||||
neutr: string;
|
||||
mascPl: string;
|
||||
femPl: string;
|
||||
neutrPl: string;
|
||||
}
|
||||
|
||||
declare namespace Data {
|
||||
declare module '*/config.suml' {
|
||||
declare const config: Config;
|
||||
@ -43,6 +52,11 @@ declare namespace Data {
|
||||
export default data;
|
||||
}
|
||||
|
||||
declare module '*/nouns/nounTemplates.tsv' {
|
||||
declare const data: NounTemplatesData[];
|
||||
export default data;
|
||||
}
|
||||
|
||||
declare module '*.tsv' {
|
||||
declare const data: Record<string, any>[];
|
||||
export default data;
|
||||
|
60
routes/nounTemplates.vue
Normal file
60
routes/nounTemplates.vue
Normal file
@ -0,0 +1,60 @@
|
||||
<template>
|
||||
<Page>
|
||||
<NounsNav />
|
||||
|
||||
<h2>
|
||||
<Icon v="book" />
|
||||
<T>nouns.headerLonger</T>
|
||||
</h2>
|
||||
|
||||
<section>
|
||||
<T>nouns.intro</T>
|
||||
|
||||
<Share :title="$t('nouns.headerLong')" />
|
||||
</section>
|
||||
|
||||
<AdPlaceholder :phkey="['content-0', 'content-mobile-0']" />
|
||||
|
||||
<section v-if="$config.nouns.templates?.filter" class="sticky-top">
|
||||
<div class="input-group mb-3 bg-white">
|
||||
<span class="input-group-text">
|
||||
<Icon v="filter" />
|
||||
</span>
|
||||
<input ref="filter" v-model="filter" class="form-control border-primary" :placeholder="$t('crud.filterLong')">
|
||||
<button v-if="filter" class="btn btn-outline-danger" @click="filter = ''; $tRefs.filter?.focus()">
|
||||
<Icon v="times" />
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<NounTemplatesTable :filter="filter" />
|
||||
</Page>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import { head } from '../src/helpers.ts';
|
||||
|
||||
interface Refs {
|
||||
filter: HTMLInputElement | undefined;
|
||||
}
|
||||
|
||||
export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
filter: '',
|
||||
};
|
||||
},
|
||||
head() {
|
||||
return head({
|
||||
title: this.$t('nouns.headerLonger'),
|
||||
description: this.$t('nouns.description'),
|
||||
}, this.$translator);
|
||||
},
|
||||
computed: {
|
||||
$tRefs(): Refs {
|
||||
return this.$refs as unknown as Refs;
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
@ -876,7 +876,7 @@ export interface NounRaw {
|
||||
}
|
||||
|
||||
export const genders = ['masc', 'fem', 'neutr'] as const;
|
||||
const gendersWithNumerus = ['masc', 'fem', 'neutr', 'mascPl', 'femPl', 'neutrPl'] as const;
|
||||
export const gendersWithNumerus = ['masc', 'fem', 'neutr', 'mascPl', 'femPl', 'neutrPl'] as const;
|
||||
|
||||
export class Noun {
|
||||
id: string;
|
||||
|
@ -2,11 +2,11 @@ import { describe, expect, test } from '@jest/globals';
|
||||
|
||||
import allLocales from '../../locale/locales.ts';
|
||||
import { loadTsv } from '../../src/tsv.ts';
|
||||
import { Example } from '../../src/classes.ts';
|
||||
import { Example, gendersWithNumerus } from '../../src/classes.ts';
|
||||
import type { ExpectationResult } from 'expect';
|
||||
import { loadSumlFromBase } from '../../server/loader.ts';
|
||||
import type { Config } from '../../locale/config.ts';
|
||||
import type { PronounExamplesData, PronounsData } from '../../plugins/data';
|
||||
import type { NounTemplatesData, PronounExamplesData, PronounsData } from '../../plugins/data';
|
||||
|
||||
const __dirname = new URL('.', import.meta.url).pathname;
|
||||
|
||||
@ -41,6 +41,8 @@ describe.each(allLocales)('data files of $code', ({ code }) => {
|
||||
|
||||
const examples = loadTsv<PronounExamplesData>(`${__dirname}/../../locale/${code}/pronouns/examples.tsv`);
|
||||
|
||||
const nounTemplates = loadTsv<NounTemplatesData>(`${__dirname}/../../locale/${code}/nouns/nounTemplates.tsv`);
|
||||
|
||||
test('pronouns/pronouns.tsv match schema', async () => {
|
||||
const { default: MORPHEMES } = await import(`../../locale/${code}/pronouns/morphemes.js`);
|
||||
const pronouns = loadTsv<PronounsData<string[]>>(`${__dirname}/../../locale/${code}/pronouns/pronouns.tsv`);
|
||||
@ -96,4 +98,23 @@ describe.each(allLocales)('data files of $code', ({ code }) => {
|
||||
const hasExamplesWithHonorifics = examples.some((example) => example.isHonorific);
|
||||
expect(hasExamplesWithHonorifics).toBe(!!config.pronouns.honorifics);
|
||||
});
|
||||
|
||||
test('nouns/nounTemplates.tsv match schema', () => {
|
||||
if (nounTemplates.length === 0) {
|
||||
return;
|
||||
}
|
||||
const required = ['masc', 'fem', 'neutr', 'mascPl', 'femPl', 'neutrPl'];
|
||||
const actual = Object.keys(nounTemplates[0]);
|
||||
expect(actual).toEqual(required);
|
||||
});
|
||||
test('nouns/nounTemplates.tsv contains templates when templates are enabled', () => {
|
||||
expect(nounTemplates.length > 0).toBe(config.nouns.templates?.enabled);
|
||||
});
|
||||
test('nouns/nounTemplates.tsv have exactly one hyphen as placeholder for root', () => {
|
||||
for (const template of nounTemplates) {
|
||||
for (const genderWithNumerus of gendersWithNumerus) {
|
||||
expect(template[genderWithNumerus]).toMatch(/^(?:[^-]*-[^-]*(?:\/|$))+/);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user