Humanizr / Humanizer

Humanizer meets all your .NET needs for manipulating and displaying strings, enums, dates, times, timespans, numbers and quantities

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I specify a culture?

voroninp opened this issue · comments

How do I specify a culture for humanizer to use?
I tried setting both CurrentCultur and CurrentUICulture but they seem to have no effect for Pluralize or Titleize methods.

CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo("nl-NL");
CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo("nl-NL");
"boek".Pluralize().Dump(); // outputs boeks but should be boeken
"ijs".Titleize().Dump(); // outputs Ijs but should be IJs

i think Vocabulary handles Pluralize. and it has the following comment

    /// A container for exceptions to simple pluralization/singularization rules.
    /// Vocabularies.Default contains an extensive list of rules for US English.
    /// At this time, multiple vocabularies and removing existing rules are not supported.

https://github.com/Humanizr/Humanizer/blob/main/src/Humanizer/Inflections/Vocabulary.cs

as for Titleize, why does nl-NL cause ijs to result in IJs?

as for Titleize, why does nl-NL cause ijs to result in IJs?

Is it a question for me? These are the capitalization rules for Dutch: ij should be capitalized together.

These are the capitalization rules for Dutch: ij should be capitalized together.

can u add a link to the Dutch rules that result in that?

@voroninp happy to accept a pull request that fixes the dutch IJ

closing this one for now. since both questions are answered