%page args="x, y=_('Page arg 1'), z=_('Page arg 2')"/> <%! import random def gettext(message): return message _ = gettext def ungettext(s, p, c): if c == 1: return s return p top = gettext('Begin') %> <% # TRANSLATOR: Hi there! hithere = _('Hi there!') # TRANSLATOR: you should not be seeing this in the .po rows = [[v for v in range(0,10)] for row in range(0,10)] hello = _('Hello') %>
tag is ok?
${_("Inside a p tag")}
## TRANSLATOR: also this${even_with_other_code_first()} - ${_("Later in a p tag")}
## TRANSLATOR: we still ignore comments too far from the string${_("No action at a distance.")}
## TRANSLATOR: nothing to extract from these blocks % if 1==1:One is one!
% elif 1==2:One is two!
% else:How much is one?
% endif % for i in range(10):${i} squared is ${i*i}
% else:Done with squares!
% endfor % while random.randint(1,6) != 6:Not 6!
% endwhile ## TRANSLATOR: for now, try/except blocks are ignored % try: <% 1/0 %> % except:Failed!
% endtry ## TRANSLATOR: this should not cause a parse error ${ 1 }