-
- Downloads
Add a locale service for working with the the active locale
We currently configure symfony to apply the "Accept-Language" header to all requests, so there remain only two cases where we need to manually adjust things: * In case an endpoint renders HTML that is displayed in an iframe or popup we still need to provide an option to pass a language via a query parameter. This then takes precedence over the header. * In case we need a language identifier for another service, where we need to request an external resource for a specific language. In this case we either need to take the request language or in case we are in a CLI context the default locale configured in symfony.
Showing
- .php-cs-fixer.dist.php 1 addition, 0 deletions.php-cs-fixer.dist.php
- composer.json 2 additions, 1 deletioncomposer.json
- composer.lock 3 additions, 2 deletionscomposer.lock
- src/Locale/Locale.php 89 additions, 0 deletionssrc/Locale/Locale.php
- src/Resources/config/services.yaml 4 additions, 0 deletionssrc/Resources/config/services.yaml
- tests/LocaleTest.php 42 additions, 0 deletionstests/LocaleTest.php
... | ... | @@ -29,7 +29,8 @@ |
"symfony/twig-bundle": "^5.4", | ||
"symfony/uid": "^5.4", | ||
"symfony/validator": "^5.4", | ||
"symfony/yaml": "^5.4" | ||
"symfony/yaml": "^5.4", | ||
"ext-intl": "*" | ||
}, | ||
"require-dev": { | ||
"brainmaestro/composer-git-hooks": "^2.8.5", | ||
... | ... |
src/Locale/Locale.php
0 → 100644
tests/LocaleTest.php
0 → 100644
Please register or sign in to comment