Fix parameter %resource% for translation#1089
Merged
Rafikooo merged 1 commit intoSylius:1.14from Dec 10, 2025
Conversation
714d06b to
6484b00
Compare
Rafikooo
reviewed
Nov 24, 2025
Contributor
Rafikooo
left a comment
There was a problem hiding this comment.
I would suggest extracting a dedicated private method, something like this:
private function getParametersWithName(MetadataInterface $metadata, string $actionName): array
{
if (stripos($actionName, 'bulk') !== false) {
$resourceName = $metadata->getPluralName();
$fallback = ucfirst($resourceName);
return ['%resources%' => $this->translateResourceName($resourceName, $fallback)];
}
$resourceName = $metadata->getName();
$fallback = ucfirst($metadata->getHumanizedName());
return ['%resource%' => $this->translateResourceName($resourceName, $fallback)];
}
private function translateResourceName(string $resourceName, string $fallback): string
{
$snakeCaseName = $this->convertToSnakeCase($resourceName);
$translationKey = sprintf('%s%s', self::UI_TRANSLATION_PREFIX, $snakeCaseName);
$translated = $this->translator->trans($translationKey, [], 'messages');
return $translated === $translationKey ? $fallback : $translated;
}And I’d suggest adding a photo to the PR description
6484b00 to
7257652
Compare
7257652 to
00ed218
Compare
Rafikooo
approved these changes
Dec 10, 2025
NoResponseMate
added a commit
that referenced
this pull request
Feb 9, 2026
| Q | A | --------------- | ----- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Related tickets | | License | MIT This improves the feature added in #1089 It also adds the same feature in the new FlashHelper.
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.
de_DE

fr_FR

pl_PL
