Skip to content

[Shop] Html lables translation#18180

Merged
GSadee merged 1 commit intoSylius:2.1from
PiotrTulacz:Html-labales-translation
Jun 17, 2025
Merged

[Shop] Html lables translation#18180
GSadee merged 1 commit intoSylius:2.1from
PiotrTulacz:Html-labales-translation

Conversation

@PiotrTulacz
Copy link
Copy Markdown

@PiotrTulacz PiotrTulacz commented Jun 17, 2025

Summary by CodeRabbit

  • New Features
    • Improved accessibility by localizing all aria-label and alt attributes across navigation, banners, and buttons to support multiple languages.
  • Style
    • Removed an unnecessary blank line from the meta tags template.
  • Documentation
    • Added new translation keys for various UI elements to enhance localization and accessibility.

@PiotrTulacz PiotrTulacz requested review from a team as code owners June 17, 2025 11:17
@probot-autolabeler probot-autolabeler bot added the Shop ShopBundle related issues and PRs. label Jun 17, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 17, 2025

Walkthrough

This update replaces hardcoded English aria-label and alt attributes in multiple Twig templates with translatable string keys, enabling localization of accessibility labels. It also introduces new translation keys in the English messages file to support these changes. No logic or exported entities were altered.

Changes

File(s) Change Summary
src/Sylius/Bundle/ShopBundle/templates/homepage/banner.html.twig Changed aria-label and alt attributes from static strings to translatable keys.
src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/footer/content/copy.html.twig Updated anchor aria-label from hardcoded to translatable string key.
src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/footer/content/menu.html.twig Updated aria-label on <nav> elements from hardcoded to translatable string keys.
src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/header/content/security/visitor/desktop.html.twig Changed aria-label from static to translatable string.
src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/header/content/security/visitor/desktop/register.html.twig Updated button aria-label from hardcoded to translatable string key.
src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/header/content/security/visitor/mobile.html.twig Changed navigation and button aria-label attributes to use translation keys.
src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/header/navbar/menu.html.twig Updated navigation and button aria-label attributes to use translation keys.
src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/metatags.html.twig Removed a trailing blank line.
src/Sylius/Bundle/UiBundle/Resources/translations/messages.en.yml Added new translation keys for UI accessibility labels.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Browser
    participant TwigTemplate
    participant Translator

    User->>Browser: Loads a page
    Browser->>TwigTemplate: Renders template
    TwigTemplate->>Translator: Requests translation for aria-label/alt key
    Translator-->>TwigTemplate: Returns localized string
    TwigTemplate-->>Browser: Outputs HTML with localized aria-label/alt
    Browser-->>User: Displays accessible, localized UI
Loading

Possibly related PRs

  • Sylius/Sylius#18147: Also addresses accessibility by adding or modifying aria-label attributes, but uses static English strings rather than localization.
  • Sylius/Sylius#18157: Adds static aria-label attributes for accessibility, similar in intent but does not implement localization.

Suggested labels

Documentation, UX

Suggested reviewers

  • GSadee

Poem

In fields of code where translations grow,
A rabbit hops where labels flow.
Aria sings in every tongue,
Accessibility for old and young!
With every key and string anew,
The world feels closer, thanks to you.
🐇🌍✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jun 17, 2025

❌ Preview Environment deleted from Bunnyshell

Available commands:

  • 🚀 /bns:deploy to redeploy the environment

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
src/Sylius/Bundle/UiBundle/Resources/translations/messages.en.yml (3)

21-23: Check naming consistency for the new “account_*” keys

account_button, account_navigation_desktop, and account_navigation_mobile are added with plain-English values.
Other UI strings for buttons (e.g. login_button, register_button) consistently end with _button.
Consider renaming account_button to account_navigation_button (or similar) to keep the namespace symmetrical, or at least verify no clash with existing keys in other locale files.
No functional change is required, just a small taxonomy tidy-up.


370-371: Footer link keys: be specific

footer_help_links and footer_informational_links read like plural buckets rather than the text that will be voiced by screen-readers.
If the aria-use-case is “Help links” / “Informational links”, you may want the singular form (footer_help / footer_information) for clarity.
Not critical; purely wording finesse.


876-876: Duplication with existing “sylius_logo”

sylius_logo_aria is fine, but there is already a sylius_logo key.
Consider appending a comment explaining the difference (visual text vs. aria-label) so future maintainers don’t consolidate them by mistake.

src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/footer/content/copy.html.twig (1)

2-2: Localized logo aria-label looks correct

sylius.ui.sylius_logo_aria key exists and the label will now be localised.
Remember to keep the underlying SVG/img’s alt empty (alt="") to avoid double-speaking if the included logo template already carries descriptive alt text.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4ccb315 and 4a1b1e7.

📒 Files selected for processing (9)
  • src/Sylius/Bundle/ShopBundle/templates/homepage/banner.html.twig (1 hunks)
  • src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/footer/content/copy.html.twig (1 hunks)
  • src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/footer/content/menu.html.twig (2 hunks)
  • src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/header/content/security/visitor/desktop.html.twig (1 hunks)
  • src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/header/content/security/visitor/desktop/register.html.twig (1 hunks)
  • src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/header/content/security/visitor/mobile.html.twig (1 hunks)
  • src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/header/navbar/menu.html.twig (1 hunks)
  • src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/metatags.html.twig (0 hunks)
  • src/Sylius/Bundle/UiBundle/Resources/translations/messages.en.yml (5 hunks)
💤 Files with no reviewable changes (1)
  • src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/metatags.html.twig
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Static checks / PHP 8.2, Symfony ^6.4
  • GitHub Check: Static checks / PHP 8.3, Symfony ^7.2
  • GitHub Check: Static checks / PHP 8.4, Symfony ^7.2
🔇 Additional comments (11)
src/Sylius/Bundle/UiBundle/Resources/translations/messages.en.yml (2)

151-151: Potential duplicate “close” key

A “close” label is common in modal components; double-check that this key does not already exist elsewhere in the same domain to avoid silent overwrite in YAML.
If an older key exists, drop one or merge to keep a single source of truth.


893-893: Confirm desktop / mobile symmetry

You added taxon_navigation_desktop.
Is there a matching taxon_navigation_mobile?
Keeping the pair makes future template work easier.

src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/header/content/security/visitor/desktop/register.html.twig (1)

10-10: ARIA label now localised – good job

The extra attribute { 'role': 'menuitem', 'aria-label': 'sylius.ui.register'|trans } cleanly localises the label.
Just verify that buttons.transparent does not already set an aria-label; duplicate attributes will be ignored by browsers but lint-tools may warn.

src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/header/content/security/visitor/mobile.html.twig (1)

1-3: Mobile account navigation ARIA labels localised

Both the container and the icon button now pull translated labels – accessibility & i18n improved.
No further issues spotted.

src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/header/content/security/visitor/desktop.html.twig (1)

1-1: Desktop account navigation label localised

Good conversion to translation key – improves accessibility without side-effects.

src/Sylius/Bundle/ShopBundle/templates/homepage/banner.html.twig (2)

4-4: Looks good: The alt attribute for the main banner image is now translatable, matching the original “Home” text.


5-5: Looks good: The alt text for the secondary image is now localized via sylius.homepage.new_collection.

src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/header/navbar/menu.html.twig (2)

3-3: Looks good: Navigation landmark’s aria-label is now translatable with sylius.ui.taxon_navigation_desktop.


8-8: Looks good: Close button’s aria-label uses the sylius.ui.close key for localization.

src/Sylius/Bundle/ShopBundle/templates/shared/layout/base/footer/content/menu.html.twig (2)

4-4: Looks good: Footer informational links nav is now labelled via sylius.ui.footer_informational_links for accessibility.


13-13: Looks good: Footer help links nav uses sylius.ui.footer_help_links to localize the aria-label.

@GSadee GSadee merged commit 7fba5e0 into Sylius:2.1 Jun 17, 2025
30 of 31 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Aug 21, 2025
Rafikooo added a commit that referenced this pull request Oct 21, 2025
| Q               | A
|-----------------|-----
| Branch?         | 2.1
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | –
| License         | MIT

### Summary
Fix four obvious typos in `CHANGELOG-2.1.md`:
- `Uploud` → `Upload` (v2.1.5, PR #18286)
- `confflict` → `conflict` (v2.1.5, PR #18302)
- `nessecary` → `necessary` (v2.1.5, PR #18342)
- `lables` → `labels` (v2.1.2, PR #18180)

### Notes
- Minimal diffs only; no punctuation/style changes.
- Code, identifiers, and formatting are untouched.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Corrected typos in changelog entries for improved readability and
clarity.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Shop ShopBundle related issues and PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants