Commits

Philip Jenvey committed 163bf15

support the <%namespacename:defname> syntax in the babel extractor
fixes #118

  • Participants
  • Parent commits b01882d

Comments (0)

Files changed (4)

+0.2.6
+- Support the <%namespacename:defname> syntax in
+  the babel extractor. [ticket:118]
+
 0.2.5
 - Added a "decorator" kw argument to <%def>,
   allows custom decoration functions to wrap

File lib/mako/ext/babelplugin.py

             child_nodes = node.nodes
         elif isinstance(node, parsetree.PageTag):
             code = node.body_decl.code
+        elif isinstance(node, parsetree.CallNamespaceTag):
+            attribs = ', '.join(['%s=%s' % (key, val)
+                                 for key, val in node.attributes.iteritems()])
+            code = '{%s}' % attribs
+            child_nodes = node.nodes
         elif isinstance(node, parsetree.ControlLine):
             if node.isend:
                 translator_comments = []

File test/babelplugin.py

                  (45, 'ungettext', (u'hella', u'hellas', None), []),
                  (62, '_', u'Goodbye, really!', [u'TRANSLATOR: HTML comment']),
                  (65, '_', u'P.S. byebye', []),
-                 (71, '_', u'Top', [])]
+                 (71, '_', u'Top', []), 
+                 (77, '_', u'foo', []),
+                 (77, '_', u'baz', []),
+                 (79, '_', u'bar', [])
+                 ]
             self.assertEqual(expected, messages)
 
 except ImportError:

File test_htdocs/gettext.mako

     ${_('Top')}
   </a>
 </div>
+
+<%def name="panel()">
+
+${_(u'foo')} <%self:block_tpl title="123", name="_(u'baz')">
+
+${_(u'bar')}
+
+</%self:block_tpl>
+
+</%def>