Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd58cb56

Browse files
committed
feature#5954Fix#5236 [2.8][Translation] specify additional translation loading paths (Pierre Maraitre, Balamung)
This PR was merged into the 2.8 branch.Discussion----------Fix#5236 [2.8][Translation] specify additional translation loading pathsMy humble try of contributing from the SymfonyCon Hackday ! :)| Q | A| ------------- | ---| Doc fix? | no| New docs? | yes| Applies to | 2.8| Fixed tickets |#5236Commits-------46de0d6 Delete pmaraitre.xmlb3fa941 Adding configuration examples for other formats2cabebe Replace with a shorter phrase0d8eadc Wrong code-block tagc220cd0 Clearer formulation40b7b78 Double "the"f87f5f4Fix#5236 [Translation] specify additional translation loading paths
2 parents63dd246 +46de0d6 commitd58cb56

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

‎book/translation.rst

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ The translator service is accessible in PHP templates through the
334334
Translation Resource/File Names and Locations
335335
---------------------------------------------
336336

337-
Symfony looks for message files (i.e. translations) in the following locations:
337+
Symfony looks for message files (i.e. translations) in the followingdefaultlocations:
338338

339339
* the ``app/Resources/translations`` directory;
340340

@@ -372,6 +372,49 @@ The choice of which loader to use is entirely up to you and is a matter of
372372
taste. The recommended option is to use ``xlf`` for translations.
373373
For more options, see:ref:`component-translator-message-catalogs`.
374374

375+
..note::
376+
377+
You can add other directories with the ``paths`` option in the configuration:
378+
379+
..configuration-block::
380+
381+
..code-block::yaml
382+
383+
# app/config/config.yml
384+
framework:
385+
translator:
386+
paths:
387+
-"%kernel.root_dir%/../translations"
388+
389+
..code-block::xml
390+
391+
<?xml version="1.0" encoding="UTF-8" ?>
392+
<containerxmlns="http://symfony.com/schema/dic/services"
393+
xmlns:framework="http://symfony.com/schema/dic/symfony"
394+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-Instance"
395+
xsi:schemaLocation="http://symfony.com/schema/dic/services
396+
http://symfony.com/schema/dic/services/services-1.0.xsd
397+
http://symfony.com/schema/dic/symfony
398+
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
399+
>
400+
401+
<framework:config>
402+
<framework:translator>
403+
<framework:path>%kernel.root_dir%/../translations</framework:path>
404+
</framework:translator>
405+
</framework:config>
406+
</container>
407+
408+
..code-block::php
409+
410+
$container->loadFromExtension('framework', array(
411+
'translator' => array(
412+
'paths' => array(
413+
'%kernel.root_dir%/../translations'
414+
)
415+
),
416+
));
417+
375418
..note::
376419

377420
You can also store translations in a database, or any other storage by

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp