mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-24 05:05:20 -04:00
(nouns) make noun template variants optional
This commit is contained in:
parent
b918be44a5
commit
7b7841e09b
@ -1,3 +1,5 @@
|
||||
import type { gendersWithNumerus } from '~/src/classes.ts';
|
||||
|
||||
export type PronounData<M extends string> = {
|
||||
key: string;
|
||||
description: string;
|
||||
@ -26,11 +28,6 @@ export interface PronounExamplesData {
|
||||
isHonorific?: boolean;
|
||||
}
|
||||
|
||||
export interface NounTemplatesData {
|
||||
masc: string;
|
||||
fem: string;
|
||||
neutr: string;
|
||||
mascPl: string;
|
||||
femPl: string;
|
||||
neutrPl: string;
|
||||
}
|
||||
export type NounTemplatesData = {
|
||||
[G in typeof gendersWithNumerus[number]]?: string;
|
||||
};
|
||||
|
@ -4,6 +4,8 @@ import type { Config } from '../locale/config.ts';
|
||||
import { buildDict, buildList, capitalise, escapeControlSymbols, escapePronunciationString } from './helpers.ts';
|
||||
import type { Translator } from './translator.ts';
|
||||
|
||||
import type { NounTemplatesData } from '~/locale/data.ts';
|
||||
|
||||
export class ExamplePart {
|
||||
variable: boolean;
|
||||
str: string;
|
||||
@ -1031,14 +1033,14 @@ export class NounTemplate {
|
||||
this.neutrPl = neutrPl;
|
||||
}
|
||||
|
||||
static from(data: Record<typeof gendersWithNumerus[number], string>): NounTemplate {
|
||||
static from(data: NounTemplatesData): NounTemplate {
|
||||
return new NounTemplate(
|
||||
data.masc.split('/'),
|
||||
data.fem.split('/'),
|
||||
data.neutr.split('/'),
|
||||
data.mascPl.split('/'),
|
||||
data.femPl.split('/'),
|
||||
data.neutrPl.split('/'),
|
||||
data.masc?.split('/') ?? [],
|
||||
data.fem?.split('/') ?? [],
|
||||
data.neutr?.split('/') ?? [],
|
||||
data.mascPl?.split('/') ?? [],
|
||||
data.femPl?.split('/') ?? [],
|
||||
data.neutrPl?.split('/') ?? [],
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user