Debian Codegraph @

Cheetah/Macros/I18n.py

raw symbols SCIP
1 import gettext
2 _ = gettext.gettext
3
4
5 class I18n(object):
6 def __init__(self, parser):
7 pass
8
9 def __call__(self,
10 src, # aka message,
11 plural=None,
12 # should be a string representing the name of the '$var'
13 # rather than $var itself
14 n=None,
15 id=None,
16 domain=None,
17 source=None,
18 target=None,
19 comment=None,
20
21 # args that are automatically supplied by the parser when the
22 # macro is called:
23 parser=None,
24 macros=None,
25 isShortForm=False,
26 EOLCharsInShortForm=None,
27 startPos=None,
28 endPos=None,
29 ):
30 """This is just a stub at this time.
31
32 plural = the plural form of the message
33 n = a sized argument to distinguish between single and plural forms
34
35 id = msgid in the translation catalog
36 domain = translation domain
37 source = source lang
38 target = a specific target lang
39 comment = a comment to the translation team
40
41 See the following for some ideas
42 http://www.zope.org/DevHome/Wikis/DevSite/Projects/ComponentArchitecture/ZPTInternationalizationSupport
43
44 Other notes:
45 - There is no need to replicate the i18n:name attribute
46 from plone/PTL, as cheetah placeholders serve the same purpose.
47 """
48
49 # print macros['i18n']
50 src = _(src)
51 if isShortForm and endPos < len(parser):
52 return src + EOLCharsInShortForm
53 else:
54 return src