Skip to content

Fixing consistency issues with pluralization in UI#1304

Draft
CYBRXT wants to merge 1 commit into
we-promise:mainfrom
CYBRXT:ui-pluralization
Draft

Fixing consistency issues with pluralization in UI#1304
CYBRXT wants to merge 1 commit into
we-promise:mainfrom
CYBRXT:ui-pluralization

Conversation

@CYBRXT

@CYBRXT CYBRXT commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Closes #1303.

From the testing I've done on my dev environment, the issue can be fixed by pluralizing the category type names in config/locales/views/accounts/en.yml, and by singularizing any displayed subtype labels for the sidebar and Settings/General/Accounts by adding .singularize to the app/views/accounts/_account.html.erb and app/views/accounts/_accountable_group.html.erb files.

The format of all the asset/liability category types should now all be plural category with singular subtype label, as shown in this screenshot from the accounts sidebar:

image

And this one from Settings/General/Accounts:
image

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Corrected account type labels to display in singular form across account views, improving consistency and clarity in how account categories are presented to users.

@coderabbitai

coderabbitai Bot commented Mar 27, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Applied singularize to account subtype labels in two view templates and updated account type translations to pluralized forms in locale configuration, ensuring consistent label presentation across the UI.

Changes

Cohort / File(s) Summary
View template singularization
app/views/accounts/_account.html.erb, app/views/accounts/_accountable_group.html.erb
Applied singularize method to display singular account subtype labels (long_subtype_label and short_subtype_label) while maintaining existing conditional rendering and markup structure.
Account type label pluralization
config/locales/views/accounts/en.yml
Converted account type label translations to pluralized forms: "Investments", "Properties", "Vehicles", "Other Assets", "Credit Cards", "Loans", and "Other Liabilities".

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • jjmata
  • sokie

Poem

🐰 Singular and plural, we hop and we play,
Making our labels consistent today!
Subtype singularized, types pluralized right,
Account categories shine in the light! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing pluralization consistency issues in the UI by making category types plural and subtype labels singular.
Linked Issues check ✅ Passed The pull request fully addresses issue #1303 by pluralizing category type names in translations and singularizing displayed subtype labels in the account views.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing pluralization consistency: translation updates and view template modifications to apply singularize filter.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Copy link
Copy Markdown

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: d11cb8445b

ℹ️ 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".

<% end %>
</div>
<%= tag.p account.short_subtype_label, class: "text-sm text-secondary truncate" %>
<%= tag.p account.short_subtype_label.singularize, class: "text-sm text-secondary truncate" %>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid indiscriminate singularization of subtype labels

Applying singularize to every subtype label regresses valid labels that are already correct in singular account context, e.g. the depository subtype Savings now renders as Saving. This affects common savings accounts in the account lists (and the same pattern was added in _account.html.erb), so users will see incorrect subtype text instead of the configured label.

Useful? React with 👍 / 👎.

@CYBRXT CYBRXT marked this pull request as draft March 27, 2026 02:46

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/views/accounts/_account.html.erb`:
- Around line 32-34: The view calls account.long_subtype_label.singularize which
mutates an I18n-translated string using English-only rules; stop calling
String#singularize on translated labels (account.long_subtype_label) and instead
expose a model method that uses I18n pluralization (e.g. implement
subtype_label_for or subtype_label in accountable.rb that calls I18n.t with a
count argument and plural keys for the subtype), update locale files to provide
one/other entries for each subtype, and change the view to render the model
method with count: 1 (rather than calling .singularize) so translations are
correctly pluralized per locale.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7488b8d1-c057-4c5e-b9e3-1082b8307f93

📥 Commits

Reviewing files that changed from the base of the PR and between 6a6548d and d11cb84.

📒 Files selected for processing (3)
  • app/views/accounts/_account.html.erb
  • app/views/accounts/_accountable_group.html.erb
  • config/locales/views/accounts/en.yml

Comment on lines 32 to 34
<% if account.long_subtype_label %>
<p class="text-sm text-secondary truncate"><%= account.long_subtype_label %></p>
<p class="text-sm text-secondary truncate"><%= account.long_subtype_label.singularize %></p>
<% end %>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

String#singularize will produce incorrect results for non-English locales.

Ruby's singularize method uses English Inflector rules. Since account.long_subtype_label returns an I18n-translated string (via I18n.t in accountable.rb), calling .singularize on non-English translations like "Cuenta de Inversión" (Spanish) or "Investitionskonto" (German) will produce garbled text.

A more robust approach would be to store both singular and plural forms in the locale files and select the appropriate one at the model level:

# In accountable.rb
def subtype_label_for(subtype, format: :short, count: 1)
  I18n.t(
    "#{name.underscore.pluralize}.subtypes.#{subtype}.#{format}",
    count: count,
    default: fallback
  )
end

Then update locale files to use Rails I18n pluralization:

vehicles:
  subtypes:
    suv:
      short:
        one: "SUV"
        other: "SUVs"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/views/accounts/_account.html.erb` around lines 32 - 34, The view calls
account.long_subtype_label.singularize which mutates an I18n-translated string
using English-only rules; stop calling String#singularize on translated labels
(account.long_subtype_label) and instead expose a model method that uses I18n
pluralization (e.g. implement subtype_label_for or subtype_label in
accountable.rb that calls I18n.t with a count argument and plural keys for the
subtype), update locale files to provide one/other entries for each subtype, and
change the view to render the model method with count: 1 (rather than calling
.singularize) so translations are correctly pluralized per locale.

@CYBRXT

CYBRXT commented Mar 27, 2026

Copy link
Copy Markdown
Contributor Author

Comments from the LLMs noted. Making further edits...

@jjmata

jjmata commented Apr 7, 2026

Copy link
Copy Markdown
Collaborator

Is this something your PR addresses also @UberDudePL?

@UberDudePL

UberDudePL commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Yes, in my PL Localization, I was working on pluralization but one step further. As in Polish we are using, one, few, many and other to fully cover all aspects of proper grammar. But I was nit touching en.yml files to separate one and other as per example with SUV/SUVs. I can work on this if you want

@jjmata

jjmata commented Apr 7, 2026

Copy link
Copy Markdown
Collaborator

If @CYBRXT doesn't have time it would be great to get some help here, yes! Thank yiou @UberDudePL.

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.

Consistency issues with pluralization in UI

4 participants