-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fix #5236 [2.8][Translation] specify additional translation loading paths #5954
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
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f87f5f4
Fix #5236 [Translation] specify additional translation loading paths
40b7b78
Double "the"
c220cd0
Clearer formulation
0d8eadc
Wrong code-block tag
2cabebe
Replace with a shorter phrase
b3fa941
Adding configuration examples for other formats
46de0d6
Delete pmaraitre.xml
Balamung File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -334,7 +334,7 @@ The translator service is accessible in PHP templates through the | |
Translation Resource/File Names and Locations | ||
--------------------------------------------- | ||
|
||
Symfony looks for message files (i.e. translations) in the following locations: | ||
Symfony looks for message files (i.e. translations) in the following default locations: | ||
|
||
* the ``app/Resources/translations`` directory; | ||
|
||
|
@@ -372,6 +372,18 @@ The choice of which loader to use is entirely up to you and is a matter of | |
taste. The recommended option is to use ``xlf`` for translations. | ||
For more options, see :ref:`component-translator-message-catalogs`. | ||
|
||
.. note:: | ||
|
||
The paths at which Symfony will look for message files can be modified by adding | ||
your custom resources path in your config.yml file: | ||
|
||
.. code-block:: yaml | ||
|
||
framework: | ||
translator: | ||
paths: | ||
- %kernel.root_dir%/../vendor/Symfony/Component/Form/Resources/translations | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should document the other formats as well: .. note::
You can add other directories with the ``paths`` option in the configuration:
.. configuration-block::
.. code-block:: yaml
# app/config/config.yml
framework:
translator:
paths:
- "%kernel.root_dir%/../translations"
.. code-block:: xml
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-Instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
>
<framework:config>
<framework:translator>
<framework:path>%kernel.root_dir%/../translations</framework:path>
</framework:translator>
</framework:config>
</container>
.. code-block:: php
$container->loadFromExtension('framework', array(
'translator' => array(
'paths' => array(
'%kernel.root_dir%/../translations'
)
),
)); |
||
|
||
.. note:: | ||
|
||
You can also store translations in a database, or any other storage by | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can make this more direct and shorter (shorter = better is quite an important rule in documentations):
You can add other directories with the ``paths`` option in the configuration: