o
    ßdTë  ã                   @   sŠ   d dl Zd dlmZ d dlZg d¢Zde ¡ iZeƒ Z	ej
 ej
 e¡d¡Zdd„ Zddd„Zd	d
„ Zdd„ Z dd„ Zdd„ Zdd„ ZdS )é    N)Úlocal)ÚactivateÚ
deactivateÚgettextÚngettextÚlocalec                	   C   s,   zt tj W S  ttfy   t d   Y S w ©N)Ú_TRANSLATIONSÚ_CURRENTr   ÚAttributeErrorÚKeyError© r   r   ú?/var/www/html/env/lib/python3.10/site-packages/humanize/i18n.pyÚget_translation   s
   ÿr   c                 C   s:   |du rt }| tvrt d|| g¡}|t| < | t_t|  S )zrSet 'locale' as current locale. Search for locale in directory 'path'
    @param locale: language name, eg 'en_GB'NÚhumanize)Ú_DEFAULT_LOCALE_PATHr	   Úgettext_moduleÚtranslationr
   r   )r   Úpathr   r   r   r   r      s   r   c                   C   s
   d t _d S r   )r
   r   r   r   r   r   r   !   s   
r   c                 C   s   t ƒ  | ¡S r   ©r   r   ©Úmessager   r   r   r   %   s   r   c                 C   s(   | d | }t ƒ  |¡}||kr|S |S )a  'Particular gettext' function.
    It works with 'msgctxt' .po modifiers and allow duplicate keys with
    different translations.
    Python 2 don't have support for this GNU gettext function, so we
    reimplement it. It works by joining msgctx and msgid by '4' byte.úr   )Úmsgctxtr   Úkeyr   r   r   r   Úpgettext)   s   r   c                 C   s   t ƒ  | ||¡S r   )r   r   )r   ÚpluralÚnumr   r   r   r   4   s   r   c                 C   s   | S )zˆExample usage:
    CONSTANTS = [gettext_noop('first'), gettext_noop('second')]
    def num_name(n):
        return gettext(CONSTANTS[n])r   r   r   r   r   Úgettext_noop8   s   r   r   )r   r   Ú	threadingr   Úos.pathÚosÚ__all__ÚNullTranslationsr	   r
   r   ÚjoinÚdirnameÚ__file__r   r   r   r   r   r   r   r   r   r   r   Ú<module>   s   
