# HG changeset patch # User Paul Boddie # Date 1245706423 -7200 # Node ID 277aa428aaa9f4b9e5b3bab104169dd907d72818 # Parent ae7bdbf61e32718b55f825d983d4ed2b09753e19 Removed Qt-related resources. Added a script and stylesheet for extracting translation keys from templates. diff -r ae7bdbf61e32 -r 277aa428aaa9 XSLForms/Prepare.py --- a/XSLForms/Prepare.py Mon Jun 22 21:45:16 2009 +0200 +++ b/XSLForms/Prepare.py Mon Jun 22 23:33:43 2009 +0200 @@ -1,9 +1,9 @@ #!/usr/bin/env python """ -Preparation of templating stylesheets. +Preparation of templating stylesheets and related resources. -Copyright (C) 2005, 2006, 2007, 2008 Paul Boddie +Copyright (C) 2005, 2006, 2007, 2008, 2009 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free @@ -138,42 +138,15 @@ _make_document(template_name, output_name, stylesheet_names, encoding) -# Qt Designer functions. +# Translation-related functions. -def make_qt_fragment(template_name, output_name, widget_name, stylesheet_names=["QtDesignerExtract.xsl"], encoding=None): - _make_document(template_name, output_name, stylesheet_names, encoding, parameters={"widget-name" : widget_name}) - -def ensure_qt_fragment(template_name, output_name, widget_name): - _ensure_document(template_name, output_name, make_qt_fragment, widget_name) +def find_translation_keys(template_name, output_name, stylesheet_names=["FindTranslationKeys.xsl"], encoding=None): -# Qt Designer Web functions. - -def make_qt_template(template_name, output_name, stylesheet_names=["QtDesigner.xsl"], encoding=None): - _make_document(template_name, output_name, stylesheet_names, encoding) + """ + Find translation keys in the document identified by 'template_name', + producing a translations document with the given 'output_name'. + """ -def ensure_qt_template(template_name, output_name): - _ensure_document(template_name, output_name, make_qt_template) - -def make_qt_stylesheet(template_name, output_name, stylesheet_names=["QtDesigner.xsl", "PrepareMacro.xsl", "Prepare.xsl"], encoding=None): _make_document(template_name, output_name, stylesheet_names, encoding) -def ensure_qt_stylesheet(template_name, output_name): - _ensure_document(template_name, output_name, make_qt_stylesheet) - -# Qt Designer Web functions for fragments. - -def make_qt_template_fragment(template_name, output_name, widget_name, stylesheet_names=["QtDesignerExtract.xsl", "QtDesigner.xsl"], encoding=None): - _make_document(template_name, output_name, stylesheet_names, encoding, parameters={"widget-name" : widget_name}) - -def ensure_qt_template_fragment(template_name, output_name, widget_name): - _ensure_document(template_name, output_name, make_qt_template_fragment, widget_name) - -def make_qt_stylesheet_fragment(template_name, output_name, widget_name, - stylesheet_names=["QtDesignerExtract.xsl", "QtDesigner.xsl", "PrepareMacro.xsl", "Prepare.xsl"], encoding=None): - - _make_document(template_name, output_name, stylesheet_names, encoding, parameters={"widget-name" : widget_name}) - -def ensure_qt_stylesheet_fragment(template_name, output_name, widget_name): - _ensure_document(template_name, output_name, make_qt_stylesheet_fragment, widget_name) - # vim: tabstop=4 expandtab shiftwidth=4 diff -r ae7bdbf61e32 -r 277aa428aaa9 XSLForms/XSL/FindTranslationKeys.xsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/XSLForms/XSL/FindTranslationKeys.xsl Mon Jun 22 23:33:43 2009 +0200 @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r ae7bdbf61e32 -r 277aa428aaa9 XSLForms/XSL/QtDesigner.xsl --- a/XSLForms/XSL/QtDesigner.xsl Mon Jun 22 21:45:16 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,373 +0,0 @@ - - - - - - - - - - - - - - <xsl:value-of select="widget/property[@name='caption']/string/text()"/> - - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - -1 - - - -
-
- - - - - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - - - - , - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - position: absolute - - - - - - - - - - - - - - - - - - - - - - ; left: px - - - - - - - ; top: px - - - - - - - ; width: px - - - - - - - ; height: px - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff -r ae7bdbf61e32 -r 277aa428aaa9 XSLForms/XSL/QtDesignerExtract.xsl --- a/XSLForms/XSL/QtDesignerExtract.xsl Mon Jun 22 21:45:16 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r ae7bdbf61e32 -r 277aa428aaa9 scripts/xslform_keys.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/xslform_keys.py Mon Jun 22 23:33:43 2009 +0200 @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +"Get translation keys from a template document." + +import XSLForms.Prepare +import sys + +if __name__ == "__main__": + try: + input_xml = sys.argv[1] + output_xml = sys.argv[2] + except IndexError: + print "Please specify a template input filename and a result filename." + print "For example:" + print "xslform_keys.py template.xhtml translations.xml" + sys.exit(1) + + XSLForms.Prepare.find_translation_keys(input_xml, output_xml) + +# vim: tabstop=4 expandtab shiftwidth=4