o
    ȕh&                     @  s   U d Z ddlmZ ddlZddlmZ dZerddlZddl	Z	g dZ
de iZded< e Zd	d
d	d	d
dZdd	ddddZd3ddZd4ddZ	d5d6ddZd7ddZd8dd Zd9d"d#Zd:d'd(Zd8d)d*Zd;d-d.Zd<d/d0Zd<d1d2ZdS )=z*Activate, get and deactivate translations.    )annotationsN)localF)activate
deactivatedecimal_separatorthousands_separatorz1dict[str | None, gettext_module.NullTranslations]_TRANSLATIONS. )de_DEfr_FRit_ITpt_BRhu_HU,returnpathlib.Path | Nonec                  C  sZ   t ot j} | s	d S dd l}|j|j| }|d W  d    S 1 s&w   Y  d S )Nr   locale)__spec__parentimportlib.resources	resourcesas_filefiles)package	importlibpkg r   J/var/www/Befach/backend/venv/lib/python3.10/site-packages/humanize/i18n.py_get_default_locale_path(   s   
$r   gettext_module.NullTranslationsc                	   C  s,   zt tj W S  ttfy   t d   Y S w N)r   _CURRENTr   AttributeErrorKeyErrorr   r   r   r   get_translation3   s
   r%   r   
str | Nonepathstr | os.PathLike[str] | Nonec                 C  sp   | du s	|  drdt_td S |du rt }|du r!d}t|| tvr1td|| g}|t| < | t_t|  S )a  Activate internationalisation.

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

    Args:
        locale (str | None): Language name, e.g. `en_GB`. If `None`, defaults to no
            transaltion. Similar to calling ``deactivate()``.
        path (str | pathlib.Path): Path to search for locales.

    Returns:
        dict: Translations.

    Raises:
        Exception: If humanize cannot find the locale folder.
    NenznHumanize cannot determinate the default location of the 'locale' folder. You need to pass the path explicitly.humanize)
startswithr"   r   r   r   	Exceptiongettext_moduletranslation)r   r'   msgr.   r   r   r   r   :   s   r   Nonec                   C  s
   dt _dS )z Deactivate internationalisation.N)r"   r   r   r   r   r   r   `   s   
r   messagestrc                 C  s   t  | S )zvGet translation.

    Args:
        message (str): Text to translate.

    Returns:
        str: Translated text.
    )r%   gettextr1   r   r   r   _gettexte   s   	r5   msgctxtc                 C  s   t  | |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.
    )r%   pgettext)r6   r1   r   r   r   	_pgettextq   s   r8   pluralnumintc                 C  s   t  | ||S )a6  Plural version of _gettext.

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

    Returns:
        str: Translated text.
    )r%   ngettext)r1   r9   r:   r   r   r   	_ngettext   s   r=   c                 C  s   | S )aa  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   r4   r   r   r   _gettext_noop   s   r>   singulartuple[str, str]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   )r?   r9   r   r   r   _ngettext_noop   s   rA   c               	   C  .   zt tj } W | S  ttfy   d} Y | S w )ztReturn the thousands separator for a locale, default to comma.

    Returns:
         str: Thousands separator.
    r   )_THOUSANDS_SEPARATORr"   r   r#   r$   sepr   r   r   r         r   c               	   C  rB   )znReturn the decimal separator for a locale, default to dot.

    Returns:
         str: Decimal separator.
    r	   )_DECIMAL_SEPARATORr"   r   r#   r$   rD   r   r   r   r      rF   r   )r   r   )r   r    r!   )r   r&   r'   r(   r   r    )r   r0   )r1   r2   r   r2   )r6   r2   r1   r2   r   r2   )r1   r2   r9   r2   r:   r;   r   r2   )r?   r2   r9   r2   r   r@   )r   r2   )__doc__
__future__r   r3   r-   	threadingr   TYPE_CHECKINGospathlib__all__NullTranslationsr   __annotations__r"   rC   rG   r   r%   r   r   r5   r8   r=   r>   rA   r   r   r   r   r   r   <module>   sH    

	

&





