@@ -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
@@ -379,8 +378,52 @@ checks translation resources for several locales:
379
378
#. If it wasn't found, Symfony looks for the translation in a ``fr `` translation
380
379
resource (e.g. ``messages.fr.xlf ``);
381
380
382
- #. If the translation still isn't found, Symfony uses the ``fallbacks `` configuration
383
- parameter, which defaults to ``en `` (see `Configuration `_).
381
+ #. If the translation still isn't found, Symfony uses the ``fallbacks `` option,
382
+ which can be configured as follows:
383
+
384
+ .. configuration-block ::
385
+
386
+ .. code-block :: yaml
387
+
388
+ # config/packages/translation.yaml
389
+ framework :
390
+ translator :
391
+ fallbacks : ['en']
392
+ # ...
393
+
394
+ .. code-block :: xml
395
+
396
+ <!-- config/packages/translation.xml -->
397
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
398
+ <container xmlns =" http://symfony.com/schema/dic/services"
399
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
400
+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
401
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
402
+ https://symfony.com/schema/dic/services/services-1.0.xsd
403
+ http://symfony.com/schema/dic/symfony
404
+ https://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
405
+
406
+ <framework : config >
407
+ <framework : translator >
408
+ <framework : fallback >en</framework : fallback >
409
+ <!-- ... -->
410
+ </framework : translator >
411
+ </framework : config >
412
+ </container >
413
+
414
+ .. code-block :: php
415
+
416
+ // config/packages/translation.php
417
+ $container->loadFromExtension('framework', [
418
+ 'translator' => ['fallbacks' => ['en']],
419
+ // ...
420
+ ]);
421
+
422
+ .. deprecated :: 4.4
423
+
424
+ In Symfony versions before 4.4, the ``fallbacks `` option was initialized to
425
+ ``en `` (English) when not configured explicitly. Starting from Symfony 4.4,
426
+ this option is initialized to the same value as the ``default_locale `` option.
384
427
385
428
.. note ::
386
429
0 commit comments