@@ -7,7 +7,7 @@ How to use Bundle Inheritance to Override parts of a Bundle
7
7
When working with third-party bundles, you'll probably come across a situation
8
8
where you want to override a file in that third-party bundle with a file
9
9
in one of your own bundles. Symfony gives you a very convenient way to override
10
- things like controllers, templates, translations, and other files in a bundle's
10
+ things like controllers, templates, and other files in a bundle's
11
11
``Resources/ `` directory.
12
12
13
13
For example, suppose that you're installing the `FOSUserBundle `_, but you
@@ -69,8 +69,8 @@ original method, and change its functionality::
69
69
the controller using the standard ``FOSUserBundle:Registration:register ``
70
70
syntax in routes and templates. This is the best practice.
71
71
72
- Overriding Resources: Templates, Routing, Translations, Validation, etc
73
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72
+ Overriding Resources: Templates, Routing, Validation, etc
73
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74
74
75
75
Most resources can also be overridden, simply by creating a file in the same
76
76
location as your parent bundle.
@@ -91,10 +91,14 @@ The same goes for routing files, validation configuration and other resources.
91
91
If you refer to resources without using the @BundleName shortcut, they
92
92
can't be overridden in this way.
93
93
94
- .. note ::
94
+ .. caution ::
95
95
96
- To override translation files, please make sure the child bundle is initialized
97
- after the parent bundle in the AppKernel.
96
+ Translation files do not work in the same way as described above. All
97
+ translation files are accumulated into a set of "pools" (one for each)
98
+ domain. Symfony loads translation files from bundles first (in the order
99
+ that the bundles are initialized) and then from your ``app/Resources ``
100
+ directory. If the same translation is specified in two resources, the
101
+ translation from the resource that's loaded last will win.
98
102
99
103
.. _`FOSUserBundle` : https://github.com/friendsofsymfony/fosuserbundle
100
104
0 commit comments