Move languages to site - #706
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR moves language configuration from the global system level to per鈥恠ite control, updates various services and controllers to use the new site鈥恖evel API, and migrates translation keys accordingly.
- Switch panel UI and routing to use
Site::languages()instead of system config - Introduce
LanguagesFactory,Site::setLanguages(), and remove the old loader - Migrate translation keys from
panel.options.system.languages.*topanel.site.languages.*
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| panel/views/pages/editor.php | Update dropdown display check to use site languages |
| panel/translations/*.yaml | Remove old panel.options.system.languages.* and add panel.site.languages.* |
| formwork/src/Services/Loaders/TranslationsServiceLoader.php | Remove unused Languages import and setter call |
| formwork/src/Panel/Controllers/PagesController.php | Use site languages availability and validation |
| formwork/src/Languages/LanguagesFactory.php | Create LanguagesFactory to build language instances |
| formwork/src/Languages/Languages.php | Add hasMultiple() method |
| formwork/src/Cms/Site.php | Inject LanguagesFactory, implement setLanguages() |
| formwork/src/Cms/App.php | Register LanguagesFactory, remove old LanguagesServiceLoader |
| formwork/routes.php | Update language route action to use Site::languages() |
| formwork/config/system.yaml | Remove deprecated languages block |
| formwork/config/site.yaml | Add new languages configuration block |
Comments suppressed due to low confidence (4)
formwork/src/Languages/LanguagesFactory.php:18
- Docblock incorrectly marks
defaultasbool; it should be a string code. Update the type tostring|nullor similar.
* @param array{available: list<string>, httpPreferred: bool, default?: bool} $config
panel/views/pages/editor.php:33
- The method
language()does not exist onSite; this should belanguages()->hasMultiple().
<?php if ($site->language()->hasMultiple()) : ?>
formwork/routes.php:3
Stris used later but not imported. Adduse Formwork\Utils\Str;at the top of the file.
use Formwork\Cms\Site;
panel/translations/en.yaml:263
- Typo in translation: 'prefered' should be spelled 'preferred'.
panel.site.languages.preferredLanguage: Use browser prefered language
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.