[open-ils-commits] r10565 - in trunk/build/i18n: . scripts

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Sep 9 10:46:42 EDT 2008


Author: dbs
Date: 2008-09-09 10:46:40 -0400 (Tue, 09 Sep 2008)
New Revision: 10565

Modified:
   trunk/build/i18n/Makefile.in
   trunk/build/i18n/scripts/merge_ils_events.py
Log:
Add merging of localized ils_events.xml descriptions to "install" target
Prevent repeated merging of localized ils_events.xml descriptions from adding duplicate descriptions


Modified: trunk/build/i18n/Makefile.in
===================================================================
--- trunk/build/i18n/Makefile.in	2008-09-09 13:47:06 UTC (rev 10564)
+++ trunk/build/i18n/Makefile.in	2008-09-09 14:46:40 UTC (rev 10565)
@@ -127,4 +127,4 @@
 	cp $(PROJECT)/$(LOCALE)/lang.dtd $(CHROME_PROPSDIR)/$(LOCALE)/
 	cp $(PROJECT)/$(LOCALE)/lang.dtd $(DTDDIR)/$(LOCALE)/
 	cp $(PROJECT)/$(LOCALE)/opac.dtd $(DTDDIR)/$(LOCALE)/
-
+	@scripts/merge_ils_events.py --master $(EVTSRC) --localization $(PROJECT)/$(LOCALE)/$(EVTXML) --output $(EVTSRC)

Modified: trunk/build/i18n/scripts/merge_ils_events.py
===================================================================
--- trunk/build/i18n/scripts/merge_ils_events.py	2008-09-09 13:47:06 UTC (rev 10564)
+++ trunk/build/i18n/scripts/merge_ils_events.py	2008-09-09 14:46:40 UTC (rev 10565)
@@ -19,8 +19,15 @@
 
     events = master_xml.getElementsByTagName('event')
     for event in events:
+        merged.documentElement.appendChild(merged.createTextNode("\n"))
+        l10n_node = get_l10n_event_desc(l10n_xml, event.getAttribute('code'))
+        for child in event.childNodes:
+            if child.nodeName == 'desc':
+                if child.getAttribute('xml:lang') == l10n_node.getAttribute('xml:lang'):
+                    event.removeChild(child)
+        event.appendChild(l10n_node)
         merged.documentElement.appendChild(event)
-        event.appendChild(get_l10n_event_desc(l10n_xml, event.getAttribute('code')))
+        merged.documentElement.appendChild(merged.createTextNode("\n"))
 
     return merged
 
@@ -53,6 +60,8 @@
         metavar='FILE')
     opts.add_option('-o', '--output', dest='outfile', \
         help='Write output to FILE (defaults to STDOUT)', metavar='FILE')
+    opts.add_option('-p', '--pretty', action='store', \
+        help='Write pretty XML output')
     (options, args) = opts.parse_args()
 
     if not options.master:
@@ -64,9 +73,15 @@
 
     if options.outfile:
         outfile = open(options.outfile, 'w')
-        outfile.write(merged.toprettyxml(encoding='utf-8'))
+        if options.pretty:
+            outfile.write(merged.toprettyxml(encoding='utf-8'))
+        else:
+            outfile.write(merged.toxml(encoding='utf-8'))
     else:
-        print merged.toprettyxml(encoding='utf-8')
+        if options.pretty:
+            print merged.toprettyxml(encoding='utf-8')
+        else:
+            print merged.toxml(encoding='utf-8')
 
 if __name__ == '__main__':
     main()


Property changes on: trunk/build/i18n/scripts/merge_ils_events.py
___________________________________________________________________
Name: svn:executable
   + *



More information about the open-ils-commits mailing list