3

I have managed to singularize/pluralize an English word using Humanizer, but when I set the CultureInfo to Italian, it just adds an extra 's' to the word.

For example:

"Man".Pluralize() => "Men" ----- correct, It works as expected

"Spaghetto".Pluralize() => "Spaghettos" ----- wrong, It should be "Spaghetti"

I'm afraid it can't find the italian package Humanizer.Core.it, even though I have correctly installed everything!

Is this a bug or am I missing out something? If not, should I be writing my own set of rules and dictionary or is there another library I can use?

I'm currently working with .NET 4.x .

Thank you in advance, cheers!

Lorenzo Goldoni
  • 555
  • 6
  • 22
  • 1
    Never new that Spaghetti does have a singular form. Does it work the other way arround (singularize spaghetti)? – Alex Dec 05 '18 at 15:38
  • 2
    No, if I try to singularize any Italian word it will just return an empty string! And yes, spaghetto is a legit word :) – Lorenzo Goldoni Dec 06 '18 at 16:13

1 Answers1

3

You will come across words from time to time that do this, and you can of course just add to your own dictionary for Humanizer.

Declare this on your page.

using Humanizer.Inflections;

Then add your custom word to the vocabulary.

Vocabularies.Default.AddPlural("Spaghetto", "Spaghetti");

From here you can use the Pluralise on Spaghetto as much as you want, knowing you will always get Spaghetti.

Humanizer documentation for adding vocabulary found here: https://github.com/Humanizr/Humanizer#adding-words

Stephen85
  • 250
  • 1
  • 15