Skip to content

Conversation

@WillRayAtPropertyMe
Copy link

Fix: when input is ALL CAPS (multi-letter), pluralization should produce an ALL CAPS plural (e.g., 'SINGULAR TYPE NAME' -> 'SINGULAR TYPE NAMES').

Files changed: src/Humanizer/Inflections/Vocabulary.cs, src/Humanizer.Tests/InflectorTests.cs

This adds a check to uppercase the full replacement when the input contains multiple letters and is all uppercase, and adds tests to cover the behavior.

Runs tests: dotnet test (net8.0/net10.0) - all passing.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3e9a65a1ac

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +218 to +220
if (lettersCount > 1 && allLettersUpper)
{
return replacement.ToUpperInvariant();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use culture-aware uppercasing for ALL CAPS

On all-caps inputs, replacement.ToUpperInvariant() ignores the current culture. In locales with special casing (e.g., tr-TR), pluralizing an all-caps word containing i will yield ISIMLER instead of İSİMLER, so the output no longer respects locale-specific casing rules. Consider using a culture-aware uppercasing method (consistent with other casing in this class) to preserve correct localization behavior.

Useful? React with 👍 / 👎.

Comment on lines +202 to +213
foreach (var c in word)
{
if (char.IsLetter(c))
{
lettersCount++;
if (!char.IsUpper(c))
{
allLettersUpper = false;
break;
}
}
}

Check notice

Code scanning / CodeQL

Missed opportunity to use All Note

This foreach loop looks as if it might be testing whether every sequence element satisfies a predicate - consider using '.All(...)'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant