@@ -59,8 +59,8 @@ Configuration
59
59
-------------
60
60
61
61
The previous command creates an initial config file where you can define the
62
- default locale of the app and the :ref: ` fallback locales < translation-fallback >`
63
- that will be used if Symfony can't find some translation :
62
+ default locale of the application and the directory where the translation files
63
+ are located :
64
64
65
65
.. configuration-block ::
66
66
@@ -70,8 +70,7 @@ that will be used if Symfony can't find some translation:
70
70
framework :
71
71
default_locale : ' en'
72
72
translator :
73
- fallbacks : ['en']
74
- # ...
73
+ default_path : ' %kernel.project_dir%/translations'
75
74
76
75
.. code-block :: xml
77
76
@@ -87,7 +86,7 @@ that will be used if Symfony can't find some translation:
87
86
88
87
<framework : config default-locale =" en" >
89
88
<framework : translator >
90
- <framework : fallback >en </framework : fallback >
89
+ <framework : default-path >'%kernel.project_dir%/translations' </framework : default-path >
91
90
<!-- ... -->
92
91
</framework : translator >
93
92
</framework : config >
@@ -98,7 +97,7 @@ that will be used if Symfony can't find some translation:
98
97
// config/packages/translation.php
99
98
$container->loadFromExtension('framework', [
100
99
'default_locale' => 'en',
101
- 'translator' => ['fallbacks ' => ['en'] ],
100
+ 'translator' => ['default_path ' => '%kernel.project_dir%/translations' ],
102
101
// ...
103
102
]);
104
103
@@ -397,8 +396,52 @@ checks translation resources for several locales:
397
396
#. If it wasn't found, Symfony looks for the translation in a ``fr `` translation
398
397
resource (e.g. ``messages.fr.xlf ``);
399
398
400
- #. If the translation still isn't found, Symfony uses the ``fallbacks `` configuration
401
- parameter, which defaults to ``en `` (see `Configuration `_).
399
+ #. If the translation still isn't found, Symfony uses the ``fallbacks `` option,
400
+ which can be configured as follows:
401
+
402
+ .. configuration-block ::
403
+
404
+ .. code-block :: yaml
405
+
406
+ # config/packages/translation.yaml
407
+ framework :
408
+ translator :
409
+ fallbacks : ['en']
410
+ # ...
411
+
412
+ .. code-block :: xml
413
+
414
+ <!-- config/packages/translation.xml -->
415
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
416
+ <container xmlns =" http://symfony.com/schema/dic/services"
417
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
418
+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
419
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
420
+ https://symfony.com/schema/dic/services/services-1.0.xsd
421
+ http://symfony.com/schema/dic/symfony
422
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
423
+
424
+ <framework : config >
425
+ <framework : translator >
426
+ <framework : fallback >en</framework : fallback >
427
+ <!-- ... -->
428
+ </framework : translator >
429
+ </framework : config >
430
+ </container >
431
+
432
+ .. code-block :: php
433
+
434
+ // config/packages/translation.php
435
+ $container->loadFromExtension('framework', [
436
+ 'translator' => ['fallbacks' => ['en']],
437
+ // ...
438
+ ]);
439
+
440
+ .. deprecated :: 4.4
441
+
442
+ In Symfony versions before 4.4, the ``fallbacks `` option was initialized to
443
+ ``en `` (English) when not configured explicitly. Starting from Symfony 4.4,
444
+ this option is initialized to the same value as the ``default_locale `` option.
402
445
403
446
.. note ::
404
447
0 commit comments