瀏覽代碼

[docs] update the personal translation in sf2 doc a bit

gedi 13 年之前
父節點
當前提交
2305ba7bfc
共有 1 個文件被更改,包括 25 次插入26 次删除
  1. 25 26
      doc/translatable.md

+ 25 - 26
doc/translatable.md

@@ -842,35 +842,37 @@ This would create translations for english and lithuanian, and for fruits, **ru*
 Easy like that, any suggestions on improvements are very welcome
 
 
-Example code to use Personal Translations with (sonata) i18n Forms:
+### Example code to use Personal Translations with (Symfony2 Sonata) i18n Forms:
 
-Suppose you have a Sonata Backend with s asimple form like:
+Suppose you have a Sonata Backend with s a simple form like:
 
 ``` php
-    protected function configureFormFields(FormMapper $formMapper)    {
-        $formMapper
-            ->with('General')
-            ->add('title', 'text')
-            ->end()
-            ;
-    }
+<?php
+protected function configureFormFields(FormMapper $formMapper)    {
+    $formMapper
+        ->with('General')
+        ->add('title', 'text')
+        ->end()
+    ;
+}
 ```
 
 Then you can turn it into an 118n Form by providing the following changes.
 
 ``` php
-    protected function configureFormFields(FormMapper $formMapper)
-    {
-        $formMapper
-            ->with('General')
-                ->add('title', 'translatable_field', array(
-                    'field'                => 'title',
-                    'personal_translation' => 'ExampleBundle\Entity\Translation\ProductTranslation',
-                    'property_path'        => 'translations',
-                ))
-            ->end()
-        ;
-    }
+<?php
+protected function configureFormFields(FormMapper $formMapper)
+{
+    $formMapper
+        ->with('General')
+            ->add('title', 'translatable_field', array(
+                'field'                => 'title',
+                'personal_translation' => 'ExampleBundle\Entity\Translation\ProductTranslation',
+                'property_path'        => 'translations',
+            ))
+        ->end()
+    ;
+}
 
 ```
 
@@ -885,11 +887,8 @@ https://gist.github.com/2437078
 Then you can change to your needs:
 
 ``` php
-                    'field'                => 'title', //you need to provide which field you wish to translate
-                    'personal_translation' => 'ExampleBundle\Entity\Translation\ProductTranslation', //the personal translation entity
+    'field'                => 'title', //you need to provide which field you wish to translate
+    'personal_translation' => 'ExampleBundle\Entity\Translation\ProductTranslation', //the personal translation entity
 
 ```
 
-
-
-