Skip to content

Commit 43ceb80

Browse files
committed
Add localization support for routes and services configuration
1 parent 2ab8177 commit 43ceb80

File tree

5 files changed

+11
-4
lines changed

5 files changed

+11
-4
lines changed

assets/icons/symfony.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

config/packages/translation.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
framework:
2-
default_locale: en
2+
set_locale_from_accept_language: true
3+
set_content_language_from_locale: true
4+
enabled_locales: '%app.supported_locales%'
5+
default_locale: '%app.default_locale%'
36
translator:
47
default_path: '%kernel.project_dir%/translations'
58
providers:

config/routes.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ controllers:
33
path: ../src/Controller/
44
namespace: App\Controller
55
type: attribute
6+
prefix:
7+
en: ''
8+
fr: '/fr'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
live_component:
22
resource: '@LiveComponentBundle/config/routes.php'
3-
prefix: '/_components'
3+
#prefix: '/_components'
44
# adjust prefix to add localization to your components
5-
#prefix: '/{_locale}/_components'
5+
prefix: '/{_locale}/_components'

config/services.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# Put parameters here that don't need to change on each machine where the app is deployed
55
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
66
parameters:
7+
app.default_locale: 'en'
8+
app.supported_locales: ['en', 'fr']
79

810
services:
911
# default configuration for services in *this* file

0 commit comments

Comments
 (0)