Skip to content

Translate admin page titles and order state badges - #6685

Merged
jarednorman merged 2 commits into
solidusio:mainfrom
SuperGoodSoft:njjjr/add-missing-locales
Oct 19, 2026
Merged

jarednorman merged 2 commits into
solidusio:mainfrom
SuperGoodSoft:njjjr/add-missing-locales

Conversation

@AlistairNorman

@AlistairNorman AlistairNorman commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Index page titles and the order, payment and shipment state badges on the orders list were always shown in English. They now use the admin's locale.

Based on work by @nerijunior in #6419

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.47%. Comparing base (53f7015) to head (4246c21).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6685      +/-   ##
==========================================
+ Coverage   92.30%   92.47%   +0.16%     
==========================================
  Files         969     1056      +87     
  Lines       19847    21490    +1643     
==========================================
+ Hits        18319    19872    +1553     
- Misses       1528     1618      +90     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

"cart" => :graphite_light
}[order.state] || :yellow
component("ui/badge").new(name: order.state.humanize, color:)
component("ui/badge").new(name: I18n.t("spree.order_state.#{order.state}"), color:)

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.

We should be able to get the humanized string in different locales. It seems like we are just missing state machine translations. To test, I dropped in some additional translation strings and was able to see this work against an order record:

# en.yml
en:
  activerecord:
    state_machines:
      spree/order:
        states:
          complete: "EN translation"
# fr.yml
en:
  activerecord:
    state_machines:
      spree/order:
        states:
          complete: "FR translation"
I18n.with_locale(:en) do
  Spree::Order.first.human_state_name
end
# => "EN translation"

I18n.with_locale(:fr) do
  Spree::Order.first.human_state_name
end
# => "FR translation"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right but then we would need to add all of those translations. I would rather use the existing translations because the alternatives are duplicating them or figuring out what uses the existing ones and moving it all over.

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.

We don't necessarily need to move them all over now.

I see an opportunity to centralize all of the state machine state translations in the YAML long term, while also reducing complexity of the new solidus_admin templates in the short term and promoting a nicer way to get translated states for application developers.

@AlistairNorman AlistairNorman Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If we don't move them over then everything will still show in English which is what this is trying to solve so I copied the existing translations. It duplicates them all but we do get the nicer helper which we can use going forward

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.

Ah, sorry. By moving it all over I thought that you meant existing translations that should probably be moved over to the activerecord.statemachines.* prefixed strings.

Despite the duplication, I think this is valuable. 👍

@AlistairNorman
AlistairNorman marked this pull request as ready for review October 13, 2026 22:25
@AlistairNorman
AlistairNorman requested a review from a team as a code owner October 13, 2026 22:25
@AlistairNorman
AlistairNorman force-pushed the njjjr/add-missing-locales branch from d94b384 to 82b9761 Compare October 13, 2026 22:25
@AlistairNorman
AlistairNorman force-pushed the njjjr/add-missing-locales branch from 82b9761 to a819354 Compare October 14, 2026 16:18
@github-actions github-actions Bot added changelog:solidus_core Changes to the solidus_core gem changelog:solidus_i18n Changes to the solidus_i18n gem labels Oct 14, 2026
@AlistairNorman
AlistairNorman force-pushed the njjjr/add-missing-locales branch from a819354 to 651b41c Compare October 14, 2026 16:26
nerijunior and others added 2 commits October 14, 2026 09:27
Index page titles and the order, payment and shipment state badges on the orders list were always shown in English. They now use the admin's locale.

Co-authored-by: Alistair Norman <alistair@super.gd>
Without this stores in other languages see order states in English. The
translations are copied from each language's existing order state
strings. Latvian and Vietnamese have none to copy, and Bulgarian and
Korean are missing some states.
@AlistairNorman
AlistairNorman force-pushed the njjjr/add-missing-locales branch from 651b41c to 4246c21 Compare October 14, 2026 16:27
@nerijunior

Copy link
Copy Markdown
Contributor

Thanks @AlistairNorman

@jarednorman
jarednorman merged commit 7c1842d into solidusio:main Oct 19, 2026
74 of 76 checks passed
@jarednorman
jarednorman deleted the njjjr/add-missing-locales branch October 19, 2026 22:10
Noah-Silvera pushed a commit to SuperGoodSoft/solidus that referenced this pull request Nov 2, 2026
…g-locales

Translate admin page titles and order state badges
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:solidus_admin changelog:solidus_core Changes to the solidus_core gem changelog:solidus_i18n Changes to the solidus_i18n gem

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants