U
    PN^H                     @   s:   d dl Z d dlmZ d dlmZ i ZG dd dejZdS )    N)form)get_translationsc                       s,   e Zd ZdZdZ fddZdd Z  ZS )Forma  
    Base form for a simple localized WTForms form.

    **NOTE** this class is now un-necessary as the i18n features have
    been moved into the core of WTForms, and will be removed in WTForms 3.0.

    This will use the stdlib gettext library to retrieve an appropriate
    translations object for the language, by default using the locale
    information from the environment.

    If the LANGUAGES class variable is overridden and set to a sequence of
    strings, this will be a list of languages by priority to use instead, e.g::

        LANGUAGES = ['en_GB', 'en']

    One can also provide the languages by passing `LANGUAGES=` to the
    constructor of the form.

    Translations objects are cached to prevent having to get a new one for the
    same languages every instantiation.
    Nc                    s:   t jdtdd d|kr$|d| _tt| j|| d S )NzDi18n is now in core, wtforms.ext.i18n will be removed in WTForms 3.0   )
stacklevel	LANGUAGES)warningswarnDeprecationWarningpopr   superr   __init__)selfargskwargs	__class__ :/tmp/pip-install-o1yuzyg2/WTForms/wtforms/ext/i18n/form.pyr       s     zForm.__init__c                 C   s8   | j rt| j n
| jjpd }|tkr0t|t|< t| S )N)r   tuplemetaZlocalestranslations_cacher   )r   	languagesr   r   r   _get_translations)   s    zForm._get_translations)__name__
__module____qualname____doc__r   r   r   __classcell__r   r   r   r   r      s   	r   )r   Zwtformsr   Zwtforms.ext.i18n.utilsr   r   r   r   r   r   r   <module>   s   