feat: expand gettext i18n support to types, changes, and changeset#2637
Merged
zachdaniel merged 1 commit intoash-project:mainfrom Mar 17, 2026
Merged
Conversation
There was a problem hiding this comment.
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/1somix ash.gettext.extractcan 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.potwith 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.
8b663a6 to
f54c650
Compare
zachdaniel
approved these changes
Mar 17, 2026
Contributor
|
🚀 Thank you for your contribution! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributor checklist
Leave anything that you believe does not apply unchecked.
Summary
error_message()i18n coverage from validations only (31 messages) to types, changes, and changeset (57 messages)apply_constraintsandapply_atomic_constraintspathspriv/gettext/ash.potwith 57 unique translatable messagesNotes
message/1callbacks (Splode errors) are excluded from this PR as they use#{}interpolation and require a different translation mechanism