@@ -68,8 +68,10 @@ enable the ``translator`` in your configuration:
68
68
<container xmlns =" http://symfony.com/schema/dic/services"
69
69
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
70
70
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" >
73
75
74
76
<framework : config >
75
77
<framework : translator fallback =" en" />
@@ -366,7 +368,8 @@ provides many loaders, including:
366
368
* ``yml ``: YAML file.
367
369
368
370
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 `.
370
373
371
374
.. note ::
372
375
@@ -454,7 +457,7 @@ by the routing system using the special ``_locale`` parameter:
454
457
# app/config/routing.yml
455
458
contact :
456
459
path : /{_locale}/contact
457
- defaults : { _controller: AcmeDemoBundle :Contact:index }
460
+ defaults : { _controller: AppBundle :Contact:index }
458
461
requirements :
459
462
_locale : en|fr|de
460
463
@@ -468,7 +471,7 @@ by the routing system using the special ``_locale`` parameter:
468
471
http://symfony.com/schema/routing/routing-1.0.xsd" >
469
472
470
473
<route id =" contact" path =" /{_locale}/contact" >
471
- <default key =" _controller" >AcmeDemoBundle :Contact:index</default >
474
+ <default key =" _controller" >AppBundle :Contact:index</default >
472
475
<requirement key =" _locale" >en|fr|de</requirement >
473
476
</route >
474
477
</routes >
@@ -483,7 +486,7 @@ by the routing system using the special ``_locale`` parameter:
483
486
$collection->add('contact', new Route(
484
487
'/{_locale}/contact',
485
488
array(
486
- '_controller' => 'AcmeDemoBundle :Contact:index',
489
+ '_controller' => 'AppBundle :Contact:index',
487
490
),
488
491
array(
489
492
'_locale' => 'en|fr|de',
@@ -524,8 +527,10 @@ the framework:
524
527
<container xmlns =" http://symfony.com/schema/dic/services"
525
528
xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
526
529
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" >
529
534
530
535
<framework : config default-locale =" en" />
531
536
</container >
@@ -554,8 +559,8 @@ the error messages is easy: simply create a translation resource for the
554
559
To start, suppose you've created a plain-old-PHP object that you need to
555
560
use somewhere in your application::
556
561
557
- // src/Acme/BlogBundle /Entity/Author.php
558
- namespace Acme\BlogBundle \Entity;
562
+ // src/AppBundle /Entity/Author.php
563
+ namespace AppBundle \Entity;
559
564
560
565
class Author
561
566
{
@@ -568,17 +573,9 @@ not empty, add the following:
568
573
569
574
.. configuration-block ::
570
575
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
-
579
576
.. code-block :: php-annotations
580
577
581
- // src/Acme/BlogBundle /Entity/Author.php
578
+ // src/AppBundle /Entity/Author.php
582
579
use Symfony\Component\Validator\Constraints as Assert;
583
580
584
581
class Author
@@ -589,15 +586,24 @@ not empty, add the following:
589
586
public $name;
590
587
}
591
588
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
+
592
597
.. code-block :: xml
593
598
594
- <!-- src/Acme/BlogBundle /Resources/config/validation.xml -->
599
+ <!-- src/AppBundle /Resources/config/validation.xml -->
595
600
<?xml version =" 1.0" encoding =" UTF-8" ?>
596
601
<constraint-mapping xmlns =" http://symfony.com/schema/dic/constraint-mapping"
597
602
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" >
599
605
600
- <class name =" Acme\BlogBundle \Entity\Author" >
606
+ <class name =" AppBundle \Entity\Author" >
601
607
<property name =" name" >
602
608
<constraint name =" NotBlank" >
603
609
<option name =" message" >author.name.not_blank</option >
@@ -608,7 +614,7 @@ not empty, add the following:
608
614
609
615
.. code-block :: php
610
616
611
- // src/Acme/BlogBundle /Entity/Author.php
617
+ // src/AppBundle /Entity/Author.php
612
618
613
619
// ...
614
620
use Symfony\Component\Validator\Mapping\ClassMetadata;
0 commit comments