[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54182] trunk/blender/release/scripts/ modules/bl_i18n_utils/utils.py: Some optimization ( their is much more possible here, but it will have to wait for complete refactor I?\226?\128? \153m working on currently).

Bastien Montagne montagne29 at wanadoo.fr
Tue Jan 29 09:34:30 CET 2013


Revision: 54182
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54182
Author:   mont29
Date:     2013-01-29 08:34:26 +0000 (Tue, 29 Jan 2013)
Log Message:
-----------
Some optimization (their is much more possible here, but it will have to wait for complete refactor I?\226?\128?\153m working on currently).

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/bl_i18n_utils/utils.py

Modified: trunk/blender/release/scripts/modules/bl_i18n_utils/utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bl_i18n_utils/utils.py	2013-01-29 08:21:21 UTC (rev 54181)
+++ trunk/blender/release/scripts/modules/bl_i18n_utils/utils.py	2013-01-29 08:34:26 UTC (rev 54182)
@@ -236,8 +236,9 @@
         import difflib
         similar_pool = {}
         if use_similar > 0.0:
-            for key in self.msgs:
-                similar_pool.setdefault(key[1], set()).add(key)
+            for key, msg in self.msgs.items():
+                if msg.msgstr:  # No need to waste time with void translations!
+                    similar_pool.setdefault(key[1], set()).add(key)
 
         msgs = self._new_messages()
         for (key, msg) in ref.msgs.items():
@@ -259,10 +260,11 @@
                 if skey:
                     msgs[key].msgstr = self.msgs[skey].msgstr
                     msgs[key].is_fuzzy = True
-        # Add back all "old" and already commented messages as commented ones, if required.
+        # Add back all "old" and already commented messages as commented ones, if required
+        # (and translation was not void!).
         if keep_old_commented:
             for key, msg in self.msgs.items():
-                if key not in msgs:
+                if key not in msgs and msg.msgstr:
                     msgs[key] = msg
                     msgs[key].is_commented = True
         # And finalize the update!




More information about the Bf-blender-cvs mailing list