osw3 / symfony-locale-tools
There is no license information available for the latest version (0.0.8) of this package.
0.0.8
2026-02-02 00:29 UTC
Requires
- symfony/intl: *
README
Install
composer require OSW3/symfony-locale-tool
Config
config/packages/translations.yaml
framework: enabled_locales: ['en', 'nl', 'fr', 'it', 'no'] default_locale: en translator: default_path: '%kernel.project_dir%/translations' fallbacks: - en - fr providers:
config/routes.yaml
controllers: resource: routing.controllers prefix: '/{_locale}' requirements: _locale: 'en|nl|fr|it|no'
config/services.yaml
services: OSW3\LocaleTools\EventSubscriber\LocaleNegotiationSubscriber: tags: - { name: 'kernel.event_subscriber' }
Services
$localeToolsService->getCurrent() // string $localeToolsService->getDefault() // string $localeToolsService->getAvailable() // array[code, name]
Twig
{{ locale_current() }}
{{ locale_default() }}
{{ locale_available() }}