
    }c_"                        U d Z ddlZddlZddlmZmZ ddlmZ ddlmZm	Z	m
Z
mZmZmZmZmZ  G d de          Z ee          ae
eeef         ef         ed<   	 d)deee                  dee         dededeeef         f
dZd*dedeeee         f         ddfdZdededeeef         fdZd)dededefdZd)dededefdZdedededefdZd+dedede	fdZ ed	          Z ed	d          Z ed           ed           ed           ed           ed            ed!           ed"           ed#           ed$           ed%          d&
Zi Z e
eef         ed'<   i Z!e
eef         ed(<   dS ),zLocale utilities.    N)
UserStringdefaultdict)NullTranslations)AnyCallableDictIterableListOptionalTupleUnionc                      e Zd ZdZdZdededefdZde	e         fdZ
dededdfd	Zedefd
            ZddededefdZdee         fdZdefdZdedefdZdedefdZdedefdZdedefdZdedefdZdedefdZdedefdZde	ee	edf         f         fdZde	ee	e         f         ddfdZd dZdefdZdS )!_TranslationProxya  
    Class for proxy strings from gettext translations. This is a helper for the
    lazy_* functions from this module.

    The proxy implementation attempts to be as complete as possible, so that
    the lazy objects should mostly work as expected, for example for sorting.

    This inherits from UserString because some docutils versions use UserString
    for their Text nodes, which then checks its argument for being either a
    basestring or UserString, otherwise calls str() -- not unicode() -- on it.
    _func_argsfuncargsreturnc                 X    |st          |          S t                              |           S N)strobject__new__)clsr   r   s      6lib/python3.11/site-packages/sphinx/locale/__init__.pyr   z_TranslationProxy.__new__   s(     	t99~~c"""    c                 "    | j         f| j        z   S r   r   selfs    r   __getnewargs__z _TranslationProxy.__getnewargs__   s    
}tz))r   Nc                 "    || _         || _        d S r   r   )r    r   r   s      r   __init__z_TranslationProxy.__init__!   s    



r   c                       | j         | j         S r   r   r   s    r   dataz_TranslationProxy.data%   s    tz4:&&r   encodingerrorsc                     |r7|r| j                             ||          S | j                             |          S | j                                         S r   )r%   encode)r    r&   r'   s      r   r)   z_TranslationProxy.encode,   sT     	& 2y''&999y''1119##%%%r   c                 *    t          t                    S r   )dirr   r   s    r   __dir__z_TranslationProxy.__dir__5   s    3xxr   c                 *    t          | j                  S r   )r   r%   r   s    r   __str__z_TranslationProxy.__str__8   s    49~~r   otherc                     | j         |z   S r   r%   r    r/   s     r   __add__z_TranslationProxy.__add__;       y5  r   c                     || j         z   S r   r1   r2   s     r   __radd__z_TranslationProxy.__radd__>       ty  r   c                     | j         |z  S r   r1   r2   s     r   __mod__z_TranslationProxy.__mod__A   r4   r   c                     || j         z  S r   r1   r2   s     r   __rmod__z_TranslationProxy.__rmod__D   r7   r   c                     | j         |z  S r   r1   r2   s     r   __mul__z_TranslationProxy.__mul__G   r4   r   c                     || j         z  S r   r1   r2   s     r   __rmul__z_TranslationProxy.__rmul__J   r7   r   namec                 `    |dk    r|                                  S t          | j        |          S )N__members__)r,   getattrr%   )r    r@   s     r   __getattr__z_TranslationProxy.__getattr__M   s/    =  	"<<>>!ty$'''r   .c                     | j         | j        fS r   r   r   s    r   __getstate__z_TranslationProxy.__getstate__R   s    z4:%%r   tupc                 $    |\  | _         | _        d S r   r   )r    rG   s     r   __setstate__z_TranslationProxy.__setstate__U   s    !$
DJJJr   c                     | S r    r   s    r   __copy__z_TranslationProxy.__copy__X   s    r   c                     	 dt          t          | j                            z   S # t          $ r d| j        j        z  cY S w xY w)Niz<%s broken>)reprr   r%   	Exception	__class____name__r   s    r   __repr__z_TranslationProxy.__repr__[   sS    	;c$)nn---- 	; 	; 	; 4>#:::::	;s   #& AA)NN)r   r   )rR   
__module____qualname____doc__	__slots__r   r   r   r   r   r!   r#   propertyr%   bytesr)   r
   r,   r.   r3   r6   r9   r;   r   r=   r?   rD   rF   rI   rL   rS   rK   r   r   r   r   
   s       
 
 #I#8 #C #F # # # #*c
 * * * *X c d     'c ' ' ' X'& &s &3 &% & & & &c        !S !S ! ! ! !!c !c ! ! ! !!S !S ! ! ! !!c !c ! ! ! !!S !S ! ! ! !!c !c ! ! ! !( ( ( ( ( (
&eHeCHo$=> & & & &%hc
&: ; % % % % %   ;# ; ; ; ; ; ;r   r   translatorssphinxgenerallocale_dirslanguagecatalog	namespacer   c                    t                               ||f          }|j        t          u rd}d}|r"d|v r||                    d          d         g}n|r|g}nd}| D ]D}	 t          j        |||          }||}n|                    |           5# t          $ r Y Aw xY w|t                      }d}|t           ||f<   ||fS )a  Look for message catalogs in `locale_dirs` and *ensure* that there is at
    least a NullTranslations catalog set in `translators`. If called multiple
    times or if several ``.mo`` files are found, their contents are merged
    together (thus making ``init`` reentrant).
    NT_r   )	localedir	languagesF)	rZ   getrQ   r   splitgettexttranslationadd_fallbackrP   )	r]   r^   r_   r`   
translatorhas_translationrd   dir_transs	            r   initrn   e   s     )W!566J// 
O C8O *2HNN34G4G4J)K			 J			  	 		'49UUUE /"

''... 	 	 	D	   %''
(2KG$%&&s    1B
BBcategoryvaluec                 ^    	 t          j        | |           dS # t           j        $ r Y dS w xY w)a  Update locale settings.

    This does not throw any exception even if update fails.
    This is workaround for Python's bug.

    For more details:

    * https://github.com/sphinx-doc/sphinx/issues/5724
    * https://bugs.python.org/issue18378#msg215215

    .. note:: Only for internal use.  Please don't call this method from extensions.
              This will be removed in future.
    N)locale	setlocaleError)ro   rp   s     r   rs   rs      sD    5)))))<   s    ,,
locale_dirc                     	 t          j        t           j                  \  }}n# t          $ r d}Y nw xY wt	          | g||d          S )z>Initialize locale for console.

    .. versionadded:: 1.8
    Nconsole)rr   	getlocaleLC_MESSAGESAttributeErrorrn   )ru   r_   r^   rb   s       r   init_consoler{      s^    
&v'9::!!     h;;;s   !$ 33c                      t           || f         S r   rZ   r_   r`   s     r   get_translatorr      s    	7+,,r   c                     || ft           v S r   r}   r~   s     r   is_translator_registeredr      s    w;..r   messagec                 L    t          | |          }|                    |          S )zcUsed instead of _ when creating TranslationProxy, because _ is
    not bound yet at that time.
    )r   rg   )r_   r`   r   rj   s       r   _lazy_translater      s'      33Jg&&&r   c                 B     dt           dt          dt           f fd}|S )aA  Get a translation function based on the *catalog* and *namespace*.

    The extension can use this API to translate the messages on the
    extension::

        import os
        from sphinx.locale import get_translation

        MESSAGE_CATALOG_NAME = 'myextension'  # name of *.pot, *.po and *.mo files
        _ = get_translation(MESSAGE_CATALOG_NAME)
        text = _('Hello Sphinx!')


        def setup(app):
            package_dir = os.path.abspath(os.path.dirname(__file__))
            locale_dir = os.path.join(package_dir, 'locales')
            app.add_message_catalog(MESSAGE_CATALOG_NAME, locale_dir)

    With this code, sphinx searches a message catalog from
    ``${package_dir}/locales/${language}/LC_MESSAGES/myextension.mo``.
    The :confval:`language` is used for the searching.

    .. versionadded:: 1.8
    r   r   r   c                    t                    st          t          |           S t                    }t	          |          dk    r|                    |           S |                    | |d         |d                   S )N   r   )r   r   r   r   lenrg   ngettext)r   r   rj   r_   r`   s      r   rg   z get_translation.<locals>.gettext   s    ';; 	F$_gy'RRR';;J4yyA~ F!))'222!**7DGT!WEEEr   )r   r   )r_   r`   rg   s   `` r   get_translationr      sM    2	F 	FS 	FS 	F 	F 	F 	F 	F 	F 	F Nr   rw   	AttentionCautionDangerrt   Hint	ImportantNotezSee alsoTipWarning)
	attentioncautiondangererrorhint	importantnoteseealsotipwarningversionlabelspairindextypes)r[   r\   r   )r\   )"rV   rg   rr   collectionsr   r   r   typingr   r   r   r	   r
   r   r   r   r   rZ   r   __annotations__boolrn   intrs   r{   r   r   r   r   rb   __admonitionlabelsr   r   rK   r   r   <module>r      sP        / / / / / / / / $ $ $ $ $ $ N N N N N N N N N N N N N N N N N N N NU; U; U; U; U;
 U; U; U;p 8C{CS7T7TT%S/#334 T T T 4='' ''d8C=) ''Xc] ''''-0''AFGWY]G]A^'' '' '' ''T  E#x}*<$=     (<S <3 <59I49O3P < < < <- -C -s -K[ - - - -/ /c / /UY / / / /'S 'S '3 '3 ' ' ' '$ $S $S $ $ $ $ $T OH _Xy))
 ;9876;6:59   !#tCH~ " " " "$S#X # # # # #r   