Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
ƍEYc@s¬dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddlm
Z
dZeje
ƒZdejfd„ƒYZdS(s4Private Message class for lazy translation support.
iÿÿÿÿN(t_locale(t
_translatestMessagecBs€eZdZdddeed„Zdd„Zedeed„ƒZd„Z	d„Z
d„Zd„Zd	„Z
d
„ZRS(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.
    tosloc	Gsg|stj||ƒ}ntt|ƒj||ƒ}||_||_||_||_||_|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.
        (	Rt_translate_msgidtsupert__new__tmsgidtdomaintparamsthas_contextual_formthas_plural_form(	tclsRtmsgtextR	RR
Rtargstmsg((sG/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_i18n/_message.pyR.s
					cCs_tj|j|j||j|jƒ}|jdkr:|Stj	|j|ƒ}|j
||ƒS(sQTranslate 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(RRRRR
RR	tNoneRttranslate_argst_safe_translate(tselftdesired_localettranslated_messagettranslated_params((sG/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_i18n/_message.pyt	translateGs
	c	Csy|s:tjƒ}|s$|dr-d}q:|d}ntjjtj|ƒƒ}tj|d|d|gdt	ƒ}|r±|r±t
jr™|jn|j}||ƒ}	nÄ|rÌ|rÌt
dƒ‚n©|r0|\}
}t
jrð|jn|j}d|
t|f}||ƒ}	t|	kru|}	qunE|ru|\}
}}t
jrW|jn|j}||
||ƒ}	n|	S(Niten_USt	localedirt	languagestfallbacksUnimplemented.s%s%s%s(tlocaletgetdefaultlocaletostenvirontgetRtget_locale_dir_variable_nametgettextttranslationtTruetsixtPY3tugettextt
ValueErrortCONTEXT_SEPARATORtngettextt	ungettext(RRRR
Rt
system_localet
locale_dirtlangt
translatorRtmsgctxtmsgtxttmsg_with_ctxt	msgsinglet	msgpluraltmsgcount((sG/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_i18n/_message.pyRds8	
			cCswy||}Wnbttfk
rr}d}tj|||j|fƒtj|||j|ƒ|j|}nX|S(sÈTrap translation errors and fall back to default translation.

        :param translated_message: the requested translation

        :param translated_params: the params to be inserted

        :return: if parameter insertion is successful then it is the
                 translated_message with the translated_params inserted, if the
                 requested translation fails then it is the default translation
                 with the params
        uQFailed to insert replacement values into translated message %s (Original: %r): %s(tKeyErrort	TypeErrortwarningstwarnRtLOGtdebug(RRRterrR((sG/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_i18n/_message.pyR“s
cCsR|j|ƒ}|jtj|ƒ|ƒ}t|jd|d|d|jƒ}|S(NR
R	R(t_sanitize_mod_paramsRR%t	text_typeRRR(RtotherR	tunicode_modtmodded((sG/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_i18n/_message.pyt__mod__·scs¡|dkr|f}n…t|tƒrŽi}tˆjtƒrh|j‡fd†ˆjjƒDƒƒn|j‡fd†|jƒDƒƒnˆj|ƒ}|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
        c3s*|] \}}|ˆj|ƒfVqdS(N(t_copy_param(t.0tkeytval(R(sG/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_i18n/_message.pys	<genexpr>Ósc3s*|] \}}|ˆj|ƒfVqdS(N(RC(RDRERF(R(sG/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_i18n/_message.pys	<genexpr>ÕsN(Rt
isinstancetdictR	tupdatetitemsRC(RR?R	((RsG/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_i18n/_message.pyR=Ãs	cCs3ytj|ƒSWntk
r.tj|ƒSXdS(N(tcopytdeepcopyt	ExceptionR%R>(Rtparam((sG/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_i18n/_message.pyRCÛs
cCs,ddlm}|dƒ}t|ƒ‚dS(Niÿÿÿÿ(t_s(Message objects do not support addition.(toslo_i18n._i18nROR7(RR?ROR((sG/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_i18n/_message.pyt__add__ãscCs
|j|ƒS(N(RQ(RR?((sG/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_i18n/_message.pyt__radd__èsN(t__name__t
__module__t__doc__RtFalseRRtstaticmethodRRRBR=RCRQRR(((sG/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_i18n/_message.pyR&s-	$				(RURKR"RtloggingRR8R%t	oslo_i18nRRR)t	getLoggerRSR:R>R(((sG/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_i18n/_message.pyt<module>s