Hello again, one final word, in case someone is interested (apart from me, I mean ;-))
> Then, extract messages using: > > python setup.py extract_messages -k _p More precisely: python setup.py extract_messages -k _p:1,2 The argument "_p:1,2" will tell Babel that arguments 1 and 2 of function _p are translation strings. > Now, what remains to be done is let Babel know how to handle the > parameters of _p(). So, I'm now turning my attention to > > babel/messages/extract.py > > and: > > lingua/extractors/python.py The python extractor in Lingua is hard-coded to consider arg1 as a translation string, and arg2 as a default value (this is derived from the signature of the TranslationString constructor). I was able to work around the problem by subclassing the PythonExtractor class, so that I'm using arg2 for plurals instead of default: --------------------------------------------------------------------- import tokenize from lingua.extractors.python import PythonExtractor as BasePythonExtractor class PythonExtractor(BasePythonExtractor): def stateWaiting(self, ttype, tstring, lineno): if ttype == tokenize.NAME and tstring in self.keywords: self.state = self.stateKeywordSeen self.msg = dict(lineno=lineno, func=tstring) def addMessage(self, msg): if not msg.get('label'): return default = msg.get('default') if default: messages = (u''.join(msg['label']), u''.join(default)) else: messages = u''.join(msg['label']) self.messages.append( (msg['lineno'], msg['func'], messages, [])) extract_python = PythonExtractor() --------------------------------------------------------------------- As regards Mako, the default extractor handles pluralization out of the box. As far as I'm concerned, all my localization problems are solved :-) Laurent. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discuss+unsubscr...@googlegroups.com. To post to this group, send email to pylons-discuss@googlegroups.com. Visit this group at http://groups.google.com/group/pylons-discuss?hl=en. For more options, visit https://groups.google.com/groups/opt_out.