[Bf-translations-svn] SVN commit: /data/svn/bf-translations [125] trunk/po/tools: Updated tools ( cosmetic changes, + work-in-progress improvements on _update_msg.py).

bf-translations at blender.org bf-translations at blender.org
Tue Oct 25 09:50:38 CEST 2011


Revision: 125
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-translations&revision=125
Author:   mont29
Date:     2011-10-25 07:50:37 +0000 (Tue, 25 Oct 2011)
Log Message:
-----------
Updated tools (cosmetic changes, + work-in-progress improvements on _update_msg.py).

Modified Paths:
--------------
    trunk/po/tools/_update_msg.py
    trunk/po/tools/check_po.py
    trunk/po/tools/utils.py

Modified: trunk/po/tools/_update_msg.py
===================================================================
--- trunk/po/tools/_update_msg.py	2011-10-23 10:05:55 UTC (rev 124)
+++ trunk/po/tools/_update_msg.py	2011-10-25 07:50:37 UTC (rev 125)
@@ -121,6 +121,8 @@
 
         for prop in bl_rna.properties:
             # only write this property is our parent hasn't got it.
+            if bl_rna.identifier == "MOCAP_OT_addmocapfix":
+                print(prop)
             if prop in bl_rna_base_props:
                 continue
             if prop.identifier == "rna_type":
@@ -144,6 +146,8 @@
                         messages.setdefault(item.description, []).append(msgsrc)
 
     def walkRNA(bl_rna):
+        if bl_rna.identifier == "MOCAP_OT_AddMocapFix":
+            print("MOCAP_OT_AddMocapFix")
 
         if filterRNA(bl_rna):
             return
@@ -215,6 +219,11 @@
     for cls in cls_list:
         walkClass(cls)
 
+    cls_list = bpy.types.PropertyGroup.__subclasses__()
+    cls_list.sort(key=full_class_id)
+    for cls in cls_list:
+        walkClass(cls)
+
     from bpy_extras.keyconfig_utils import KM_HIERARCHY
 
     walk_keymap_hierarchy(KM_HIERARCHY, "KM_HIERARCHY")
@@ -326,6 +335,23 @@
 def dump_messages():
     import collections
 
+    def enable_addons():
+        """For now, enable all official addons, before extracting msgids."""
+        import addon_utils
+        import bpy
+
+        userpref = bpy.context.user_preferences
+        used_ext = {ext.module for ext in userpref.addons}
+        support = {"OFFICIAL"}
+        # collect the categories that can be filtered on
+        addons = [(mod, addon_utils.module_bl_info(mod)) for mod in addon_utils.modules(addon_utils.addons_fake_modules)]
+
+        for mod, info in addons:
+            if mod in used_ext or info["support"] not in support:
+                continue
+            module_name = mod.__name__
+            bpy.ops.wm.addon_enable(module=module_name)
+
     # check for strings like ": %d"
     ignore = ("%d", "%f", "%s", "%r",  # string formatting
               "*", ".", "(", ")", "-", "/", "\\", "+", ":", "#", "%"
@@ -350,6 +376,9 @@
 
     messages[""] = []
 
+    # Enable all wanted addons.
+    enable_addons()
+
     # get strings from RNA
     dump_messages_rna(messages)
 

Modified: trunk/po/tools/check_po.py
===================================================================
--- trunk/po/tools/check_po.py	2011-10-23 10:05:55 UTC (rev 124)
+++ trunk/po/tools/check_po.py	2011-10-25 07:50:37 UTC (rev 125)
@@ -143,11 +143,11 @@
 
     if args.stats and glob_stats["nbr"] != 0.0:
         print("\nAverage stats for all {:.0f} processed files:\n" \
-              "    {:>5.1%} done!\n" \
-              "    {:>5.1%} of messages are tooltips.\n" \
-              "    {:>5.1%} of tooltips are translated.\n" \
-              "    {:>5.1%} of translated messages are tooltips.\n" \
-              "    {:>5.1%} of messages are commented.\n" \
+              "    {:>6.1%} done!\n" \
+              "    {:>6.1%} of messages are tooltips.\n" \
+              "    {:>6.1%} of tooltips are translated.\n" \
+              "    {:>6.1%} of translated messages are tooltips.\n" \
+              "    {:>6.1%} of messages are commented.\n" \
               "    The org msgids are currently made of {} signs.\n" \
               "    All processed translations are currently made of {} signs.\n" \
               "".format(glob_stats["nbr"], glob_stats["lvl"]/glob_stats["nbr"],

Modified: trunk/po/tools/utils.py
===================================================================
--- trunk/po/tools/utils.py	2011-10-23 10:05:55 UTC (rev 124)
+++ trunk/po/tools/utils.py	2011-10-25 07:50:37 UTC (rev 125)
@@ -278,11 +278,11 @@
             glob_stats["nbr_signs"] = nbr_signs
 
     lines = ("",
-             "{:>5.1%} done! ({} translated messages over {}).\n".format(lvl, trans_msgs, tot_msgs),
-             "{:>5.1%} of messages are tooltips ({} over {}).\n".format(lvl_ttips, tot_ttips, tot_msgs),
-             "{:>5.1%} of tooltips are translated ({} over {}).\n".format(lvl_trans_ttips, trans_ttips, tot_ttips),
-             "{:>5.1%} of translated messages are tooltips ({} over {}).\n".format(lvl_ttips_in_trans, trans_ttips, trans_msgs),
-             "{:>5.1%} of messages are commented ({} over {}).\n".format(lvl_comm, comm_msgs, comm_msgs+tot_msgs),
+             "{:>6.1%} done! ({} translated messages over {}).\n".format(lvl, trans_msgs, tot_msgs),
+             "{:>6.1%} of messages are tooltips ({} over {}).\n".format(lvl_ttips, tot_ttips, tot_msgs),
+             "{:>6.1%} of tooltips are translated ({} over {}).\n".format(lvl_trans_ttips, trans_ttips, tot_ttips),
+             "{:>6.1%} of translated messages are tooltips ({} over {}).\n".format(lvl_ttips_in_trans, trans_ttips, trans_msgs),
+             "{:>6.1%} of messages are commented ({} over {}).\n".format(lvl_comm, comm_msgs, comm_msgs+tot_msgs),
              "This translation is currently made of {} signs.\n".format(nbr_trans_signs))
     print(prefix.join(lines))
     return 0



More information about the Bf-translations-svn mailing list