B
    ç¹`  ã               @   sL   d dl Z dd„ Zddd„Zdefdd„ZG dd	„ d	eƒZG d
d„ deƒZdS )é    Nc              C   s6   t j t¡} t j t j | ¡d¡}t j |¡s2d}|S )zJ
    Determine the path to the 'messages' directory as best possible.
    Úlocalez/usr/share/locale)ÚosÚpathÚabspathÚ__file__ÚjoinÚdirnameÚexists)Úmodule_pathZlocale_path© r   úT/home/kop/projects/devel/pgwui/test_venv/lib/python3.7/site-packages/wtforms/i18n.pyÚmessages_path   s
    r   c             C   s   ddl }| dtƒ | ¡S )a  
    Get a gettext.GNUTranslations object pointing at the
    included translation files.

    :param languages:
        A list of languages to try, in order. If omitted or None, then
        gettext will try to use locale information from the environment.
    r   NZwtforms)ÚgettextÚtranslationr   )Ú	languagesr   r   r   r   Úget_builtin_gnu_translations   s    	r   c             C   s"   || ƒ}t |dƒrt|ƒS |S dS )a  
    Get a WTForms translation object which wraps a low-level translations object.

    :param languages:
        A sequence of languages to try, in order.
    :param getter:
        A single-argument callable which returns a low-level translations object.
    ÚugettextN)ÚhasattrÚDefaultTranslations)r   ÚgetterÚtranslationsr   r   r   Úget_translations   s    	
r   c               @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	r   zf
    A WTForms translations object to wrap translations objects which use
    ugettext/ungettext.
    c             C   s
   || _ d S )N)r   )Úselfr   r   r   r   Ú__init__3   s    zDefaultTranslations.__init__c             C   s   | j  |¡S )N)r   r   )r   Ústringr   r   r   r   6   s    zDefaultTranslations.gettextc             C   s   | j  |||¡S )N)r   Z	ungettext)r   ÚsingularÚpluralÚnr   r   r   Úngettext9   s    zDefaultTranslations.ngettextN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   .   s   r   c               @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚDummyTranslationszº
    A translations object which simply returns unmodified strings.

    This is typically used when translations are disabled or if no valid
    translations provider can be found.
    c             C   s   |S )Nr   )r   r   r   r   r   r   D   s    zDummyTranslations.gettextc             C   s   |dkr|S |S )Né   r   )r   r   r   r   r   r   r   r   G   s    zDummyTranslations.ngettextN)r   r    r!   r"   r   r   r   r   r   r   r#   =   s   r#   )N)r   r   r   r   Úobjectr   r#   r   r   r   r   Ú<module>   s
   
