瀏覽代碼

Updated doc

dantleech 12 年之前
父節點
當前提交
f21e900b60
共有 1 個文件被更改,包括 24 次插入9 次删除
  1. 24 9
      Resources/doc/reference/translation.rst

+ 24 - 9
Resources/doc/reference/translation.rst

@@ -64,28 +64,43 @@ The Admin bundle comes with a customized form field template. The most notable
 change from the original one is the use of the translation domain provided by
 either the Admin instance or the field description to translate labels.
 
-Setting the translation domain
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+Overriding the translation domain
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-The translation domain of the Admin instance is used by default, however this
-can be overridden when defining new form fields:
+The translation domain (message catalog) can be overridden at either the form
+group or individual field level.
+
+If a translation domain is set at the group level it will cascade down to all
+fields within the group.
+
+Overriding the translation domain is of particular use when using
+:doc:`extensions <extensions>`, where the extension and the translations would
+be defined in one bundle, but implemented in many different admin instances.
+
+The following example sets the translation domain on a form group:
 
 .. code-block:: php
 
-        $formMapper->with('form.my_group')
+        $formMapper->with('form.my_group', array(
+            'translation_domain' => 'MyTranslationDomain'
+            ))
             ->add('publishable', 'checkbox', array(), array(
                 // ...
                 'translation_domain' => 'MyTranslationDomain',
             ))
             ->add('start_date', 'date', array(), array(
+            ));
+
+Setting the translation domain on an individual field:
+
+.. code-block:: php
+
+        $formMapper->with('form.my_group')
+            ->add('publishable', 'checkbox', array(), array(
                 // ...
                 'translation_domain' => 'MyTranslationDomain',
             ));
 
-This is of particular use when using admin :doc:`extensions <extensions>`,
-where the extension and the translations would be defined in one bundle, but
-implemented in many different admin instances.
-
 Setting the label name
 ^^^^^^^^^^^^^^^^^^^^^^