summaryrefslogtreecommitdiff
path: root/test/templates/gettext.mako
blob: 367af5509da8eee9367621b40dc34f329a6a8c2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<%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')
%>
<div id="header">
  ${_('Welcome')}
</div>
<table>
    % for row in (hithere, hello, _('Yo')):
        ${makerow(row)}
    % endfor
    ${makerow(count=2)}
</table>


<div id="main">

## TRANSLATOR: Ensure so and
## so, thanks
  ${_('The')} fuzzy ${ungettext('bunny', 'bunnies', random.randint(1, 2))}
</div>

<div id="footer">
  ## TRANSLATOR: Good bye
  ${_('Goodbye')}
</div>

<%def name="makerow(row=_('Babel'), count=1)">
    <!-- ${ungettext('hella', 'hellas', count)} -->
    % for i in range(count):
      <tr>
      % for name in row:
          <td>${name}</td>\
      % endfor
      </tr>
    % endfor
</%def>

<%def name="comment()">
  <!-- ${caller.body()} -->
</%def>

<%block name="foo">
    ## TRANSLATOR: Ensure so and
    ## so, thanks
      ${_('The')} fuzzy ${ungettext('bunny', 'bunnies', random.randint(1, 2))}
</%block>

<%call expr="comment">
  P.S.
  ## TRANSLATOR: HTML comment
  ${_('Goodbye, really!')}
</%call>

<!-- ${_('P.S. byebye')} -->

<div id="end">
  <a href="#top">
    ## TRANSLATOR: you won't see this either

    ${_('Top')}
  </a>
</div>

<%def name="panel()">

${_(u'foo')} <%self:block_tpl title="#123", name="_('baz')" value="${_('hoho')}" something="hi'there" somethingelse='hi"there'>

${_(u'bar')}

</%self:block_tpl>

</%def>