509318396
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
U
    su]aø  ã                   @   s¤   d Z ddlZddlZddlmZ dddddgZde ¡ iZ	eƒ Z
d	d
iZd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d„ Zedœdd„ZdS )z*Activate, get and deactivate translations.é    N)ÚlocalÚactivateÚ
deactivateÚgettextÚngettextÚthousands_separatorÚfr_FRú c                   C   sB   z&t d krW d S tj tj t ¡d¡W S  tk
r<   Y d S X d S )NÚlocale)Ú__file__ÚosÚpathÚjoinÚdirnameÚ	NameError© r   r   ú>/opt/alt/python38/lib/python3.8/site-packages/humanize/i18n.pyÚ_get_default_locale_path   s    r   c                	   C   s2   zt tj W S  ttfk
r,   t d   Y S X d S )N)Ú_TRANSLATIONSÚ_CURRENTr
   ÚAttributeErrorÚKeyErrorr   r   r   r   Úget_translation   s    r   c                 C   sL   |dkrt ƒ }|dkrtdƒ‚| tkr>t d|| g¡}|t| < | t_t|  S )aR  Activate internationalisation.

    Set `locale` as current locale. Search for locale in directory `path`.

    Args:
        locale (str): Language name, e.g. `en_GB`.
        path (str): Path to search for locales.

    Returns:
        dict: Translations.

    Raises:
        Exception: If humanize cannot find the locale folder.
    NznHumanize cannot determinate the default location of the 'locale' folder. You need to pass the path explicitly.Zhumanize)r   Ú	Exceptionr   Úgettext_moduleÚtranslationr   r
   )r
   r   r   r   r   r   r   "   s    ÿc                   C   s
   dt _dS )z Deactivate internationalisation.N)r   r
   r   r   r   r   r   @   s    c                 C   s   t ƒ  | ¡S )zvGet translation.

    Args:
        message (str): Text to translate.

    Returns:
        str: Translated text.
    )r   r   ©Úmessager   r   r   r   E   s    	c                 C   sR   zt ƒ  | |¡W S  tk
rL   | d | }t ƒ  |¡}||krD|n| Y S X dS )a   Fetches a particular translation.

    It works with `msgctxt` .po modifiers and allows duplicate keys with different
    translations.

    Args:
        msgctxt (str): Context of the translation.
        message (str): Text to translate.

    Returns:
        str: Translated text.
    úN)r   Úpgettextr   r   )Zmsgctxtr   Úkeyr   r   r   r   r   Q   s    r   c                 C   s   t ƒ  | ||¡S )a5  Plural version of gettext.

    Args:
        message (str): Singular text to translate.
        plural (str): Plural text to translate.
        num (str): The number (e.g. item count) to determine translation for the
            respective grammatical number.

    Returns:
        str: Translated text.
    )r   r   )r   ÚpluralÚnumr   r   r   r   j   s    c                 C   s   | S )a^  Mark a string as a translation string without translating it.

    Example usage:
    ```python
    CONSTANTS = [gettext_noop('first'), gettext_noop('second')]
    def num_name(n):
        return gettext(CONSTANTS[n])
    ```

    Args:
        message (str): Text to translate in the future.

    Returns:
        str: Original text, unchanged.
    r   r   r   r   r   Úgettext_noopy   s    r#   c                 C   s   | |fS )aÉ  Mark two strings as pluralized translations without translating them.

    Example usage:
    ```python
    CONSTANTS = [ngettext_noop('first', 'firsts'), ngettext_noop('second', 'seconds')]
    def num_name(n):
        return ngettext(*CONSTANTS[n])
    ```

    Args:
        singular (str): Singular text to translate in the future.
        plural (str): Plural text to translate in the future.

    Returns:
        tuple: Original text, unchanged.
    r   )Zsingularr!   r   r   r   Úngettext_noopŒ   s    r$   )Úreturnc               	   C   s0   zt tj } W n ttfk
r*   d} Y nX | S )ztReturn the thousands separator for a locale, default to comma.

    Returns:
         str: Thousands separator.
    ú,)Ú_THOUSANDS_SEPARATORr   r
   r   r   )Úsepr   r   r   r       s
    
)N)Ú__doc__r   r   Úos.pathr   Ú	threadingr   Ú__all__ÚNullTranslationsr   r   r'   r   r   r   r   r   r   r#   r$   Ústrr   r   r   r   r   Ú<module>   s&    ÿ	
