Package moul :: Module i18n
[hide private]
[frames] | no frames]

Module i18n



pyMoul i18n

A dumb and do nearly nothing i18n message factory and message implementation. It's a kind of a place holder.

Inspired by zope.i18nmessage
>>> _ = MessageFactory('test')
>>> msg = _(u'test')
>>> msg
u'test'
>>> msg.domain
'test'
>>> msg.default
u'test'
>>> msg.mapping is None
True
>>> template = _(u'id', u'This is a ${name}!')
>>> template
u'id'
>>> template % {'name' : u'test'}
u'This is a test!'
>>> template % {'name' : u'another test'}
u'This is a another test!'
>>> error = _('id')
Traceback (most recent call last):
...
TypeError: ustr must be a unicode string
>>> error = _(u'id', 'This is a ${name}!')
Traceback (most recent call last):
...
TypeError: default must be a unicode string


Classes [hide private]
  Message
  MessageFactory
Factory for Messages

Variables [hide private]
  __author__ = 'Christian Heimes'
  __version__ = '$Id: i18n.py 122 2007-02-02 17:34:06Z tiran $'
  __revision__ = '$Revision: 122 $'
  PymoulMessageFactory = <moul.i18n.MessageFactory object at 0x402aff0c>
  _ = <moul.i18n.MessageFactory object at 0x402aff0c>

Variables Details [hide private]

__author__

None
Value:
'Christian Heimes'                                                     
      

__version__

None
Value:
'$Id: i18n.py 122 2007-02-02 17:34:06Z tiran $'                        
      

__revision__

None
Value:
'$Revision: 122 $'                                                     
      

PymoulMessageFactory

None
Value:
<moul.i18n.MessageFactory object at 0x402aff0c>                        
      

_

None
Value:
<moul.i18n.MessageFactory object at 0x402aff0c>