File tree
Expand file treeCollapse file tree2 files changed
+55
-3
lines changed Expand file treeCollapse file tree2 files changed
+55
-3
lines changed Original file line number | Diff line number | Diff line change |
---|
@@ -149,8 +149,12 @@ instead of the original ones.
|
149 | 149 | Translations
|
150 | 150 | ------------
|
151 | 151 |
|
152 |
| -Translations are not related to bundles, but to domains. That means that you |
153 |
| -can override the translations from any translation file, as long as it is in |
154 |
| -:ref:`the correct domain <using-message-domains>`. |
| 152 | +Translations are not related to bundles, but to :ref:`translation domains <using-message-domains>`. |
| 153 | +For this reason, you can override any bundle translation file from the main |
| 154 | +``translations/`` directory, as long as the new file uses the same domain. |
| 155 | + |
| 156 | +For example, to override the translations defined in the |
| 157 | +``Resources/translations/FOSUserBundle.es.yml`` file of the FOSUserBundle, |
| 158 | +create a``<your-project>/translations/FOSUserBundle.es.yml`` file. |
155 | 159 |
|
156 | 160 | .. _`the Doctrine documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/inheritance-mapping.html#overrides
|
Original file line number | Diff line number | Diff line change |
---|
@@ -129,6 +129,54 @@ own templates directory (or directories):
|
129 | 129 | ),
|
130 | 130 | ));
|
131 | 131 |
|
| 132 | +Override the Translations Directory |
| 133 | +----------------------------------- |
| 134 | + |
| 135 | +If your translation files are not stored in the default ``translations/`` |
| 136 | +directory, use the :ref:`framework.translator.paths <reference-translator-paths>` |
| 137 | +configuration option to define your own translations directory (or directories): |
| 138 | + |
| 139 | +.. configuration-block:: |
| 140 | + |
| 141 | +.. code-block:: yaml |
| 142 | +
|
| 143 | +# config/packages/translation.yaml |
| 144 | +framework: |
| 145 | +translator: |
| 146 | +# ... |
| 147 | +paths: ["%kernel.project_dir%/i18n"] |
| 148 | +
|
| 149 | + .. code-block:: xml |
| 150 | +
|
| 151 | +<!-- config/packages/translation.xml --> |
| 152 | +<?xml version="1.0" ?> |
| 153 | +<container xmlns="http://symfony.com/schema/dic/services" |
| 154 | +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 155 | +xmlns:twig="http://symfony.com/schema/dic/twig" |
| 156 | +xsi:schemaLocation="http://symfony.com/schema/dic/services |
| 157 | +http://symfony.com/schema/dic/services/services-1.0.xsd |
| 158 | +http://symfony.com/schema/dic/twig |
| 159 | +http://symfony.com/schema/dic/twig/twig-1.0.xsd"> |
| 160 | +
|
| 161 | +<framework:config> |
| 162 | +<framework:translator> |
| 163 | +<framework:path>%kernel.project_dir%/i18n</framework:path> |
| 164 | +</framework:translator> |
| 165 | +</framework:config> |
| 166 | +
|
| 167 | +</container> |
| 168 | +
|
| 169 | + .. code-block:: php |
| 170 | +
|
| 171 | +// config/packages/translation.php |
| 172 | +$container->loadFromExtension('framework', array( |
| 173 | +'translator' => array( |
| 174 | +'paths' => array( |
| 175 | +'%kernel.project_dir%/i18n', |
| 176 | +), |
| 177 | +), |
| 178 | +)); |
| 179 | +
|
132 | 180 | .. _override-web-dir:
|
133 | 181 | .. _override-the-web-directory:
|
134 | 182 |
|
|
You can’t perform that action at this time.
0 commit comments