/usr/lib/python2.6/site-packages/oslo_i18n
Edit: /usr/lib/python2.6/site-packages/oslo_i18n/_message.pyc (6762B)
Ñò
yDVc @ s d Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k Z d d k l Z d d k l Z d Z
e i e ƒ Z
d e i f d „ ƒ YZ d S( s4 Private Message class for lazy translation support.
iÿÿÿÿN( t _locale( t
_translates t Messagec B s— e Z d Z d d d e e d „ Z d d „ Z e d e e d „ ƒ Z d „ Z d „ Z
d „ Z d „ Z d „ Z
d
„ Z e i o
d „ Z n RS(
sý A Message object is a unicode object that can be translated.
Translation of Message is done explicitly using the translate() method.
For all non-translation intents and purposes, a Message is simply unicode,
and can be treated as such.
t osloc G si | p t i | | ƒ } n t t | ƒ i | | ƒ } | | _ | | _ | | _ | | _ | | _ | S( s& Create a new Message object.
In order for translation to work gettext requires a message ID, this
msgid will be used as the base unicode text. It is also possible
for the msgid and the base unicode text to be different by passing
the msgtext parameter.
( R t _translate_msgidt supert __new__t msgidt domaint paramst has_contextual_formt has_plural_form( t clsR t msgtextR R R
R t argst msg( ( s5 /tmp/pip-build-lt8jXN/oslo.i18n/oslo_i18n/_message.pyR - s
c C sa t i | i | i | | i | i ƒ } | i d j o | St i | i | ƒ } | i
| | ƒ S( sQ Translate this message to the desired locale.
:param desired_locale: The desired locale to translate the message to,
if no locale is provided the message will be
translated to the system's default locale.
:returns: the translated message in unicode
N( R R R R R
R R t NoneR t translate_argst _safe_translate( t selft desired_localet translated_messaget translated_params( ( s5 /tmp/pip-build-lt8jXN/oslo.i18n/oslo_i18n/_message.pyt translateF s
c C sy | p! t i ƒ } | d p d } n t i i t i | ƒ ƒ } t i | d | d | g d t ƒ} | o5 | o- t
i o
| i n | i } | | ƒ } nÒ | o | o t
d ƒ ‚ n´ | oc | \ }
} t
i o
| i n | i } d |
t | f } | | ƒ } t | j o
| } qunJ | oB | \ }
} } t
i o
| i n | i } | |
| | ƒ } n | S( Ni t en_USt localedirt languagest fallbacks Unimplemented.s %s%s%s( t localet getdefaultlocalet ost environt getR t get_locale_dir_variable_namet gettextt translationt Truet sixt PY3t ugettextt
ValueErrort CONTEXT_SEPARATORt ngettextt ungettext( R R R R
R t
system_localet
locale_dirt langt
translatorR t msgctxt msgtxtt msg_with_ctxt msgsinglet msgpluralt msgcount( ( s5 /tmp/pip-build-lt8jXN/oslo.i18n/oslo_i18n/_message.pyR c s4
c C sV y | | } WnA t t f j
o/ } t i d | | i | ƒ | i | } n X| S( NuQ Failed to insert replacement values into translated message %s (Original: %r): %s( t KeyErrort TypeErrort LOGt debugR ( R R R t err( ( s5 /tmp/pip-build-lt8jXN/oslo.i18n/oslo_i18n/_message.pyR s c C sR | i | ƒ } | i t i | ƒ | ƒ } t | i d | d | d | i ƒ} | S( NR
R R ( t _sanitize_mod_paramsR R% t text_typeR R R ( R t otherR t unicode_modt modded( ( s5 /tmp/pip-build-lt8jXN/oslo.i18n/oslo_i18n/_message.pyt __mod__£ s c s§ | d j o
| f } nŠ t | t ƒ oj h } t ˆ i t ƒ o* | i ‡ f d † ˆ i i ƒ Dƒ ƒ n | i ‡ f d † | i ƒ Dƒ ƒ n ˆ i | ƒ } | S( sš Sanitize the object being modded with this Message.
- Add support for modding 'None' so translation supports it
- Trim the modded object, which can be a large dictionary, to only
those keys that would actually be used in a translation
- Snapshot the object being modded, in case the message is
translated, it will be used as it was when the Message was created
c 3 s. x' | ] \ } } | ˆ i | ƒ f Vq Wd S( N( t _copy_param( t .0t keyt val( R ( s5 /tmp/pip-build-lt8jXN/oslo.i18n/oslo_i18n/_message.pys
¿ s c 3 s. x' | ] \ } } | ˆ i | ƒ f Vq Wd S( N( RA ( RB RC RD ( R ( s5 /tmp/pip-build-lt8jXN/oslo.i18n/oslo_i18n/_message.pys Á s N( R t
isinstancet dictR t updatet itemsRA ( R R= R ( ( R s5 /tmp/pip-build-lt8jXN/oslo.i18n/oslo_i18n/_message.pyR; ¯ s
c C s5 y t i | ƒ SWn t j
o t i | ƒ SXd S( N( t copyt deepcopyt ExceptionR% R<