Edit File: locale.cpython-311.pyc
� ������Fh�����������������������������d�Z�ddlZddlZddlmZmZ�ddlmZ�ddl m Z �dai�a�e t����������g������������adad��Zd ��Zd ��Z�G�d��de������������Zed k����rddlZ�ej�����������������������dS�dS�)aO�� Internationalisation using Babel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The locale support of tornado as such is pretty basic and does not offer support for merging translation catalogs and several other features most multi language applications require. This module tries to retain the same API as that of tornado.locale while implement the required features with the support of babel. .. note:: CSV Translations are not supported :copyright: (c) 2012 by Openlabs Technologies & Consulting (P) Limited :copyright: (c) 2009 by Facebook (Tornado Project) :license: BSD, see LICENSE for more details. :changes: 12/11/23 - E. PASCUAL (Centre Scientifique et Technique du Batiment): fixed implementation of translations merge process in load_gettext_translations �����N)�Translations�NullTranslations)�Locale)�dates�en_USFc������������������������t����������j��������|���S�)a���Returns the closest match for the given locale codes. We iterate over all given locale codes in order. If we have a tight or a loose match for the code (e.g., "en" for "en_US"), we return the locale. Otherwise we move to the next code in the list. By default we return en_US if no translations are found for any of the specified locales. You can change the default locale with set_default_locale() below. )r����get_closest)�locale_codess��� �t/builddir/build/BUILD/imunify360-venv-2.5.3/opt/imunify360/venv/lib/python3.11/site-packages/aiohttp_babel/locale.py�getr���&���s���������|�,�,�����c�����������������������|�a�t����������t����������t���������������������������������������������������������t�����������gz���������������adS�)aU��Sets the default locale, used in get_closest_locale(). The default locale is assumed to be the language used for all strings in the system. The translations loaded from disk are mappings from the default locale to the destination locale. Consequently, you don't need to create a translation file for the default locale. N)�_default_locale� frozenset�list� _translations�keys�_supported_locales)�codes��� r����set_default_localer���4���s>��������O�"��]� � � !� !�"�"�o�%6�6�8��8���r ���c����������� �����������t����������j��������|�������������D�]�}|���������������������d������������r�t�����������j�����������������������������t�����������j�����������������������������|�|������������������������r�V �t ����������j��������|�|g|������������}|t����������v�r!t����������|���������� ��������������������|�������������n |t����������|<�����#�t����������$�r-}t����������j��������d|t����������|�������������������������Y�d}~��d}~ww�xY�wt����������t����������t���������������������������������������������������������t"����������gz���������������adat����������j��������dt+����������t$�����������������������������������dS�)z-Loads translations from gettext's locale tree�.z$Cannot load translation for '%s': %sNTzSupported locales: %s)�os�listdir� startswith�path�isfile�joinr����loadr����merge� Exception�logging�error�strr���r���r���r���r����_use_gettext�info�sorted)� directory�domain�lang�translation�es��� r����load_gettext_translationsr-���C���sG����� �� �9�%�%�������?�?�3���� �� �7�>�>�"�'�,�,�y�$�7�7�8�8�� �� �&�+�I��v�v�F�F�K��}�$�$��d�#�)�)�+�6�6�6�6�&1� �d�#����� �� �� ��M�@�$��A���O�O�O��H�H�H�H����� �����#��]� � � !� !�"�"�o�%6�6�8��8���L��L�(�&�1C�*D�*D�E�E�E�E�Es����,AB8�8 C/�#C*�*C/c��������������������j�����e�Zd�ZdZed����������������Zed����������������Zd d�Zdd�Zdd�Z dd �Z � �dd�ZdS�)r���z�Object representing a locale. After calling one of `load_translations` or `load_gettext_translations`, call `get` or `get_closest` to get a Locale object. c������������������>����|D��]�}|s�|����������������������dd������������}|���������������������d������������}t����������|������������dk����r�Et����������|������������dk����r8|d��������������������������������������������dz���|d��������������������������������������������z���}|t ����������v�r|����������������������|������������c�S�|d��������������������������������������������t ����������v�r/|����������������������|d��������������������������������������������������������c�S���|����������������������t����������������������S�)z4Returns the closest match for the given locale code.�-�_����r�������)�replace�split�len�lower�upperr���r���r���)�clsr ���r����partss��� r���r ���zLocale.get_closestd���s������!�� 1�� 1�D��� ���<�<��S�)�)�D��J�J�s�O�O�E��5�z�z�A�~�~���U���q����Q�x�~�~�'�'�#�-��a����0@�0@�@���)�)�)��w�w�t�}�}�$�$�$��Q�x�~�~���#5�5�5��w�w�u�Q�x�~�~�/�/�0�0�0�0�0��6��w�w��'�'�'r ���c����������������������t����������|�d������������si�|�_��������||�j��������vrX|t����������v�sJ��t�������������������������������|t������������������������������������}|����������������������|������������}||_��������||�j��������|<���|�j��������|���������S�)znReturns the Locale for the given locale code. If it is not supported, we raise an exception. �_cache)�hasattrr<���r���r���r���r����parse�translations)r9���r���r?����locales��� r���r���z Locale.getv���s���������s�H�%�%�� ��C�J��s�z�!�!��-�-�-�-�-�(�,�,�T�3C�3E�3E�F�F�L��Y�Y�t�_�_�F�".�F��%�C�J�t���z�$��r ���Nc�����������������������|�!|�J��|�j������������������������������|||������������}n|�j������������������������������|������������}t����������|������������r �|j��������di�|��n|S�)a`�� Translates message and returns new message as str :param str message: original message :param str plural_message: plural format of the message :param int count: number proper plural message for generation :param kwargs: named placeholders for message templating :return str: translated message N��)r?���� ungettext�ugettextr6����format)�self�message�plural_message�count�kwargss��� r���� translatezLocale.translate����sw��������%��$�$�$��'�1�1����0��0�G�G���'�0�0��9�9�G�+.�v�;�;�C�~�w�~�'�'��'�'�'�G�Cr ����mediumc������������������0�����t����������j��������||||�������������S�)ar�� Return a date formatted according to the given pattern. :param datetime: the datetime object; if None, the current date and time is used :param format: one of "full", "long", "medium", or "short", or a custom date/time pattern :param tzinfo: the timezone to apply to the time for display >>> from datetime import datetime >>> locale = Locale.parse('pt_BR') >>> locale <Locale "pt_BR"> >>> dt = datetime(2007, 04, 01, 15, 30) >>> locale.format_datetime(dt) u'01/04/2007 15:30:00' )r����format_datetime)rF����datetimerE����tzinfos��� r���rN���zLocale.format_datetime����s������$��$�X�v�v�t�D�D�Dr ���c������������������.�����t����������j��������|||�������������S�)a%�� Return a date formatted according to the locale. :param date: the date or datetime object; if None, the current date is used :param format: one of "full", "long", "medium", or "short", or a custom date/time pattern )r����format_date)rF����daterE���s��� r���rR���zLocale.format_date����s�������� ��v�t�4�4�4r ���c������������������0�����t����������j��������||||�������������S�)ar�� Return a time formatted according to the locale. :param time: the time or datetime object; if None, the current time in UTC is used :param format: one of "full", "long", "medium", or "short", or a custom date/time pattern :param tzinfo: the time-zone to apply to the time for display )r����format_time)rF����timerE���rP���s��� r���rU���zLocale.format_time����s�������� ��v�v�t�<�<�<r ����second�333333�?c������������������0�����t����������j��������||||�������������S�)am�� Return a time delta according to the rules of the given locale. :param delta: a timedelta object representing the time difference to format, or the delta in seconds as an int value :param granularity: determines the smallest unit that should be displayed, the value can be one of "year", "month", "week", "day", "hour", "minute" or "second" :param threshold: factor that determines at which point the presentation switches to the next higher unit )r����format_timedelta)rF����delta�granularity� thresholds��� r���rZ���zLocale.format_timedelta����s��������%�e�[�)�T�J�J�Jr ���)NN)NrL���N)NrL���)rW���rX���)�__name__� __module__�__qualname__�__doc__�classmethodr ���r���rK���rN���rR���rU���rZ���rB���r ���r���r���r���]���s������������������ ��(��(���[�(�"�� �� ���[� �D��D��D��D�&E��E��E��E�( 5�� 5�� 5�� 5� =�� =�� =�� =��3;�#6�K��K��K��K��K��Kr ���r����__main__)ra���r"���r���� babel.supportr���r���� babel.corer����BabelCoreLocale�babelr���r���r���r���r���r%���r���r���r-���r^����doctest�testmodrB���r ���r����<module>rj������s �������.������ � � � ��8��8��8��8��8��8��8��8��0��0��0��0��0��0���������������� ��Y��0�1�1�����-��-��-�8��8��8�F��F��F�4uK��uK��uK��uK��uK�_��uK��uK��uK�p��z����N�N�N��G�O��������r ���