[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    l10n-kde4/sr
From:       Chusslove Illich <caslav.ilic () gmx ! net>
Date:       2008-02-27 20:54:26
Message-ID: 1204145666.939062.9332.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 780029 by ilic:

Special contributors pmap.

 M  +32 -5     internal/scripts/auto-asmforms-sr.py  
 A             scripts/kdelibs/kdelibs4/contributors.pmap  
 M  +2 -1      scripts/kdelibs/kdelibs4/kdelibs4.js  


--- trunk/l10n-kde4/sr/internal/scripts/auto-asmforms-sr.py #780028:780029
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: UTF-8 -*-
 
-import sys, os, commands
+import sys, os, commands, codecs, re, shutil
 
 
 def main ():
@@ -88,7 +88,7 @@
         ("fonts", "kdelibs/kdelibs4", 1, 1, "нм,нж,нс",
          "нм,гм,дм,ам,им,лм,нж,гж,дж,аж,иж,лж,нс,гс,дс,ас,ис,лс", \
"", ""),  ("places", "kdelibs/kdelibs4", 0, 1, "", "", "", ""),
-        ("contributors", "dummy-dir", 1, 0, "", "", "", "-P ctr_ -w о"),
+        ("contributors", "kdelibs/kdelibs4", 1, 1, "", "", "", "-P ctr_ -w о"),
             # Prefix contributor entities with ctr_, to be able to select
             # them when the proper names are composed.
             # Add original contributor's name too, with ...-o suffix.
@@ -102,6 +102,27 @@
         pmapc_file = os.path.join(script_root, destdir, basename + ".pmapc")
         ent_file = os.path.join(entity_root, basename + ".entities")
 
+        # Modify input for contributors pmap.
+        frm_file_pmap = frm_file
+        frm_file_lmod_pmap = frm_file_lmod
+        if basename == "contributors":
+            mod_files = []
+            lrepl = re.compile(r"\b\w+/", re.U)
+            for file in (frm_file, frm_file_lmod):
+                # Make a temporary contributor frm by removing ?/ qualifiers.
+                mod_file = os.path.join(os.path.dirname(file),
+                                        "mod-" + os.path.basename(file))
+                shutil.copyfile(file, mod_file)
+                ifl = codecs.open(file, "r", "UTF-8")
+                ofl = codecs.open(mod_file, "w", "UTF-8")
+                for line in ifl.readlines():
+                    mline = lrepl.sub("", line)
+                    ofl.write(mline)
+                ifl.close()
+                ofl.close()
+                mod_files.append(mod_file)
+            frm_file_pmap, frm_file_lmod_pmap = mod_files
+
         # Finalize the property map call.
         cmd_pmap = cmd_pmap_base
         # - nominative and manual key forms as entry keys, plus extras.
@@ -111,9 +132,9 @@
         # - extra options
         cmd_pmap += "%s " % more_opts_pmap
         # - input files
-        cmd_pmap += frm_file + " "
+        cmd_pmap += "%s " % frm_file_pmap
         if os.path.isfile(frm_file_lmod):
-            cmd_pmap += "%s " % frm_file_lmod
+            cmd_pmap += "%s " % frm_file_lmod_pmap
         # - output file
         cmd_pmap += "-o %s " % pmap_file
 
@@ -129,7 +150,7 @@
         # - extra options
         cmd_ent += "%s " % more_opts_ent
         # - input files
-        cmd_ent += frm_file + " "
+        cmd_ent += "%s " % frm_file
         if os.path.isfile(frm_file_lmod):
             cmd_ent += "%s " % frm_file_lmod
         # - output file
@@ -150,7 +171,13 @@
             assure_system(cmd_ent)
             print "created %s" % ent_file
 
+        # Cleanup.
+        if frm_file_pmap != frm_file:
+            os.unlink(frm_file_pmap)
+        if frm_file_lmod_pmap != frm_file_lmod:
+            os.unlink(frm_file_lmod_pmap)
 
+
 def error (msg, code=1):
 
     cmdname = os.path.basename(sys.argv[0])
--- trunk/l10n-kde4/sr/scripts/kdelibs/kdelibs4/kdelibs4.js #780028:780029
@@ -394,11 +394,12 @@
 var call_suffix_to_pmap = {
     // call_suffix : map_name
     // suffix in accusative (appened to "prepare-" for call name).
-    "програми" : "apps",
+    "програме" : "apps",
     "језике" : "languages",
     "државе" : "countries",
     "фонтове" : "fonts",
     "места" : "places",
+    "доприносиоце" : "contributors",
 };
 for (suffix in call_suffix_to_pmap) {
     Ts.setcall("спреми-" + suffix,


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic