Skip to content

Update override article #2601

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 16, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Documented "translation" section
  • Loading branch information
wouterj committed May 4, 2013
commit a55a705536378c7ffbe4cb6401f4d0da41db2acf
9 changes: 3 additions & 6 deletions cookbook/bundles/inheritance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,9 @@ The same goes for routing files, validation configuration and other resources.

.. caution::

Translation files do not work in the same way as described above. All
translation files are accumulated into a set of "pools" (one for each)
domain. Symfony loads translation files from bundles first (in the order
that the bundles are initialized) and then from your ``app/Resources``
directory. If the same translation is specified in two resources, the
translation from the resource that's loaded last will win.
Translation files do not work in the same way as described above. Read
:ref:`override-translations` if you want to learn how to override
translations.

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

16 changes: 15 additions & 1 deletion cookbook/bundles/override.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Templates
---------

For information on overriding templates, see

* :ref:`overriding-bundle-templates`.
* :doc:`/cookbook/bundles/inheritance`

Expand Down Expand Up @@ -120,9 +121,22 @@ Validation metadata

In progress...

.. _override-translations:

Translations
------------

In progress...
Translations are not related to bundles, but to domains. That means that you
can override the translations from any translation file, as long as it is in
:ref:`the correct domain <translation-domains>`.

.. caution::

The last translation file always wins. That mean that you need to make
sure to load the class which overrides the translation of another bundle
before that bundle in the ``AppKernel``.

The file that always wins is the one that is placed in
``app/Resources/translations``, as those files are always loaded as last.

.. _`the Doctrine documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/inheritance-mapping.html#overrides