(ts) migrate pl noun pages to composition API with typescript

This commit is contained in:
Valentyne Stigloher 2025-01-06 22:59:22 +01:00
parent 7ec96ac130
commit d7794ffdab
7 changed files with 589 additions and 628 deletions

View File

@ -7,7 +7,7 @@ const props = withDefaults(defineProps<{
word: string; word: string;
plural?: boolean; plural?: boolean;
singularOptions?: string[]; singularOptions?: string[];
template?: NounDeclension; template?: NounDeclension | null;
open?: boolean; open?: boolean;
condense?: boolean; condense?: boolean;
tooltip?: boolean; tooltip?: boolean;

14
locale/dataFiles.d.ts vendored
View File

@ -40,6 +40,20 @@ declare module '*/nouns/nounTemplates.tsv' {
export default data; export default data;
} }
declare module 'locale/pl/nouns/dukatywy.tsv' {
import type { NounTemplatesData } from '~/locale/data.ts';
const data: NounTemplatesData[];
export default data;
}
declare module 'locale/pl/nouns/iksatywy.tsv' {
import type { NounTemplatesData } from '~/locale/data.ts';
const data: NounTemplatesData[];
export default data;
}
declare module '*.tsv' { declare module '*.tsv' {
const data: Record<string, any>[]; const data: Record<string, any>[];
export default data; export default data;

View File

@ -1,3 +1,218 @@
<script setup lang="ts">
import { useNuxtApp } from 'nuxt/app';
import NounsNav from './NounsNav.vue';
import templates from './dukatywy.tsv';
import useConfig from '~/composables/useConfig.ts';
import type { NounTemplatesData } from '~/locale/data.ts';
import { gendersWithNumerus, Noun, NounDeclension, SourceLibrary } from '~/src/classes.ts';
import type { NounRaw, Source } from '~/src/classes.ts';
const dukajDeclension = new NounDeclension({
M: 'u',
D: 'u',
C: 'u',
B: 'u',
N: 'um',
Msc: 'um',
W: 'u',
M_pl: 'y',
D_pl: 'ych',
C_pl: 'ym',
B_pl: 'ych',
N_pl: 'ymi',
Msc_pl: 'ych',
W_pl: 'y',
});
const dukajAdjectiveDeclension = new NounDeclension({
M: 'u',
D: 'enu',
C: 'ewu',
B: 'enu',
N: 'um',
Msc: 'um',
W: 'u',
M_pl: 'y',
D_pl: 'ych',
C_pl: 'ym',
B_pl: 'ych',
N_pl: 'ymi',
Msc_pl: 'ych',
W_pl: 'y',
});
const dukajIDeclension = new NounDeclension({
M: 'u',
D: 'u',
C: 'u',
B: 'u',
N: 'um',
Msc: 'um',
W: 'u',
M_pl: 'i',
D_pl: 'ich',
C_pl: 'im',
B_pl: 'ich',
N_pl: 'imi',
Msc_pl: 'ich',
W_pl: 'i',
});
const { $translator: translator } = useNuxtApp();
useSimpleHead({
title: translator.translate('nouns.dukajNouns.header'),
banner: 'img-local/flags/dukaizmy.jpg',
description: translator.translate('nouns.dukajNouns.info')[0],
}, translator);
const config = useConfig();
const dukajNouns = [
new Noun(config, {
id: 'astronauta',
masc: 'astronauta',
fem: 'astronautka',
neutr: 'astronautu',
mascPl: 'astronauci',
femPl: 'astronautki',
neutrPl: 'astronauty',
declension: dukajDeclension,
}),
new Noun(config, {
id: 'przyjaciel',
masc: 'przyjaciel',
fem: 'przyjaciółka',
neutr: 'przyjaciołu',
mascPl: 'przyjaciele',
femPl: 'przyjaciółki',
neutrPl: 'przyjacioły',
declension: dukajDeclension,
}),
new Noun(config, {
id: 'twórca',
masc: 'twórca',
fem: 'twórczyni',
neutr: 'twórcu',
mascPl: 'twórcy',
femPl: 'twórczynie',
neutrPl: 'twórcy',
declension: dukajDeclension,
}),
new Noun(config, {
id: 'radny',
masc: 'radny',
fem: 'radna',
neutr: 'radnu',
mascPl: 'radni',
femPl: 'radne',
neutrPl: 'radny',
declension: dukajAdjectiveDeclension,
}),
new Noun(config, {
id: 'jegomość',
masc: 'jegomość',
fem: 'jejmość',
neutr: 'jenumość',
mascPl: 'ichmoście',
femPl: 'ichmoście',
neutrPl: 'ichmoście',
// declension: new NounDeclension({
// M: 'mość', D: 'mościa', C: 'mościowi', B: 'mościa', N: 'mościem', Msc: 'mościem', W: 'mościu',
// M_pl: 'moście', D_pl: 'mościów', C_pl: 'mościom', B_pl: 'mościów', N_pl: 'mościami', Msc_pl: 'mościami', W_pl: 'moście',
// }),
declension: new NounDeclension({
M: 'mość',
D: 'mościu',
C: 'mościu',
B: 'mościu',
N: 'mościum',
Msc: 'mościum',
W: 'mościu',
M_pl: 'moście',
D_pl: 'mościch',
C_pl: 'mościm',
B_pl: 'mościm',
N_pl: 'mościch',
Msc_pl: 'mościmi',
W_pl: 'moście',
}),
}),
];
const dukajExtendedDeclension = new NounDeclension({
M: 'tenu kosmicznu twórcu',
D: 'tenu kosmicznenu twórcu',
C: 'tewu kosmicznewu twórcu',
B: 'tenu kosmicznenu twórcu',
N: 'tum kosmicznum twórcum',
Msc: 'tum kosmicznum twórcum',
W: 'ty kosmicznu twórcu',
M_pl: 'teny kosmiczny twórcy',
D_pl: 'tych kosmicznych twórcych',
C_pl: 'tym kosmicznym twórcym',
B_pl: 'tych kosmicznych twórcych',
N_pl: 'tymi kosmicznymi twórcymi',
Msc_pl: 'tych kosmicznych twórcych',
W_pl: 'wy kosmiczny twórcy',
});
const generatorWord = ref('fotograf');
const template = computed((): NounTemplatesData | null => {
let longestMatch = 0;
let matchingTemplates: NounTemplatesData[] = [];
for (const t of templates) {
if (!generatorWord.value.endsWith(t.masc)) {
continue;
}
if (t.masc.length > longestMatch) {
longestMatch = t.masc.length;
matchingTemplates = [t];
} else if (t.masc.length === longestMatch) {
matchingTemplates.push(t);
}
}
if (!matchingTemplates.length) {
return null;
}
return matchingTemplates[0];
});
const generatorResult = computed(() => {
if (!template.value) {
return null;
}
const root = generatorWord.value.substring(0, generatorWord.value.length - (template.value.masc?.length ?? 0));
const result: Partial<NounRaw> = { id: undefined };
for (const genderWithNumerus of gendersWithNumerus) {
result[genderWithNumerus] = template.value[genderWithNumerus]?.split('/').map((ending) => root + ending)
.join(' / ');
}
result.declension = generatorWord.value.endsWith('y') || generatorWord.value.endsWith('i')
? dukajAdjectiveDeclension
: dukajDeclension;
if (template.value.neutrPl?.endsWith('i')) {
result.declension = dukajIDeclension;
}
return new Noun(config, result as NounRaw);
});
const sources = ref<Record<string, Source[] | undefined>>();
onMounted(async () => {
const rawSources = await $fetch('/api/sources?pronoun=dukatywy');
sources.value = {
'': new SourceLibrary(config, rawSources).getForPronoun('dukatywy'),
};
});
</script>
<template> <template>
<Page> <Page>
<NounsNav /> <NounsNav />
@ -211,232 +426,6 @@
</Page> </Page>
</template> </template>
<script>
import { useNuxtApp } from 'nuxt/app';
import NounsNav from './NounsNav.vue';
import templates from './dukatywy.tsv';
import useConfig from '~/composables/useConfig.ts';
import { Noun, NounDeclension, SourceLibrary } from '~/src/classes.ts';
const dukajDeclension = new NounDeclension({
M: 'u',
D: 'u',
C: 'u',
B: 'u',
N: 'um',
Msc: 'um',
W: 'u',
M_pl: 'y',
D_pl: 'ych',
C_pl: 'ym',
B_pl: 'ych',
N_pl: 'ymi',
Msc_pl: 'ych',
W_pl: 'y',
});
const dukajAdjectiveDeclension = new NounDeclension({
M: 'u',
D: 'enu',
C: 'ewu',
B: 'enu',
N: 'um',
Msc: 'um',
W: 'u',
M_pl: 'y',
D_pl: 'ych',
C_pl: 'ym',
B_pl: 'ych',
N_pl: 'ymi',
Msc_pl: 'ych',
W_pl: 'y',
});
const dukajIDeclension = new NounDeclension({
M: 'u',
D: 'u',
C: 'u',
B: 'u',
N: 'um',
Msc: 'um',
W: 'u',
M_pl: 'i',
D_pl: 'ich',
C_pl: 'im',
B_pl: 'ich',
N_pl: 'imi',
Msc_pl: 'ich',
W_pl: 'i',
});
export default {
components: { NounsNav },
setup() {
const { $translator: translator } = useNuxtApp();
useSimpleHead({
title: translator.translate('nouns.dukajNouns.header'),
banner: 'img-local/flags/dukaizmy.jpg',
description: translator.translate('nouns.dukajNouns.info')[0],
}, translator);
return {
config: useConfig(),
};
},
data() {
return {
dukajNouns: [
new Noun(this.config, {
id: 'astronauta',
masc: 'astronauta',
fem: 'astronautka',
neutr: 'astronautu',
mascPl: 'astronauci',
femPl: 'astronautki',
neutrPl: 'astronauty',
declension: dukajDeclension,
}),
new Noun(this.config, {
id: 'przyjaciel',
masc: 'przyjaciel',
fem: 'przyjaciółka',
neutr: 'przyjaciołu',
mascPl: 'przyjaciele',
femPl: 'przyjaciółki',
neutrPl: 'przyjacioły',
declension: dukajDeclension,
}),
new Noun(this.config, {
id: 'twórca',
masc: 'twórca',
fem: 'twórczyni',
neutr: 'twórcu',
mascPl: 'twórcy',
femPl: 'twórczynie',
neutrPl: 'twórcy',
declension: dukajDeclension,
}),
new Noun(this.config, {
id: 'radny',
masc: 'radny',
fem: 'radna',
neutr: 'radnu',
mascPl: 'radni',
femPl: 'radne',
neutrPl: 'radny',
declension: dukajAdjectiveDeclension,
}),
new Noun(this.config, {
id: 'jegomość',
masc: 'jegomość',
fem: 'jejmość',
neutr: 'jenumość',
mascPl: 'ichmoście',
femPl: 'ichmoście',
neutrPl: 'ichmoście',
// declension: new NounDeclension({
// M: 'mość', D: 'mościa', C: 'mościowi', B: 'mościa', N: 'mościem', Msc: 'mościem', W: 'mościu',
// M_pl: 'moście', D_pl: 'mościów', C_pl: 'mościom', B_pl: 'mościów', N_pl: 'mościami', Msc_pl: 'mościami', W_pl: 'moście',
// }),
declension: new NounDeclension({
M: 'mość',
D: 'mościu',
C: 'mościu',
B: 'mościu',
N: 'mościum',
Msc: 'mościum',
W: 'mościu',
M_pl: 'moście',
D_pl: 'mościch',
C_pl: 'mościm',
B_pl: 'mościm',
N_pl: 'mościch',
Msc_pl: 'mościmi',
W_pl: 'moście',
}),
}),
],
dukajDeclension,
dukajAdjectiveDeclension,
dukajExtendedDeclension: new NounDeclension({
M: 'tenu kosmicznu twórcu',
D: 'tenu kosmicznenu twórcu',
C: 'tewu kosmicznewu twórcu',
B: 'tenu kosmicznenu twórcu',
N: 'tum kosmicznum twórcum',
Msc: 'tum kosmicznum twórcum',
W: 'ty kosmicznu twórcu',
M_pl: 'teny kosmiczny twórcy',
D_pl: 'tych kosmicznych twórcych',
C_pl: 'tym kosmicznym twórcym',
B_pl: 'tych kosmicznych twórcych',
N_pl: 'tymi kosmicznymi twórcymi',
Msc_pl: 'tych kosmicznych twórcych',
W_pl: 'wy kosmiczny twórcy',
}),
sources: undefined,
templates,
generatorWord: 'fotograf',
};
},
computed: {
template() {
let longestMatch = 0;
let matchingTemplates = [];
for (const t of templates) {
if (!this.generatorWord.endsWith(t.masc)) {
continue;
}
if (t.masc.length > longestMatch) {
longestMatch = t.masc.length;
matchingTemplates = [t];
} else if (t.masc.length === longestMatch) {
matchingTemplates.push(t);
}
}
if (!matchingTemplates.length) {
return null;
}
return matchingTemplates[0];
},
generatorResult() {
if (!this.template) {
return null;
}
const root = this.generatorWord.substring(0, this.generatorWord.length - this.template.masc.length);
const result = { id: null };
for (const k in this.template) {
if (!this.template.hasOwnProperty(k)) {
continue;
}
result[k] = this.template[k].split('/').map((ending) => root + ending)
.join(' / ');
}
result.declension = this.generatorWord.endsWith('y') || this.generatorWord.endsWith('i')
? dukajAdjectiveDeclension
: dukajDeclension;
if (this.template.neutrPl.endsWith('i')) {
result.declension = dukajIDeclension;
}
return new Noun(this.config, result);
},
},
async mounted() {
const rawSources = await $fetch('/api/sources?pronoun=dukatywy');
this.sources = {
'': new SourceLibrary(this.config, rawSources).getForPronoun('dukatywy'),
};
},
};
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "assets/variables"; @import "assets/variables";

View File

@ -1,3 +1,160 @@
<script setup lang="ts">
import { useNuxtApp } from 'nuxt/app';
import NounsNav from './NounsNav.vue';
import templates from './iksatywy.tsv';
import useConfig from '~/composables/useConfig.ts';
import type { NounTemplatesData } from '~/locale/data.ts';
import { gendersWithNumerus, Noun, NounDeclension, SourceLibrary } from '~/src/classes.ts';
import type { NounRaw, Source } from '~/src/classes.ts';
const xDeclension = new NounDeclension({
M: 'x',
D: 'x',
C: 'x',
B: 'x',
N: 'x',
Msc: 'x',
W: 'x',
M_pl: 'xx',
D_pl: 'xx',
C_pl: 'xx',
B_pl: 'xx',
N_pl: 'xx',
Msc_pl: 'xx',
W_pl: 'xx',
});
const { $translator: translator } = useNuxtApp();
useSimpleHead({
title: translator.translate('nouns.xNouns.header'),
banner: 'img-local/flags/iksatywy.png',
description: translator.translate('nouns.xNouns.info')[0],
}, translator);
const config = useConfig();
const xNouns = [
new Noun(config, {
id: 'astronauta',
masc: 'astronauta',
fem: 'astronautka',
neutr: 'astronautxa',
mascPl: 'astronauci',
femPl: 'astronautki',
neutrPl: 'astronautxx',
declension: xDeclension,
}),
new Noun(config, {
id: 'Europejczyk',
masc: 'Europejczyk',
fem: 'Europejka',
neutr: 'Europejkx',
mascPl: 'Europejczycy',
femPl: 'Europejki',
neutrPl: 'Europejkxx',
declension: xDeclension,
}),
new Noun(config, {
id: 'przyjaciel',
masc: 'przyjaciel',
fem: 'przyjaciółka',
neutr: 'przyjaciołx',
mascPl: 'przyjaciele',
femPl: 'przyjaciółki',
neutrPl: 'przyjaciołxx',
declension: xDeclension,
}),
new Noun(config, {
id: 'twórca',
masc: 'twórca',
fem: 'twórczyni',
neutr: 'twórcx',
mascPl: 'twórcy',
femPl: 'twórczynie',
neutrPl: 'twórcxx',
declension: xDeclension,
}),
new Noun(config, {
id: 'radny',
masc: 'radny',
fem: 'radna',
neutr: 'radnx',
mascPl: 'radni',
femPl: 'radne',
neutrPl: 'radnxx',
declension: xDeclension,
}),
];
const xExtendedDeclension = new NounDeclension({
M: 'tx kosmicznx twórcx',
D: 'tx kosmicznx twórcx',
C: 'tx kosmicznx twórcx',
B: 'tx kosmicznx twórcx',
N: 'tx kosmicznx twórcx',
Msc: 'tx kosmicznx twórcx',
W: 'tx kosmicznx twórcx',
M_pl: 'txx kosmicznxx twórcxx',
D_pl: 'txx kosmicznxx twórcxx',
C_pl: 'txx kosmicznxx twórcxx',
B_pl: 'txx kosmicznxx twórcxx',
N_pl: 'txx kosmicznxx twórcxx',
Msc_pl: 'txx kosmicznxx twórcxx',
W_pl: 'txx kosmicznxx twórcxx',
});
const generatorWord = ref('fotograf');
const template = computed((): NounTemplatesData | null => {
let longestMatch = 0;
let matchingTemplates: NounTemplatesData[] = [];
for (const t of templates) {
if (!generatorWord.value.endsWith(t.masc)) {
continue;
}
if (t.masc.length > longestMatch) {
longestMatch = t.masc.length;
matchingTemplates = [t];
} else if (t.masc.length === longestMatch) {
matchingTemplates.push(t);
}
}
if (!matchingTemplates.length) {
return null;
}
return matchingTemplates[0];
});
const generatorResult = computed(() => {
if (!template.value) {
return null;
}
const root = generatorWord.value.substring(0, generatorWord.value.length - (template.value.masc?.length ?? 0));
const result: Partial<NounRaw> = { id: undefined };
for (const genderWithNumerus of gendersWithNumerus) {
result[genderWithNumerus] = template.value[genderWithNumerus]?.split('/').map((ending) => root + ending)
.join(' / ');
}
result.declension = xDeclension;
return new Noun(config, result as NounRaw);
});
const sources = ref<Record<string, Source[] | undefined>>();
onMounted(async () => {
const rawSources = await $fetch('/api/sources?pronoun=iksatywy');
sources.value = {
'': new SourceLibrary(config, rawSources).getForPronoun('iksatywy'),
};
});
</script>
<template> <template>
<Page> <Page>
<NounsNav /> <NounsNav />
@ -210,174 +367,6 @@
</Page> </Page>
</template> </template>
<script>
import { useNuxtApp } from 'nuxt/app';
import NounsNav from './NounsNav.vue';
import templates from './iksatywy.tsv';
import useConfig from '~/composables/useConfig.ts';
import { Noun, NounDeclension, SourceLibrary } from '~/src/classes.ts';
const xDeclension = new NounDeclension({
M: 'x',
D: 'x',
C: 'x',
B: 'x',
N: 'x',
Msc: 'x',
W: 'x',
M_pl: 'xx',
D_pl: 'xx',
C_pl: 'xx',
B_pl: 'xx',
N_pl: 'xx',
Msc_pl: 'xx',
W_pl: 'xx',
});
export default {
components: { NounsNav },
setup() {
const { $translator: translator } = useNuxtApp();
useSimpleHead({
title: translator.translate('nouns.xNouns.header'),
banner: 'img-local/flags/iksatywy.png',
description: translator.translate('nouns.xNouns.info')[0],
}, translator);
return {
config: useConfig(),
};
},
data() {
return {
xNouns: [
new Noun(this.config, {
id: 'astronauta',
masc: 'astronauta',
fem: 'astronautka',
neutr: 'astronautxa',
mascPl: 'astronauci',
femPl: 'astronautki',
neutrPl: 'astronautxx',
declension: xDeclension,
}),
new Noun(this.config, {
id: 'Europejczyk',
masc: 'Europejczyk',
fem: 'Europejka',
neutr: 'Europejkx',
mascPl: 'Europejczycy',
femPl: 'Europejki',
neutrPl: 'Europejkxx',
declension: xDeclension,
}),
new Noun(this.config, {
id: 'przyjaciel',
masc: 'przyjaciel',
fem: 'przyjaciółka',
neutr: 'przyjaciołx',
mascPl: 'przyjaciele',
femPl: 'przyjaciółki',
neutrPl: 'przyjaciołxx',
declension: xDeclension,
}),
new Noun(this.config, {
id: 'twórca',
masc: 'twórca',
fem: 'twórczyni',
neutr: 'twórcx',
mascPl: 'twórcy',
femPl: 'twórczynie',
neutrPl: 'twórcxx',
declension: xDeclension,
}),
new Noun(this.config, {
id: 'radny',
masc: 'radny',
fem: 'radna',
neutr: 'radnx',
mascPl: 'radni',
femPl: 'radne',
neutrPl: 'radnxx',
declension: xDeclension,
}),
],
xDeclension,
xExtendedDeclension: new NounDeclension({
M: 'tx kosmicznx twórcx',
D: 'tx kosmicznx twórcx',
C: 'tx kosmicznx twórcx',
B: 'tx kosmicznx twórcx',
N: 'tx kosmicznx twórcx',
Msc: 'tx kosmicznx twórcx',
W: 'tx kosmicznx twórcx',
M_pl: 'txx kosmicznxx twórcxx',
D_pl: 'txx kosmicznxx twórcxx',
C_pl: 'txx kosmicznxx twórcxx',
B_pl: 'txx kosmicznxx twórcxx',
N_pl: 'txx kosmicznxx twórcxx',
Msc_pl: 'txx kosmicznxx twórcxx',
W_pl: 'txx kosmicznxx twórcxx',
}),
sources: undefined,
templates,
generatorWord: 'fotograf',
};
},
computed: {
template() {
let longestMatch = 0;
let matchingTemplates = [];
for (const t of templates) {
if (!this.generatorWord.endsWith(t.masc)) {
continue;
}
if (t.masc.length > longestMatch) {
longestMatch = t.masc.length;
matchingTemplates = [t];
} else if (t.masc.length === longestMatch) {
matchingTemplates.push(t);
}
}
if (!matchingTemplates.length) {
return null;
}
return matchingTemplates[0];
},
generatorResult() {
if (!this.template) {
return null;
}
const root = this.generatorWord.substring(0, this.generatorWord.length - this.template.masc.length);
const result = { id: null };
for (const k in this.template) {
if (!this.template.hasOwnProperty(k)) {
continue;
}
result[k] = this.template[k].split('/').map((ending) => root + ending)
.join(' / ');
}
result.declension = xDeclension;
return new Noun(this.config, result);
},
},
async mounted() {
const rawSources = await $fetch('/api/sources?pronoun=iksatywy');
this.sources = {
'': new SourceLibrary(this.config, rawSources).getForPronoun('iksatywy'),
};
},
};
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "assets/variables"; @import "assets/variables";

View File

@ -1,3 +1,129 @@
<script setup lang="ts">
import { useNuxtApp } from 'nuxt/app';
import NounsNav from './NounsNav.vue';
import useSimpleHead from '~/composables/useSimpleHead.ts';
import { NounDeclension } from '~/src/classes.ts';
const { $translator: translator } = useNuxtApp();
useSimpleHead({
title: translator.translate('nouns.neuterNouns.header'),
banner: 'img-local/flags/łoś.jpg',
description: translator.translate('nouns.neuterNouns.info')[0],
}, translator);
const neuterExtendedDeclension = new NounDeclension({
M: 'to kosmiczne twórcze',
D: 'tego kosmicznego twórcza',
C: 'temu kosmicznemu twórczu',
B: 'to kosmiczne twórcze',
N: 'tym kosmicznym twórczem',
Msc: 'tym kosmicznym twórczu',
W: 'to kosmiczne twórcze',
M_pl: 'te kosmiczne twórcza',
D_pl: 'tych kosmicznych twórczy',
C_pl: 'tym kosmicznym twórczom',
B_pl: 'te kosmiczne twórcza',
N_pl: 'tymi kosmicznymi twórczami',
Msc_pl: 'tych kosmicznych twórczach',
W_pl: 'te kosmiczne twórcza',
});
const neuterAltDeclensionTemplates = [
['ono/jego'], // , 'vono/vego', 'ono/jejgo'],
['ono/jej'],
['ono/jeno'],
['ono/jenu'],
];
const neuterAltDeclension = {
księgowe: [
new NounDeclension({
M: 'owe', D: 'owego', C: 'owemu', B: 'owe', N: 'owem/owym', Msc: 'owem/owym', W: 'owe',
}),
new NounDeclension({
M: 'owe', D: 'owej', C: 'owej', B: 'owe', N: 'ową', Msc: 'owej', W: 'owe',
}),
new NounDeclension({
M: 'owe', D: 'oweno', C: 'owenu', B: 'owe/oweno', N: 'owem', Msc: 'owem', W: 'owe',
}),
new NounDeclension({
M: 'owe', D: 'owu', C: 'owenu', B: 'owe', N: 'owum', Msc: 'owum', W: 'owe',
}),
],
pracownicze: [
new NounDeclension({
M: 'cze', D: 'cza', C: 'czu', B: 'cze', N: 'czem', Msc: 'czu', W: 'cze',
}),
new NounDeclension({
M: 'cze', D: 'czy', C: 'czy', B: 'czę', N: 'czą', Msc: 'czy', W: 'czo',
}),
new NounDeclension({
M: 'cze', D: 'cza', C: 'czu', B: 'cze', N: 'czem', Msc: 'czu', W: 'cze',
}),
new NounDeclension({
M: 'cze', D: 'ku', C: 'ku', B: 'cze', N: 'kum', Msc: 'kum', W: 'cze',
}),
],
kochanie: [
new NounDeclension({
M: 'nie', D: 'nia', C: 'niu', B: 'nie', N: 'niem', Msc: 'niu', W: 'nie',
}),
new NounDeclension({
M: 'nie', D: 'ni', C: 'ni', B: 'nię', N: 'nią', Msc: 'ni', W: 'niu',
}),
new NounDeclension({
M: 'nie', D: 'nia', C: 'niu', B: 'nie', N: 'niem', Msc: 'niu', W: 'nie',
}),
new NounDeclension({
M: 'nie', D: 'niu', C: 'niu', B: 'nie', N: 'nium', Msc: 'nium', W: 'nie',
}),
],
wnuczę: [
new NounDeclension({
M: 'czę', D: 'częcia', C: 'częciu', B: 'czę', N: 'częciem', Msc: 'częciu', W: 'czę',
}),
new NounDeclension({
M: 'czę', D: 'częty', C: 'częcie', B: 'czętę', N: 'czętą', Msc: 'częcie', W: 'częto',
}),
new NounDeclension({
M: 'czę', D: 'częcia', C: 'częciu', B: 'czę', N: 'częciem', Msc: 'częciu', W: 'czę',
}),
new NounDeclension({
M: 'czę', D: 'czu', C: 'czu', B: 'czę', N: 'czum', Msc: 'czum', W: 'czę',
}),
],
Polko: [
new NounDeclension({
M: 'ko', D: 'ka', C: 'ku', B: 'ko', N: 'kiem', Msc: 'ku', W: 'ko',
}),
new NounDeclension({
M: 'ko', D: 'ki', C: 'ce', B: 'ko', N: 'ką', Msc: 'ce', W: 'ko',
}),
new NounDeclension({
M: 'ko', D: 'ka', C: 'ku', B: 'ko', N: 'kiem', Msc: 'ku', W: 'ko',
}),
new NounDeclension({
M: 'ko', D: 'ku', C: 'ku', B: 'ko', N: 'kum', Msc: 'kum', W: 'ko',
}),
],
kociaro: [
new NounDeclension({
M: 'ro', D: 'ra', C: 'rzu', B: 'ro', N: 'rem', Msc: 'rzu', W: 'ro',
}),
new NounDeclension({
M: 'ro', D: 'ry', C: 'rze', B: 'rę', N: 'rą', Msc: 'rze', W: 'ro',
}),
new NounDeclension({
M: 'ro', D: 'ra', C: 'rzu', B: 'ro', N: 'rem', Msc: 'rzu', W: 'ro',
}),
new NounDeclension({
M: 'ro', D: 'ru', C: 'ru', B: 'ro', N: 'rum', Msc: 'rum', W: 'ro',
}),
],
};
</script>
<template> <template>
<Page> <Page>
<NounsNav /> <NounsNav />
@ -97,159 +223,10 @@
<Separator icon="atom-alt" /> <Separator icon="atom-alt" />
<NounsDictionary ref="dictionary" load /> <NounsDictionary load />
</Page> </Page>
</template> </template>
<script lang="ts">
import { useNuxtApp } from 'nuxt/app';
import { defineComponent } from 'vue';
import NounsNav from './NounsNav.vue';
import type Dictionary from '~/components/nouns/NounsDictionary.vue';
import useConfig from '~/composables/useConfig.ts';
import useSimpleHead from '~/composables/useSimpleHead.ts';
import { NounDeclension } from '~/src/classes.ts';
interface Refs {
dictionary: InstanceType<typeof Dictionary> | undefined;
}
export default defineComponent({
components: { NounsNav },
setup() {
const { $translator: translator } = useNuxtApp();
useSimpleHead({
title: translator.translate('nouns.neuterNouns.header'),
banner: 'img-local/flags/łoś.jpg',
description: translator.translate('nouns.neuterNouns.info')[0],
}, translator);
return {
config: useConfig(),
};
},
data() {
return {
neuterExtendedDeclension: new NounDeclension({
M: 'to kosmiczne twórcze',
D: 'tego kosmicznego twórcza',
C: 'temu kosmicznemu twórczu',
B: 'to kosmiczne twórcze',
N: 'tym kosmicznym twórczem',
Msc: 'tym kosmicznym twórczu',
W: 'to kosmiczne twórcze',
M_pl: 'te kosmiczne twórcza',
D_pl: 'tych kosmicznych twórczy',
C_pl: 'tym kosmicznym twórczom',
B_pl: 'te kosmiczne twórcza',
N_pl: 'tymi kosmicznymi twórczami',
Msc_pl: 'tych kosmicznych twórczach',
W_pl: 'te kosmiczne twórcza',
}),
neuterAltDeclensionTemplates: [
['ono/jego'], // , 'vono/vego', 'ono/jejgo'],
['ono/jej'],
['ono/jeno'],
['ono/jenu'],
],
neuterAltDeclension: {
księgowe: [
new NounDeclension({
M: 'owe', D: 'owego', C: 'owemu', B: 'owe', N: 'owem/owym', Msc: 'owem/owym', W: 'owe',
}),
new NounDeclension({
M: 'owe', D: 'owej', C: 'owej', B: 'owe', N: 'ową', Msc: 'owej', W: 'owe',
}),
new NounDeclension({
M: 'owe', D: 'oweno', C: 'owenu', B: 'owe/oweno', N: 'owem', Msc: 'owem', W: 'owe',
}),
new NounDeclension({
M: 'owe', D: 'owu', C: 'owenu', B: 'owe', N: 'owum', Msc: 'owum', W: 'owe',
}),
],
pracownicze: [
new NounDeclension({
M: 'cze', D: 'cza', C: 'czu', B: 'cze', N: 'czem', Msc: 'czu', W: 'cze',
}),
new NounDeclension({
M: 'cze', D: 'czy', C: 'czy', B: 'czę', N: 'czą', Msc: 'czy', W: 'czo',
}),
new NounDeclension({
M: 'cze', D: 'cza', C: 'czu', B: 'cze', N: 'czem', Msc: 'czu', W: 'cze',
}),
new NounDeclension({
M: 'cze', D: 'ku', C: 'ku', B: 'cze', N: 'kum', Msc: 'kum', W: 'cze',
}),
],
kochanie: [
new NounDeclension({
M: 'nie', D: 'nia', C: 'niu', B: 'nie', N: 'niem', Msc: 'niu', W: 'nie',
}),
new NounDeclension({
M: 'nie', D: 'ni', C: 'ni', B: 'nię', N: 'nią', Msc: 'ni', W: 'niu',
}),
new NounDeclension({
M: 'nie', D: 'nia', C: 'niu', B: 'nie', N: 'niem', Msc: 'niu', W: 'nie',
}),
new NounDeclension({
M: 'nie', D: 'niu', C: 'niu', B: 'nie', N: 'nium', Msc: 'nium', W: 'nie',
}),
],
wnuczę: [
new NounDeclension({
M: 'czę', D: 'częcia', C: 'częciu', B: 'czę', N: 'częciem', Msc: 'częciu', W: 'czę',
}),
new NounDeclension({
M: 'czę', D: 'częty', C: 'częcie', B: 'czętę', N: 'czętą', Msc: 'częcie', W: 'częto',
}),
new NounDeclension({
M: 'czę', D: 'częcia', C: 'częciu', B: 'czę', N: 'częciem', Msc: 'częciu', W: 'czę',
}),
new NounDeclension({
M: 'czę', D: 'czu', C: 'czu', B: 'czę', N: 'czum', Msc: 'czum', W: 'czę',
}),
],
Polko: [
new NounDeclension({
M: 'ko', D: 'ka', C: 'ku', B: 'ko', N: 'kiem', Msc: 'ku', W: 'ko',
}),
new NounDeclension({
M: 'ko', D: 'ki', C: 'ce', B: 'ko', N: 'ką', Msc: 'ce', W: 'ko',
}),
new NounDeclension({
M: 'ko', D: 'ka', C: 'ku', B: 'ko', N: 'kiem', Msc: 'ku', W: 'ko',
}),
new NounDeclension({
M: 'ko', D: 'ku', C: 'ku', B: 'ko', N: 'kum', Msc: 'kum', W: 'ko',
}),
],
kociaro: [
new NounDeclension({
M: 'ro', D: 'ra', C: 'rzu', B: 'ro', N: 'rem', Msc: 'rzu', W: 'ro',
}),
new NounDeclension({
M: 'ro', D: 'ry', C: 'rze', B: 'rę', N: 'rą', Msc: 'rze', W: 'ro',
}),
new NounDeclension({
M: 'ro', D: 'ra', C: 'rzu', B: 'ro', N: 'rem', Msc: 'rzu', W: 'ro',
}),
new NounDeclension({
M: 'ro', D: 'ru', C: 'ru', B: 'ro', N: 'rum', Msc: 'rum', W: 'ro',
}),
],
},
};
},
computed: {
$tRefs(): Refs {
return this.$refs as unknown as Refs;
},
},
});
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "assets/variables"; @import "assets/variables";

View File

@ -1,3 +1,76 @@
<script setup lang="ts">
import { useNuxtApp } from 'nuxt/app';
import NounsNav from './NounsNav.vue';
import useConfig from '~/composables/useConfig.ts';
import { Noun, type Source, SourceLibrary } from '~/src/classes.ts';
const { $translator: translator } = useNuxtApp();
useSimpleHead({
title: translator.translate('nouns.personNouns.header'),
description: translator.translate('nouns.personNouns.info')[0],
}, translator);
const config = useConfig();
const personNouns = [
new Noun(config, {
id: 'kandydat',
masc: 'kandydat',
fem: 'kandydatka',
neutr: 'osoba kandydująca',
mascPl: 'kandydaci',
femPl: 'kandydatki',
neutrPl: 'osoby kandydujące',
}),
new Noun(config, {
id: 'kucharz',
masc: 'kucharz',
fem: 'kucharka',
neutr: 'osoba gotująca|osoba kucharska',
mascPl: 'kucharze',
femPl: 'kucharki',
neutrPl: 'osoby gotujące|osoby kucharskie',
}),
new Noun(config, {
id: 'mężczyzna',
masc: 'mężczyzna',
fem: 'kobieta',
neutr: 'osoba|osoba niebinarna',
mascPl: 'mężczyźni',
femPl: 'kobiety',
neutrPl: 'osoby|osoby niebinarne',
}),
new Noun(config, {
id: 'partner',
masc: 'partner',
fem: 'partnerka',
neutr: 'osoba partnerska',
mascPl: 'partnerzy',
femPl: 'partnerki',
neutrPl: 'osoby partnerskie',
}),
new Noun(config, {
id: 'prezes',
masc: 'prezes',
fem: 'prezeska',
neutr: 'osoba prezesująca',
mascPl: 'prezesi',
femPl: 'prezeski',
neutrPl: 'osoby prezesujące',
}),
];
const sources = ref<Record<string, Source[] | undefined>>();
onMounted(async () => {
const rawSources = await $fetch('/api/sources?pronoun=osobatywy');
sources.value = {
'': new SourceLibrary(config, rawSources).getForPronoun('osobatywy'),
};
});
</script>
<template> <template>
<Page> <Page>
<NounsNav /> <NounsNav />
@ -91,84 +164,3 @@
</section> </section>
</Page> </Page>
</template> </template>
<script>
import { useNuxtApp } from 'nuxt/app';
import NounsNav from './NounsNav.vue';
import useConfig from '~/composables/useConfig.ts';
import { Noun, SourceLibrary } from '~/src/classes.ts';
export default {
components: { NounsNav },
setup() {
const { $translator: translator } = useNuxtApp();
useSimpleHead({
title: translator.translate('nouns.personNouns.header'),
description: translator.translate('nouns.personNouns.info')[0],
}, translator);
return {
config: useConfig(),
};
},
data() {
return {
personNouns: [
new Noun(this.config, {
id: 'kandydat',
masc: 'kandydat',
fem: 'kandydatka',
neutr: 'osoba kandydująca',
mascPl: 'kandydaci',
femPl: 'kandydatki',
neutrPl: 'osoby kandydujące',
}),
new Noun(this.config, {
id: 'kucharz',
masc: 'kucharz',
fem: 'kucharka',
neutr: 'osoba gotująca|osoba kucharska',
mascPl: 'kucharze',
femPl: 'kucharki',
neutrPl: 'osoby gotujące|osoby kucharskie',
}),
new Noun(this.config, {
id: 'mężczyzna',
masc: 'mężczyzna',
fem: 'kobieta',
neutr: 'osoba|osoba niebinarna',
mascPl: 'mężczyźni',
femPl: 'kobiety',
neutrPl: 'osoby|osoby niebinarne',
}),
new Noun(this.config, {
id: 'partner',
masc: 'partner',
fem: 'partnerka',
neutr: 'osoba partnerska',
mascPl: 'partnerzy',
femPl: 'partnerki',
neutrPl: 'osoby partnerskie',
}),
new Noun(this.config, {
id: 'prezes',
masc: 'prezes',
fem: 'prezeska',
neutr: 'osoba prezesująca',
mascPl: 'prezesi',
femPl: 'prezeski',
neutrPl: 'osoby prezesujące',
}),
],
sources: undefined,
};
},
async mounted() {
const rawSources = await $fetch('/api/sources?pronoun=osobatywy');
this.sources = {
'': new SourceLibrary(this.config, rawSources).getForPronoun('osobatywy'),
};
},
};
</script>

View File

@ -932,7 +932,7 @@ export interface NounRaw {
approved?: boolean; approved?: boolean;
base_id?: string | null; base_id?: string | null;
author?: string | null; author?: string | null;
declension: unknown; declension?: NounDeclension | null;
} }
export const genders = ['masc', 'fem', 'neutr'] as const; export const genders = ['masc', 'fem', 'neutr'] as const;
@ -952,7 +952,7 @@ export class Noun implements Entry {
approved: boolean; approved: boolean;
base: string | null; base: string | null;
author: string | null; author: string | null;
declension: unknown; declension: NounDeclension | null;
constructor(config: Config, { constructor(config: Config, {
id, masc, fem, neutr, mascPl, femPl, neutrPl, categories = null, sources = null, sourcesData = [], id, masc, fem, neutr, mascPl, femPl, neutrPl, categories = null, sources = null, sourcesData = [],