Skip to content

Localize workflow error messages via server-side i18n resolution#50348

Merged
ssilvert merged 1 commit into
keycloak:mainfrom
sguilhen:45048-worflows-i18n
Jul 17, 2026
Merged

Localize workflow error messages via server-side i18n resolution#50348
ssilvert merged 1 commit into
keycloak:mainfrom
sguilhen:45048-worflows-i18n

Conversation

@sguilhen

Copy link
Copy Markdown
Contributor
  • extracted shared resolveMessage() and error() helpers into ErrorResponse to eliminate duplicated message resolution logic across WorkflowResource,WorkflowsResource, UserResource, and UsersResource.

Closes #45048

Copilot AI review requested due to automatic review settings June 25, 2026 17:00
@sguilhen
sguilhen requested review from a team as code owners June 25, 2026 17:00

Copilot AI 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.

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(...) and ErrorResponse.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.

Comment thread services/src/main/java/org/keycloak/services/ErrorResponse.java
Copilot AI review requested due to automatic review settings July 3, 2026 13:35
@sguilhen
sguilhen force-pushed the 45048-worflows-i18n branch from b857e0f to 8edb233 Compare July 3, 2026 13:35

Copilot AI 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.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Comment thread services/src/main/java/org/keycloak/services/ErrorResponse.java
@sguilhen
sguilhen force-pushed the 45048-worflows-i18n branch from 8edb233 to 8d8de60 Compare July 3, 2026 14:02
Copilot AI review requested due to automatic review settings July 3, 2026 19:57
@sguilhen
sguilhen force-pushed the 45048-worflows-i18n branch from 8d8de60 to b2a5a0e Compare July 3, 2026 19:57

Copilot AI 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.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.

Comment thread services/src/main/java/org/keycloak/services/ErrorResponse.java

Copilot AI 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.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 1 comment.

Comment thread services/src/main/java/org/keycloak/services/ErrorResponse.java
edewit
edewit previously approved these changes Jul 16, 2026

@edewit edewit 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.

LGTM

Copilot AI review requested due to automatic review settings July 16, 2026 14:21
@sguilhen
sguilhen force-pushed the 45048-worflows-i18n branch from 88406df to e25e582 Compare July 16, 2026 14:21

Copilot AI 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.

Pull request overview

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Comment thread services/src/main/java/org/keycloak/services/ErrorResponse.java Outdated
Copilot AI review requested due to automatic review settings July 16, 2026 17:30
@sguilhen
sguilhen force-pushed the 45048-worflows-i18n branch from e25e582 to 83c1d34 Compare July 16, 2026 17:30

Copilot AI 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.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

- 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>
Copilot AI review requested due to automatic review settings July 16, 2026 18:14
@sguilhen
sguilhen force-pushed the 45048-worflows-i18n branch from 83c1d34 to 587631d Compare July 16, 2026 18:14

Copilot AI 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.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

@ssilvert ssilvert 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.

LGTM

@ssilvert
ssilvert merged commit 3369540 into keycloak:main Jul 17, 2026
92 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workflows: ensure error messages are localized

6 participants