Skip to content

Commit 76b23af

Browse files
ifdatticwouterj
authored andcommitted
Update translation.rst
| Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.3 | Fixed tickets |
1 parent 4eb8b64 commit 76b23af

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

book/translation.rst

+29-23
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ enable the ``translator`` in your configuration:
6868
<container xmlns="http://symfony.com/schema/dic/services"
6969
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7070
xmlns:framework="http://symfony.com/schema/dic/symfony"
71-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
72-
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
71+
xsi:schemaLocation="http://symfony.com/schema/dic/services
72+
http://symfony.com/schema/dic/services/services-1.0.xsd
73+
http://symfony.com/schema/dic/symfony
74+
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7375
7476
<framework:config>
7577
<framework:translator fallback="en" />
@@ -366,7 +368,8 @@ provides many loaders, including:
366368
* ``yml``: YAML file.
367369

368370
The choice of which loader to use is entirely up to you and is a matter of
369-
taste. For more options, see :ref:`component-translator-message-catalogs`.
371+
taste. The recommended option is to use ``xliff`` for translations.
372+
For more options, see :ref:`component-translator-message-catalogs`.
370373

371374
.. note::
372375

@@ -454,7 +457,7 @@ by the routing system using the special ``_locale`` parameter:
454457
# app/config/routing.yml
455458
contact:
456459
path: /{_locale}/contact
457-
defaults: { _controller: AcmeDemoBundle:Contact:index }
460+
defaults: { _controller: AppBundle:Contact:index }
458461
requirements:
459462
_locale: en|fr|de
460463
@@ -468,7 +471,7 @@ by the routing system using the special ``_locale`` parameter:
468471
http://symfony.com/schema/routing/routing-1.0.xsd">
469472
470473
<route id="contact" path="/{_locale}/contact">
471-
<default key="_controller">AcmeDemoBundle:Contact:index</default>
474+
<default key="_controller">AppBundle:Contact:index</default>
472475
<requirement key="_locale">en|fr|de</requirement>
473476
</route>
474477
</routes>
@@ -483,7 +486,7 @@ by the routing system using the special ``_locale`` parameter:
483486
$collection->add('contact', new Route(
484487
'/{_locale}/contact',
485488
array(
486-
'_controller' => 'AcmeDemoBundle:Contact:index',
489+
'_controller' => 'AppBundle:Contact:index',
487490
),
488491
array(
489492
'_locale' => 'en|fr|de',
@@ -524,8 +527,10 @@ the framework:
524527
<container xmlns="http://symfony.com/schema/dic/services"
525528
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
526529
xmlns:framework="http://symfony.com/schema/dic/symfony"
527-
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
528-
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
530+
xsi:schemaLocation="http://symfony.com/schema/dic/services
531+
http://symfony.com/schema/dic/services/services-1.0.xsd
532+
http://symfony.com/schema/dic/symfony
533+
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
529534
530535
<framework:config default-locale="en" />
531536
</container>
@@ -554,8 +559,8 @@ the error messages is easy: simply create a translation resource for the
554559
To start, suppose you've created a plain-old-PHP object that you need to
555560
use somewhere in your application::
556561

557-
// src/Acme/BlogBundle/Entity/Author.php
558-
namespace Acme\BlogBundle\Entity;
562+
// src/AppBundle/Entity/Author.php
563+
namespace AppBundle\Entity;
559564

560565
class Author
561566
{
@@ -568,17 +573,9 @@ not empty, add the following:
568573

569574
.. configuration-block::
570575

571-
.. code-block:: yaml
572-
573-
# src/Acme/BlogBundle/Resources/config/validation.yml
574-
Acme\BlogBundle\Entity\Author:
575-
properties:
576-
name:
577-
- NotBlank: { message: "author.name.not_blank" }
578-
579576
.. code-block:: php-annotations
580577
581-
// src/Acme/BlogBundle/Entity/Author.php
578+
// src/AppBundle/Entity/Author.php
582579
use Symfony\Component\Validator\Constraints as Assert;
583580
584581
class Author
@@ -589,15 +586,24 @@ not empty, add the following:
589586
public $name;
590587
}
591588
589+
.. code-block:: yaml
590+
591+
# src/AppBundle/Resources/config/validation.yml
592+
AppBundle\Entity\Author:
593+
properties:
594+
name:
595+
- NotBlank: { message: "author.name.not_blank" }
596+
592597
.. code-block:: xml
593598
594-
<!-- src/Acme/BlogBundle/Resources/config/validation.xml -->
599+
<!-- src/AppBundle/Resources/config/validation.xml -->
595600
<?xml version="1.0" encoding="UTF-8" ?>
596601
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
597602
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
598-
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
603+
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping
604+
http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
599605
600-
<class name="Acme\BlogBundle\Entity\Author">
606+
<class name="AppBundle\Entity\Author">
601607
<property name="name">
602608
<constraint name="NotBlank">
603609
<option name="message">author.name.not_blank</option>
@@ -608,7 +614,7 @@ not empty, add the following:
608614
609615
.. code-block:: php
610616
611-
// src/Acme/BlogBundle/Entity/Author.php
617+
// src/AppBundle/Entity/Author.php
612618
613619
// ...
614620
use Symfony\Component\Validator\Mapping\ClassMetadata;

0 commit comments

Comments
 (0)