8000 Clarifying and fixing bugs related to translation files and overridin… · web-dev/symfony-docs@f1355d2 · GitHub
[go: up one dir, main page]

Skip to content

Commit f1355d2

Browse files
committed
Clarifying and fixing bugs related to translation files and overriding. See symfony#1015
1 parent 001fa07 commit f1355d2

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

cookbook/bundles/inheritance.rst

Lines changed: 10 additions & 6 deletions
8000
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ How to use Bundle Inheritance to Override parts of a Bundle
77
When working with third-party bundles, you'll probably come across a situation
88
where you want to override a file in that third-party bundle with a file
99
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
1111
``Resources/`` directory.
1212

1313
For example, suppose that you're installing the `FOSUserBundle`_, but you
@@ -69,8 +69,8 @@ original method, and change its functionality::
6969
the controller using the standard ``FOSUserBundle:Registration:register``
7070
syntax in routes and templates. This is the best practice.
7171

72-
Overriding Resources: Templates, Routing, Translations, Validation, etc
73-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
72+
Overriding Resources: Templates, Routing, Validation, etc
73+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7474

7575
Most resources can also be overridden, simply by creating a file in the same
7676
location as your parent bundle.
@@ -91,10 +91,14 @@ The same goes for routing files, validation configuration and other resources.
9191
If you refer to resources without using the @BundleName shortcut, they
9292
can't be overridden in this way.
9393

94-
.. note::
94+
.. caution::
9595

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.
98102

99103
.. _`FOSUserBundle`: https://github.com/friendsofsymfony/fosuserbundle
100104

0 commit comments

Comments
 (0)
0