Lines Matching refs:plural
35 # J. David Ibanez implemented plural forms. Bruno Haible fixed some bugs.
67 Required to correctly interpret plural forms.
75 def c2py(plural):
76 """Gets a C expression as used in PO files for plural forms and returns a
85 tokens = tokenize.generate_tokens(StringIO(plural).readline)
90 'plural forms expression error, maybe unbalanced parenthesis'
93 raise ValueError, 'plural forms expression could be dangerous'
96 plural = plural.replace('&&', ' and ')
97 plural = plural.replace('||', ' or ')
100 plural = expr.sub(' not \\1', plural)
109 # Code to transform the plural expression, taking care of parentheses
111 for c in plural:
119 raise ValueError, 'unbalanced parenthesis in plural form'
124 plural = expr.sub(repl, stack.pop())
126 return eval('lambda n: int(%s)' % plural)
269 self.plural = lambda n: int(n != 1) # germanic plural by default
312 elif k == 'plural-forms':
314 plural = v[1].split('plural=')[1]
315 self.plural = c2py(plural)
326 # Plural forms
370 tmsg = self._catalog[(msgid1, self.plural(n))]
386 tmsg = self._catalog[(msgid1, self.plural(n))]
409 tmsg = self._catalog[(msgid1, self.plural(n))]