-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #1511 Refactor how we define the available locales (javieregu…
…iluz) This PR was squashed before being merged into the main branch. Discussion ---------- Refactor how we define the available locales I never liked the `app_locales` parameter: https://github.com/symfony/demo/blob/main/config/services.yaml#L9 But we need it for the route locale requirements. I was digging into how to improve this ... and realized that if we use the standard [enabled_locales](https://symfony.com/doc/current/reference/configuration/framework.html#enabled-locales) config option from Symfony, the `{_locale}` parameter included in the URLs is automatically restricted to those values. So, we can simplify code by moving to `enabled_locales` without losing any functionality. Commits ------- 2955454 Refactor how we define the available locales
- Loading branch information
Showing
6 changed files
with
21 additions
and
36 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,6 @@ | |
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration | ||
parameters: | ||
locale: 'en' | ||
# This parameter defines the codes of the locales (languages) enabled in the application | ||
app_locales: ar|en|fr|de|es|cs|nl|ru|uk|ro|pt_BR|pl|it|ja|id|ca|sl|sq|hr|zh_CN|bg|tr|lt|bs|sr_Cyrl|sr_Latn|eu|ne|bn|vi | ||
app.notifications.email_sender: [email protected] | ||
|
||
services: | ||
|
@@ -18,7 +16,7 @@ services: | |
# this allows to define the scalar arguments once and apply them to any services | ||
# defined/created in this file; if some argument is used rarely, instead of defining | ||
# it here you can use the #[Autowire] attribute to inject it manually in the service constructor | ||
string $locales: '%app_locales%' | ||
array $enabledLocales: '%kernel.enabled_locales%' | ||
string $defaultLocale: '%locale%' | ||
|
||
# makes classes in src/ available to be used as services | ||
|
This file contains 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
This file contains 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