Skip to content

[6.x] Share all translations with CP#18471

Merged
riasvdv merged 3 commits into6.xfrom
feature/all-translations
Feb 25, 2026
Merged

[6.x] Share all translations with CP#18471
riasvdv merged 3 commits into6.xfrom
feature/all-translations

Conversation

@riasvdv
Copy link
Contributor

@riasvdv riasvdv commented Feb 24, 2026

No description provided.

Copy link

Copilot AI left a comment

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 refactors the translation system to load all translations in bulk via window.Craft.translations instead of registering individual translation strings on-demand. This simplifies the codebase and ensures all translations are available to JavaScript without needing explicit registration calls throughout the application.

Changes:

  • Added I18N::getAllTranslationsForLocale() to bulk-load all translations for a locale with proper fallback handling
  • Made registerTranslations() a deprecated no-op in both View and HtmlStack classes
  • Removed individual registerTranslations() calls from asset bundles, controllers, and Twig templates
  • Refactored TranslationServiceProvider to use callAfterResolving() pattern for registering category sources

Reviewed changes

Copilot reviewed 47 out of 47 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Translation/I18N.php Added getAllTranslationsForLocale() method with locale fallback logic and tracking of registered categories
src/Translation/TranslationServiceProvider.php Refactored to use callAfterResolving() pattern for registering app/site category sources
src/Support/Facades/I18N.php Added facade method signature for getAllTranslationsForLocale()
yii2-adapter/legacy/web/assets/cp/CpAsset.php Changed to load all translations in bulk via I18N::getAllTranslationsForLocale() instead of individual registration
yii2-adapter/legacy/web/View.php Made registerTranslations() a no-op with updated deprecation notice
src/View/HtmlStack.php Removed translations() method entirely
src/Support/Facades/HtmlStack.php Removed facade method for translations
yii2-adapter/src/Yii2ServiceProvider.php Updated to use I18N facade for adding category sources
yii2-adapter/legacy/web/assets/*.php Removed registerTranslations() calls from 15 asset bundle classes
yii2-adapter/legacy/controllers/SystemSettingsController.php Removed registerTranslations() call
resources/templates/**/*.twig Removed registerTranslations() calls from 14 Twig templates
src/Utility/Utilities/ProjectConfig.php Removed registerTranslations() call
tests/Unit/Translation/I18NTest.php Added comprehensive tests for getAllTranslationsForLocale() including fallback behavior
tests/Unit/View/HtmlStackTest.php Removed tests for deprecated translations() method
yii2-adapter/tests/unit/web/ViewTest.php Updated test to verify registerTranslations() is now a no-op; removed helper methods

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@riasvdv riasvdv requested a review from brandonkelly February 24, 2026 19:59
@riasvdv riasvdv marked this pull request as ready for review February 24, 2026 19:59
Base automatically changed from feature/get-html-methods to 6.x February 25, 2026 06:57
# Conflicts:
#	src/Utility/Utilities/ProjectConfig.php
#	yii2-adapter/legacy/web/assets/queuemanager/QueueManagerAsset.php
#	yii2-adapter/legacy/web/assets/updates/UpdatesAsset.php
@riasvdv riasvdv merged commit 14c0423 into 6.x Feb 25, 2026
16 checks passed
@riasvdv riasvdv deleted the feature/all-translations branch February 25, 2026 07:38
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.

2 participants