ó
®â0_c           @  sw  d  Z  d d l m Z d d l Z d d l Z d d l m Z d d l m Z d d l	 m
 Z
 d d l m Z d d l m Z d	 d
 d d d d d d d d d d d d d d d d d d d d d d  d! d" d# g Z d$ Z d% e f d& „  ƒ  YZ d' e f d( „  ƒ  YZ e ƒ  Z [ d) „  Z e Z d* „  Z d+ „  Z d, „  Z d- „  Z d. „  Z d/ „  Z e e e ƒ Z e e e j  ƒ Z! e e e j  ƒ Z" d d0 „ Z$ d1 „  Z% d d2 „ Z& d d3 „ Z' d d4 „ Z( d5 „  Z) d6 „  Z* d7 e f d8 „  ƒ  YZ+ d9 „  Z, d: „  Z- d; „  Z. d< „  Z/ e0 d= „ Z1 d> „  Z2 d? „  Z3 d@ „  Z4 dA „  Z5 e e5 e j  ƒ Z6 dB „  Z7 e j8 dC ƒ Z9 dD „  Z: d S(E   u   
Internationalization support.
iÿÿÿÿ(   t   unicode_literalsN(   t   six(   t   ContextDecorator(   t   RemovedInDjango21Warning(   t
   force_text(   t   lazyu   activateu
   deactivateu   overrideu   deactivate_allu   get_languageu   get_language_from_requestu   get_language_infou   get_language_bidiu   check_for_languageu	   to_localeu
   templatizeu   string_concatu   gettextu   gettext_lazyu   gettext_noopu   ugettextu   ugettext_lazyu   ugettext_noopu   ngettextu   ngettext_lazyu	   ungettextu   ungettext_lazyu   pgettextu   pgettext_lazyu	   npgettextu   npgettext_lazyu   LANGUAGE_SESSION_KEYu	   _languaget   TranslatorCommentWarningc           B  s   e  Z RS(    (   t   __name__t
   __module__(    (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyR       s   t   Transc           B  s   e  Z d  Z d „  Z RS(   u  
    The purpose of this class is to store the actual translation function upon
    receiving the first call to that function. After this is done, changes to
    USE_I18N will have no effect to which function is served upon request. If
    your tests rely on changing USE_I18N, you can delete all the functions
    from _trans.__dict__.

    Note that storing the function with setattr will have a noticeable
    performance effect, as access to the function goes the normal path,
    instead of using __getattr__.
    c         C  sb   d d l  m } | j r, d d l m } n d d l m } t |  | t | | ƒ ƒ t | | ƒ S(   Niÿÿÿÿ(   t   settings(   t
   trans_real(   t
   trans_null(   t   django.confR
   t   USE_I18Nt   django.utils.translationR   R   t   setattrt   getattr(   t   selft	   real_nameR
   t   trans(    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyt   __getattr__9   s    	(   R   R   t   __doc__R   (    (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyR	   ,   s   c         C  s   t  j |  ƒ S(   N(   t   _transt   gettext_noop(   t   message(    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyR   I   s    c         C  s   t  j |  ƒ S(   N(   R   t   gettext(   R   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyR   P   s    c         C  s   t  j |  | | ƒ S(   N(   R   t   ngettext(   t   singulart   pluralt   number(    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyR   T   s    c         C  s   t  j |  ƒ S(   N(   R   t   ugettext(   R   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyR   X   s    c         C  s   t  j |  | | ƒ S(   N(   R   t	   ungettext(   R   R   R   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyR    \   s    c         C  s   t  j |  | ƒ S(   N(   R   t   pgettext(   t   contextR   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyR!   `   s    c         C  s   t  j |  | | | ƒ S(   N(   R   t	   npgettext(   R"   R   R   R   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyR#   d   s    c           sŸ   t  ˆ t j ƒ r4 ˆ ˆ d <t ˆ ˆ ƒ ˆ   } ng ˆ j ƒ  ‰ d ˆ f ‡ ‡ ‡ f d †  ƒ  Y‰  t ‡  f d †  ˆ  ƒ ˆ   } ‡ ‡ ‡ ‡ f d †  | _ | S(   Nu   numbert   NumberAwareStringc             s5   e  Z ‡ f d  †  Z d „  Z ‡  ‡ ‡ f d †  Z RS(   c           s   t  ˆ  d ƒ S(   Nu   singular(   t   bool(   R   (   t   kwargs(    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyt   __bool__u   s    c         S  s   t  |  ƒ j |  ƒ S(   N(   t   typeR'   (   R   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyt   __nonzero__x   s    c           sŒ   t  | t ƒ rJ ˆ rJ y | ˆ } WqP t k
 rF t d ˆ ƒ ‚ qP Xn | } | ˆ d <ˆ  ˆ   } y | | } Wn t k
 r‡ n X| S(   Nu|   Your dictionary lacks key '%s'. Please provide it, because it is required to determine whether string is singular or plural.u   number(   t
   isinstancet   dictt   KeyErrort	   TypeError(   R   t   rhst   number_valuet
   translated(   t   funcR&   R   (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyt   __mod__{   s    
(   R   R   R'   R)   R2   (    (   R1   R&   R   (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyR$   t   s   	c            s   ˆ  ƒ  S(   N(    (   R&   (   R$   (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyt   <lambda>   t    c             s   t  ˆ  ˆ ˆ ˆ f f S(   N(   t   _lazy_number_unpickle(    (   R1   R   t   original_kwargst   resultclass(    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyR3   ‘   R4   (   R*   R   t   integer_typesR   t   copyt
   __reduce__(   R1   R7   R   R&   t   proxy(    (   R$   R1   R&   R   R6   R7   sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyt   lazy_numberm   s    
"c         C  s   t  |  | d | | S(   NR   (   R<   (   R1   R7   R   R&   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyR5   •   s    c      	   C  s   t  t t d |  d | d | ƒS(   NR   R   R   (   R<   R   t   str(   R   R   R   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyt   ngettext_lazy™   s    c      	   C  s"   t  t t j d |  d | d | ƒS(   NR   R   R   (   R<   R    R   t	   text_type(   R   R   R   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyt   ungettext_lazy   s    c         C  s(   t  t t j d |  d | d | d | ƒS(   NR"   R   R   R   (   R<   R#   R   R?   (   R"   R   R   R   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyt   npgettext_lazy¡   s    c         C  s   t  j |  ƒ S(   N(   R   t   activate(   t   language(    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyRB   ¥   s    c           C  s
   t  j ƒ  S(   N(   R   t
   deactivate(    (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyRD   ©   s    t   overridec           B  s&   e  Z e d  „ Z d „  Z d „  Z RS(   c         C  s   | |  _  | |  _ d  S(   N(   RC   RD   (   R   RC   RD   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyt   __init__®   s    	c         C  s6   t  ƒ  |  _ |  j d  k	 r+ t |  j ƒ n t ƒ  d  S(   N(   t   get_languaget   old_languageRC   t   NoneRB   t   deactivate_all(   R   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyt	   __enter__²   s    c         C  s=   |  j  d  k r t ƒ  n  |  j r, t ƒ  n t |  j  ƒ d  S(   N(   RH   RI   RJ   RD   RB   (   R   t   exc_typet	   exc_valuet	   traceback(    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyt   __exit__¹   s
    
	
(   R   R   t   FalseRF   RK   RO   (    (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyRE   ­   s   	c           C  s
   t  j ƒ  S(   N(   R   RG   (    (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyRG   Â   s    c           C  s
   t  j ƒ  S(   N(   R   t   get_language_bidi(    (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyRQ   Æ   s    c         C  s   t  j |  ƒ S(   N(   R   t   check_for_language(   t	   lang_code(    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyRR   Ê   s    c         C  s   t  j |  ƒ S(   N(   R   t	   to_locale(   RC   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyRT   Î   s    c         C  s   t  j |  | ƒ S(   N(   R   t   get_language_from_request(   t   requestt
   check_path(    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyRU   Ò   s    c         C  s   t  j |  ƒ S(   N(   R   t   get_language_from_path(   t   path(    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyRX   Ö   s    c         K  s   d d l  m } | |  |  S(   Ni   (   t
   templatize(   t   templateRZ   (   t   srcR&   RZ   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyRZ   Ú   s    c           C  s
   t  j ƒ  S(   N(   R   RJ   (    (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyRJ   ß   s    c          G  s-   t  j d t d d ƒd j d „  |  Dƒ ƒ S(   uu   
    Lazy variant of string concatenation, needed for translations that are
    constructed from multiple parts.
    ua   django.utils.translate.string_concat() is deprecated in favor of django.utils.text.format_lazy().t
   stackleveli   u    c         s  s   |  ] } t  | ƒ Vq d  S(   N(   R   (   t   .0t   s(    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pys	   <genexpr>ì   s    (   t   warningst   warnR   t   join(   t   strings(    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyt   _string_concatã   s    c         C  sò   d d l  m } yC | |  } d | k rL d | k rL t | d d ƒ } n | } Wn{ t k
 rÐ d |  k r‚ t d |  ƒ ‚ n  |  j d ƒ d } y | | } WqÑ t k
 rÌ t d |  | f ƒ ‚ qÑ Xn X| rî t | d ƒ | d	 <n  | S(
   Niÿÿÿÿ(   t	   LANG_INFOu   fallbacku   namei    u   -u   Unknown language code %s.u    Unknown language code %s and %s.u   name_translated(   t   django.conf.localeRe   t   get_language_infoR,   t   splitt   ugettext_lazy(   RS   Re   t	   lang_infot   infot   generic_lang_code(    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyRg   ò   s"    

u   \s*\n\s*c         C  s   t  j d |  j ƒ  ƒ S(   Nu    (   t   trim_whitespace_ret   subt   strip(   R_   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyt   trim_whitespace  s    (;   R   t
   __future__R    t   reR`   t   django.utilsR   t   django.utils.decoratorsR   t   django.utils.deprecationR   t   django.utils.encodingR   t   django.utils.functionalR   t   __all__t   LANGUAGE_SESSION_KEYt   SyntaxWarningR   t   objectR	   R   R   t   ugettext_noopR   R   R   R    R!   R#   R=   t   gettext_lazyR?   Ri   t   pgettext_lazyRI   R<   R5   R>   R@   RA   RB   RD   RE   RG   RQ   RR   RT   RP   RU   RX   RZ   RJ   Rd   t   string_concatRg   t   compileRm   Rp   (    (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/utils/translation/__init__.pyt   <module>   sp   											(												