Browse Source

[docs] updated documentation regarding translatable

gediminasm 13 years ago
parent
commit
26299d6dd0
2 changed files with 28 additions and 5 deletions
  1. 7 0
      README.md
  2. 21 5
      doc/translatable.md

+ 7 - 0
README.md

@@ -7,6 +7,12 @@
 **Note:** Use 2.1.x tag in order to use extensions based on Doctrine2.1.x versions. Currently
 **Note:** Use 2.1.x tag in order to use extensions based on Doctrine2.1.x versions. Currently
 master branch is based on 2.2.x versions and may not work with 2.1.x components
 master branch is based on 2.2.x versions and may not work with 2.1.x components
 
 
+**2011-10-08**
+
+- Thanks to [@acasademont](https://github.com/acasademont) Translatable now does not store translations for default locale. It is always left as original record value.
+So be sure you do not change your default locale per project or per data migration. This way
+it is more rational and unnecessary to store it additionaly in translation table.
+
 **2011-09-24**
 **2011-09-24**
 
 
 - Sluggable was refactored with a **BC break** for the sake of simplicity it now uses a single @Slug annotation.
 - Sluggable was refactored with a **BC break** for the sake of simplicity it now uses a single @Slug annotation.
@@ -76,6 +82,7 @@ To setup and run tests follow these steps:
 
 
 ### Contributors:
 ### Contributors:
 
 
+- acasademont [acasademont](https://github.com/acasademont)
 - Lukas Botsch [lbotsch](http://github.com/lbotsch)
 - Lukas Botsch [lbotsch](http://github.com/lbotsch)
 - Daniel Gomes [danielcsgomes](http://github.com/danielcsgomes)
 - Daniel Gomes [danielcsgomes](http://github.com/danielcsgomes)
 - megabite [oscarballadares](http://github.com/oscarballadares)
 - megabite [oscarballadares](http://github.com/oscarballadares)

+ 21 - 5
doc/translatable.md

@@ -16,6 +16,12 @@ Features:
 
 
 [blog_test]: http://gediminasm.org/test "Test extensions on this blog"
 [blog_test]: http://gediminasm.org/test "Test extensions on this blog"
 
 
+**2011-10-08**
+
+- Thanks to [@acasademont](https://github.com/acasademont) Translatable now does not store translations for default locale. It is always left as original record value.
+So be sure you do not change your default locale per project or per data migration. This way
+it is more rational and unnecessary to store it additionaly in translation table.
+
 Update **2011-04-21**
 Update **2011-04-21**
 
 
 - Implemented multiple translation persistense through repository
 - Implemented multiple translation persistense through repository
@@ -39,7 +45,7 @@ and any number of them
 - Public [Translatable repository](http://github.com/l3pp4rd/DoctrineExtensions "Translatable extension on Github") is available on github
 - Public [Translatable repository](http://github.com/l3pp4rd/DoctrineExtensions "Translatable extension on Github") is available on github
 - Using other extensions on the same Entity fields may result in unexpected way
 - Using other extensions on the same Entity fields may result in unexpected way
 - May inpact your application performace since it does an additional query for translation
 - May inpact your application performace since it does an additional query for translation
-- Last update date: **2011-08-08**
+- Last update date: **2011-10-08**
 
 
 **Portability:**
 **Portability:**
 
 
@@ -329,6 +335,9 @@ set in **TranslationListener** globaly. To save article with its translations:
     $em->flush();
     $em->flush();
 
 
 This inserted an article and inserted the translations for it in "en_us" locale
 This inserted an article and inserted the translations for it in "en_us" locale
+only if **en_us** is not the [default locale](#advanced-examples) in case if default locale
+matches current locale - it uses original record value as translation
+
 Now lets update our article in diferent locale:
 Now lets update our article in diferent locale:
 
 
     // first load the article
     // first load the article
@@ -476,15 +485,22 @@ available in **Doctrine**
 
 
 In some cases we need a default translation as a fallback if record does not have
 In some cases we need a default translation as a fallback if record does not have
 a translation on globaly used locale. In that case Translation Listener takes the
 a translation on globaly used locale. In that case Translation Listener takes the
-current value of Entity. But there is a way to specify a **default locale**
-which would force Entity to not update it`s field if current locale is not a default
+current value of Entity. So if **default locale** is specified and it matches the
+locale in which record is being translated - it will not create extra translation
+but use original values instead. If translation fallback is set to **false** it
+will fill untranslated values as blanks
 
 
 To set the default locale:
 To set the default locale:
 
 
     $translationListener->setDefaultLocale('en_us');
     $translationListener->setDefaultLocale('en_us');
 
 
-Default locale should be set on the **TranslationListener** initialization
-once, since it can impact your current records if it will be changed.
+To set translation fallback:
+
+    $translationListener->setTranslationFallback(true); // default is false
+
+Note: Default locale should be set on the **TranslationListener** initialization
+once, since it can impact your current records if it will be changed. As it
+will not store extra record in translation table. 
 
 
 ### Translation Entity
 ### Translation Entity