Skip to content

Add language support handling guidelines to Copilot Instructions - #249

Merged
AWqxKAWERbXo merged 3 commits into
mainfrom
copilot/add-language-support-handling
Oct 19, 2025
Merged

Add language support handling guidelines to Copilot Instructions#249
AWqxKAWERbXo merged 3 commits into
mainfrom
copilot/add-language-support-handling

Conversation

Copilot AI commented Oct 19, 2025

Copy link
Copy Markdown

Overview

This PR addresses issue regarding language support handling by adding comprehensive documentation to .github/copilot-instructions.md that clearly explains the critical difference between frontend and backend language support methods.

Problem

The codebase uses two different approaches for language support, and it's essential that developers (and AI assistants) use the correct method based on context:

  • Backend: Uses rex_i18n::msg() class or translate:key placeholder
  • Frontend (especially fragments in fragments/bootstrap5/ and emails): Uses only Warehouse::getLabel()!

Without clear documentation, it's easy to mix these approaches, which can break the shop's customization capabilities.

Changes

Added detailed language support guidelines in two strategic locations:

1. Fragment Development Guidelines (Section 6)

Enhanced the existing "Labels und Texte" section with:

  • Clear separation between Frontend and Backend contexts
  • Specific file paths for each context
  • Practical code examples for both scenarios
  • Explanation of why this separation is essential

2. Code Quality & Best Practices (New Section 7)

Added a new CRITICAL guideline section that includes:

  • Explicit DO/DON'T rules for each context
  • Visual examples with ✅ correct and ❌ incorrect usage
  • Clear reasoning: Frontend labels are customizable by shop operators via Settings → Label, while backend texts are fixed translations

Why This Matters

The separation is critical because:

  • Frontend labels (Warehouse::getLabel()) are dynamic and can be customized by shop operators through the backend Settings → Label interface
  • Backend texts (rex_i18n::msg()) are static translations stored in /lang/*.lang files that should remain consistent across installations
  • Mixing these approaches would break the customization capability that shop operators rely on

Example Usage

Frontend Fragment (Correct):

<h2><?= Warehouse::getLabel('cart_title') ?></h2>

Backend Page (Correct):

$field->setLabel(rex_i18n::msg('warehouse.settings.payment.store_name'));

This documentation ensures consistency across the codebase and prevents common mistakes when developing new features or fixing bugs.

Fixes: Issue about handling language support differently between frontend and backend

Original prompt

This section details on the original issue you should resolve

<issue_title>Copilot Instructions: Add information how to handle language support differently between frontend and backend</issue_title>
<issue_description>Backend: rex_i18n class or translate:key placeholder
Frontend (especially frontend fragments in fragments/bootstrap5/ and emails): only Warehouse::getLabel()!</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #248


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Oct 19, 2025
@coderabbitai

coderabbitai Bot commented Oct 19, 2025

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: randalex-de <3855487+randalex-de@users.noreply.github.com>
Copilot AI changed the title [WIP] Add instructions for language support in frontend and backend Add language support handling guidelines to Copilot Instructions Oct 19, 2025
Copilot AI requested a review from AWqxKAWERbXo October 19, 2025 23:05
@AWqxKAWERbXo
AWqxKAWERbXo marked this pull request as ready for review October 19, 2025 23:13
Copilot AI review requested due to automatic review settings October 19, 2025 23:13
@AWqxKAWERbXo
AWqxKAWERbXo merged commit 8940f12 into main Oct 19, 2025
1 check failed
@AWqxKAWERbXo
AWqxKAWERbXo deleted the copilot/add-language-support-handling branch October 19, 2025 23:13

Copilot AI left a comment

Copy link
Copy Markdown

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 adds comprehensive documentation to the Copilot instructions for handling language support differently between frontend and backend contexts in the Warehouse add-on. The documentation clarifies the critical distinction between using Warehouse::getLabel() for frontend fragments and rex_i18n::msg() for backend components.

  • Enhanced existing fragment development guidelines with detailed language support rules
  • Added a new critical code quality section specifically focused on language support best practices
  • Provided clear examples and explanations of why the separation is essential for shop customization

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copilot Instructions: Add information how to handle language support differently between frontend and backend

3 participants