Merged
Conversation
There was a problem hiding this comment.
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 bothViewandHtmlStackclasses - Removed individual
registerTranslations()calls from asset bundles, controllers, and Twig templates - Refactored
TranslationServiceProviderto usecallAfterResolving()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.
# Conflicts: # src/Utility/Utilities/ProjectConfig.php # yii2-adapter/legacy/web/assets/queuemanager/QueueManagerAsset.php # yii2-adapter/legacy/web/assets/updates/UpdatesAsset.php
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.
No description provided.