Humanizer icon indicating copy to clipboard operation
Humanizer copied to clipboard

Title casing is not proper

Open petro2050 opened this issue 4 years ago • 3 comments

I changed the current culture to German and tested a title.

Thread.CurrentThread.CurrentUICulture = new CultureInfo("de");
Console.WriteLine(StringHumanizeExtensions.Humanize("Per anhalter durch die Galaxis", LetterCasing.Title));

The result seems to be Per Anhalter Durch Die Galaxis, but the expected result should be Per Anhalter durch die Galaxis.

Can you tell me if your title casing works in the same way as .NET's ToTitleCase (i.e. always caps the first letter of each determiner, preposition, etc.)?

petro2050 avatar May 19 '20 14:05 petro2050

Same problem in English. Humanizer does not appear to conform to standard title capitalization rules about small, non-essential words. https://capitalizemytitle.com/#capitalizationrules

softwareliberationarmy avatar May 28 '20 15:05 softwareliberationarmy

Should LetterCasing.Title (or Titleize) user the "proper" language rules or should it be an option or an entirely new command?

For example:

"romeo and juliet".Humanize(LetterCasing.Title) should be "Romeo and Juliet" "the old man and the sea".Humanize(LetterCasing.Title) should be "The Old Man and the Sea"

I would propose a different method, but I don't know what to call it. LetterCasing.ProperTitle? BookTitle? FormalTitle?

The other problem is that those rules aren't firm between different style guides, even in English: https://capitalizemytitle.com/

For example, "The War Between the States" is "The War between the States" in the Chicago Manual of Style.

I would take a go at working on this (for English at least), but it seems like a big can of worms for the different styles.

cmpalmer66 avatar Aug 25 '20 18:08 cmpalmer66

I'd like to have a go at this, even taking into account the differences among style guides mentioned above. While there is no standard for title casing, the majority of style guides follow pretty close to AP rules on title casing (capitalize first and last words, all major words, and any minor words that are four letters or longer) and I would propose something along that style be the default for LetterCasing.Title. A second method could be added for CMS-like title case to cover instances where that would be preferable (I say "CMS-like" because a full implementation would prove difficult due to specific rules about things like species names that even reference sites like CapitalizeMyTitle ignore.)

jcasteele avatar Oct 01 '20 16:10 jcasteele