Skip to content

Instantly share code, notes, and snippets.

@mollerhoj
Created July 13, 2017 10:10
Show Gist options
  • Save mollerhoj/790f9d375ca02024ec4c1e4f328ed757 to your computer and use it in GitHub Desktop.
Save mollerhoj/790f9d375ca02024ec4c1e4f328ed757 to your computer and use it in GitHub Desktop.
# Inflections for Danish
# Inflections for Danish
#See https://github.com/rails/rails/blob/9e0b3fc7cfba43af55377488f991348e2de24515/activesupport/lib/active_support/inflections.rb
ActiveSupport::Inflector.inflections(:da) do |inflect|
# General rules
inflect.plural(/$/, 'er')
inflect.plural(/(er)$/, 'ere')
inflect.plural(/(en)$/, 'ene')
inflect.plural(/(et)$/, 'ene')
inflect.plural(/(.)\1er$/, '\1re')
inflect.plural(/(.)\1el$/, '\1ler')
# Special endings
inflect.plural(/l$/, 'ller')
inflect.plural(/pel$/, 'pler')
inflect.plural(/ken$/, 'kner')
inflect.plural(/fel$/, 'fler')
# Ends in stressed vowel + consonant
inflect.plural(/(bus)$/, '\1ser')
inflect.plural(/(dom)$/i, '\1me')
inflect.plural(/(hat)$/, '\1te')
inflect.plural(/(lem)$/, '\1mer')
inflect.plural(/(skel)$/, '\1le')
inflect.plural(/(tik)$/, '\1tik')
inflect.plural(/(ret)$/, '\1ter')
inflect.plural(/(ræd)$/i, '\1der')
inflect.plural(/(ven)$/i, '\1ner')
# Only adds e
inflect.plural(/(adgang)$/i, '\1e')
inflect.plural(/(afstand)$/i, '\1e')
inflect.plural(/(arm)$/i, '\1e')
inflect.plural(/(baggrund)$/i, '\1e')
inflect.plural(/(bølge)$/i, '\1e')
inflect.plural(/(bjerg)$/i, '\1e')
inflect.plural(/(bøsse)$/i, '\1e')
inflect.plural(/(blad)$/i, '\1e')
inflect.plural(/(bjørn)$/i, '\1e')
inflect.plural(/(bold)$/i, '\1e')
inflect.plural(/(bord)$/i, '\1e')
inflect.plural(/(brev)$/i, '\1e')
inflect.plural(/(brud)$/i, '\1e')
inflect.plural(/(bad)$/i, '\1e')
inflect.plural(/(bund)$/i, '\1e')
inflect.plural(/(dag)$/i, '\1e')
inflect.plural(/(dal)$/i, '\1e')
inflect.plural(/(damp)$/i, '\1e')
inflect.plural(/(damp)$/i, '\1e')
inflect.plural(/(del)$/i, '\1e')
inflect.plural(/(dreng)$/i, '\1e')
inflect.plural(/(dør)$/i, '\1e')
inflect.plural(/(fugl)$/i, '\1e')
inflect.plural(/(fremmed)$/i, '\1e')
inflect.plural(/(form)$/i, '\1e')
inflect.plural(/(grav)$/i, '\1e')
inflect.plural(/(gren)$/i, '\1e')
inflect.plural(/(gris)$/i, '\1e')
inflect.plural(/(gulv)$/i, '\1e')
inflect.plural(/(gård)$/i, '\1e')
inflect.plural(/(hund)$/i, '\1e')
inflect.plural(/(hus)$/i, '\1e')
inflect.plural(/(kniv)$/i, '\1e')
inflect.plural(/(navn)$/i, '\1e')
inflect.plural(/(tov)$/i, '\1e')
inflect.plural(/^(skab)$/i, '\1e')
inflect.plural(/^(hav)$/i, '\1e')
# Stays constant
inflect.plural(/(ansvar)$/i, '\1')
inflect.plural(/(ark)$/i, '\1')
inflect.plural(/(ben)$/i, '\1')
inflect.plural(/(behov)$/i, '\1')
inflect.plural(/(beløb)$/i, '\1')
inflect.plural(/(besøg)$/i, '\1')
inflect.plural(/(brød)$/i, '\1')
inflect.plural(/(chok)$/i, '\1')
inflect.plural(/(dyr)$/i, '\1')
inflect.plural(/(dæk)$/i, '\1')
inflect.plural(/(forslag)$/i, '\1')
inflect.plural(/(frø)$/i, '\1')
inflect.plural(/(flok)$/i, '\1')
inflect.plural(/(får)$/i, '\1')
inflect.plural(/(fag)$/i, '\1')
inflect.plural(/(fejl)$/i, '\1')
inflect.plural(/(film)$/i, '\1')
inflect.plural(/(fisk)$/i, '\1')
inflect.plural(/(flag)$/i, '\1')
inflect.plural(/(fly)$/i, '\1')
inflect.plural(/(glas)$/i, '\1')
inflect.plural(/(mus)$/i, '\1')
inflect.plural(/(råd)$/i, '\1')
inflect.plural(/(sko)$/i, '\1')
inflect.plural(/(syn)$/i, '\1')
inflect.plural(/(søg)$/i, '\1')
inflect.plural(/(tryk)$/i, '\1')
inflect.plural(/(år)$/i, '\1')
# Ends with stressed e
inflect.plural(/(ble)$/, '\1er')
inflect.plural(/(ide)$/, '\1er')
inflect.plural(/(klaver)$/, '\1klaverer')
inflect.plural(/(ske)$/, '\1er')
# Change vowel
inflect.plural(/and$/, 'ænder')
inflect.plural(/anden$/, 'ænderne')
inflect.plural(/barn$/, 'børn')
inflect.plural(/barnet$/, 'børnene')
inflect.plural(/bonde$/, 'bønder')
inflect.plural(/bog$/, 'bøger')
inflect.plural(/bogen$/, 'bøgerne')
inflect.plural(/bonden$/, 'bønderne')
inflect.plural(/datter$/, 'døtre')
inflect.plural(/datteren$/, 'døtrene')
inflect.plural(/far$/, 'fædre')
inflect.plural(/faren$/, 'fædrene')
inflect.plural(/fader$/, 'fædre')
inflect.plural(/faderen$/, 'fædrene')
inflect.plural(/fod$/, 'fødder')
inflect.plural(/foden$/, 'fødderne')
inflect.plural(/rod$/, 'rødder')
inflect.plural(/roden$/, 'rødderne')
inflect.plural(/stang$/, 'stænger')
inflect.plural(/stangen$/, 'stængerne')
inflect.plural(/mand$/, 'mænd')
inflect.plural(/manden$/, 'mændene')
# Irregular
inflect.plural(/faktum$/, 'fakta')
inflect.plural(/museum$/, 'museer')
inflect.plural(/øje$/, 'øjne')
inflect.plural(/øjet$/, 'øjnene')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment