Skip to content

feat: expand gettext i18n support to types, changes, and changeset#2637

Merged
zachdaniel merged 1 commit intoash-project:mainfrom
nallwhy:feat/expand-gettext-i18n-coverage
Mar 17, 2026
Merged

feat: expand gettext i18n support to types, changes, and changeset#2637
zachdaniel merged 1 commit intoash-project:mainfrom
nallwhy:feat/expand-gettext-i18n-coverage

Conversation

@nallwhy
Copy link
Contributor

@nallwhy nallwhy commented Mar 16, 2026

Contributor checklist

Leave anything that you believe does not apply unchecked.

  • I accept the AI Policy, or AI was not used in the creation of this PR.
  • Bug fixes include regression tests
  • Chores
  • Documentation changes
  • Features include unit/acceptance tests
  • Refactoring
  • Update dependencies

Summary

  • Expands error_message() i18n coverage from validations only (31 messages) to types, changes, and changeset (57 messages)
  • Normalizes inconsistent wording: "must be more than" → "must be greater than" across apply_constraints and apply_atomic_constraints paths
  • Regenerates priv/gettext/ash.pot with 57 unique translatable messages

Notes

  • Error struct message/1 callbacks (Splode errors) are excluded from this PR as they use #{} interpolation and require a different translation mechanism

Copilot AI review requested due to automatic review settings March 16, 2026 23:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR standardizes and marks many Ash error message strings as translatable by wrapping them with error_message/1 (via import Ash.Gettext), and updates tests to match the updated phrasing for numeric minimum constraints.

Changes:

  • Mark type/changeset/change error strings with error_message/1 so mix ash.gettext.extract can collect them.
  • Adjust phrasing from “more than or equal to %{min}” to “greater than or equal to %{min}” (and related “more than” → “greater than”) across types and tests.
  • Update priv/gettext/ash.pot with the newly extracted message ids and source references.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/type/tuple_test.exs Updates assertions for the revised min-constraint error phrasing.
test/type/struct_test.exs Updates exact and substring-based assertions to match new wording.
test/type/map_test.exs Updates substring-based assertions to match new wording.
test/type/keyword_test.exs Updates exact and substring-based assertions to match new wording.
test/type/integer_test.exs Updates apply-constraints error assertion to match new wording.
priv/gettext/ash.pot Regenerates extracted gettext strings/source refs for newly marked messages.
lib/ash/type/type.ex Wraps internal array/type errors with error_message/1 and imports Ash.Gettext.
lib/ash/type/tuple.ex Wraps tuple-specific error strings with error_message/1 and imports Ash.Gettext.
lib/ash/type/struct.ex Wraps struct casting/required-field error strings with error_message/1.
lib/ash/type/string.ex Marks string constraint error messages for extraction (error_message/1).
lib/ash/type/new_type.ex Marks “invalid value at %{index}” for extraction in generated new types.
lib/ash/type/module.ex Marks module/protocol/behaviour validation error strings for extraction.
lib/ash/type/map.ex Marks map field/invalid/nil errors for extraction.
lib/ash/type/keyword.ex Marks keyword field/invalid/nil errors for extraction.
lib/ash/type/integer.ex Marks integer constraint errors for extraction and updates min wording.
lib/ash/type/function.ex Marks function arity constraint error for extraction.
lib/ash/type/float.ex Marks float constraint errors for extraction and updates wording.
lib/ash/type/enum.ex Marks enum “must be one of …” errors for extraction in generated code.
lib/ash/type/decimal.ex Marks decimal constraint errors for extraction and updates wording.
lib/ash/type/ci_string.ex Marks CI string constraint/pattern errors for extraction.
lib/ash/type/atom.ex Marks atom-one-of error for extraction.
lib/ash/resource/change/relate_actor.ex Marks relate-actor failure message for extraction.
lib/ash/resource/change/cascade_update.ex Marks missing-relationship message for extraction.
lib/ash/resource/change/cascade_destroy.ex Marks missing-relationship message for extraction.
lib/ash/changeset/changeset.ex Marks several relationship/attribute change errors for extraction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nallwhy nallwhy force-pushed the feat/expand-gettext-i18n-coverage branch from 8b663a6 to f54c650 Compare March 16, 2026 23:50
@zachdaniel zachdaniel merged commit c89f9fe into ash-project:main Mar 17, 2026
45 checks passed
@zachdaniel
Copy link
Contributor

🚀 Thank you for your contribution! 🚀

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.

3 participants