Localize workflow error messages via server-side i18n resolution#50348
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses workflow-related (and some user-related) admin API error message localization by moving message resolution/formatting to the server side, so UI-facing error responses can be returned as localized strings rather than raw exception text.
Changes:
- Added workflow-specific message keys to the admin theme messages bundle and updated workflow validation/model code to throw message keys + parameters instead of English sentences.
- Introduced shared
ErrorResponse.resolveMessage(...)andErrorResponse.error(session, locale, ModelException, ...)helpers, and refactored admin resources to use them. - Updated tests to reflect the new localized message text (including punctuation/formatting changes).
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| themes/src/main/resources/theme/base/admin/messages/messages_en.properties | Adds new workflow error message keys/strings for admin-theme localization. |
| tests/base/src/test/java/org/keycloak/tests/workflow/WorkflowManagementTest.java | Adjusts assertions to read ErrorRepresentation once (no behavior change). |
| tests/base/src/test/java/org/keycloak/tests/workflow/step/RestartStepTest.java | Updates expected error strings to match localized messages (incl. trailing period). |
| services/src/main/java/org/keycloak/workflow/admin/resource/WorkflowsResource.java | Captures locale from admin token; uses localized error responses for workflow operations (one remaining unlocalized 404 noted). |
| services/src/main/java/org/keycloak/workflow/admin/resource/WorkflowResource.java | Passes session+locale through and localizes additional workflow errors. |
| services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java | Replaces manual theme-message formatting with centralized ErrorResponse.resolveMessage. |
| services/src/main/java/org/keycloak/services/resources/admin/UserResource.java | Same as above across several password/validation error paths. |
| services/src/main/java/org/keycloak/services/ErrorResponse.java | Adds shared message resolution + ModelException-based localized error helper. |
| server-spi/src/main/java/org/keycloak/models/ModelValidationException.java | Adds constructor supporting parameters for message formatting. |
| server-spi-private/src/main/java/org/keycloak/models/workflow/Workflows.java | Switches provider-factory errors to message keys + params. |
| server-spi-private/src/main/java/org/keycloak/models/workflow/WorkflowInvalidStateException.java | Adds constructor supporting parameters. |
| server-spi-private/src/main/java/org/keycloak/models/workflow/Workflow.java | Switches validation errors to message keys + params; replaces JAX-RS exception with model exception. |
| model/jpa/src/main/java/org/keycloak/models/workflow/WorkflowValidator.java | Converts workflow validation errors to message keys + params. |
| model/jpa/src/main/java/org/keycloak/models/workflow/DefaultWorkflowProvider.java | Converts update/migration/activation errors to message keys + params; replaces JAX-RS exception with model exception. |
| model/jpa/src/main/java/org/keycloak/models/workflow/conditions/UserAttributeWorkflowConditionProvider.java | Converts condition validation errors to message keys + params. |
| model/jpa/src/main/java/org/keycloak/models/workflow/conditions/RoleWorkflowConditionProvider.java | Converts condition validation errors to message keys + params. |
| model/jpa/src/main/java/org/keycloak/models/workflow/conditions/IdentityProviderWorkflowConditionProvider.java | Converts condition validation errors to message keys + params. |
| model/jpa/src/main/java/org/keycloak/models/workflow/conditions/GroupMembershipWorkflowConditionProvider.java | Converts condition validation errors to message keys + params. |
sguilhen
force-pushed
the
45048-worflows-i18n
branch
from
June 25, 2026 18:42
65bc7be to
b857e0f
Compare
jordandunmire97-ai
approved these changes
Jun 28, 2026
pedroigor
reviewed
Jul 3, 2026
sguilhen
force-pushed
the
45048-worflows-i18n
branch
from
July 3, 2026 13:35
b857e0f to
8edb233
Compare
sguilhen
force-pushed
the
45048-worflows-i18n
branch
from
July 3, 2026 14:02
8edb233 to
8d8de60
Compare
sguilhen
force-pushed
the
45048-worflows-i18n
branch
from
July 3, 2026 19:57
8d8de60 to
b2a5a0e
Compare
sguilhen
force-pushed
the
45048-worflows-i18n
branch
from
July 16, 2026 13:33
b2a5a0e to
88406df
Compare
sguilhen
force-pushed
the
45048-worflows-i18n
branch
from
July 16, 2026 14:21
88406df to
e25e582
Compare
sguilhen
force-pushed
the
45048-worflows-i18n
branch
from
July 16, 2026 17:30
e25e582 to
83c1d34
Compare
- extracted shared resolveMessage() and error() helpers into ErrorResponse to eliminate duplicated message resolution logic across WorkflowResource,WorkflowsResource, UserResource, and UsersResource. Closes keycloak#45048 Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
sguilhen
force-pushed
the
45048-worflows-i18n
branch
from
July 16, 2026 18:14
83c1d34 to
587631d
Compare
edewit
approved these changes
Jul 17, 2026
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.
Closes #45048