16 lines
698 B
TypeScript
16 lines
698 B
TypeScript
/**
|
|
* Basic Dutch pluralisation for configurable event labels.
|
|
* Covers the known sub_event_label values: Dag, Programmaonderdeel, Editie, Locatie, Ronde.
|
|
*/
|
|
export function dutchPlural(word: string): string {
|
|
// Words ending in -ie: add -s (editie → edities, locatie → locaties)
|
|
if (word.endsWith('ie')) return `${word}s`
|
|
// Words ending in -e: add -s (ronde → rondes)
|
|
if (word.endsWith('e')) return `${word}s`
|
|
// Double vowel before final consonant(s): single vowel + en (onderdeel → onderdelen)
|
|
const match = word.match(/^(.*)([aeiou])\2([^aeiou]+)$/i)
|
|
if (match) return `${match[1]}${match[2]}${match[3]}en`
|
|
// Default: add -en (dag → dagen)
|
|
return `${word}en`
|
|
}
|