Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/oslo_i18n/__pycache__/_message.cpython-39.pyc
Ðазад
a n�h% � @ sn d Z ddlZddlZddlZddlZddlZddlZddlmZ ddlm Z dZ e�e�Z G dd� de�ZdS )z4Private Message class for lazy translation support. � N)�_locale)� _translate�c sj e Zd ZdZd� fdd� Zddd�Zedd d ��Zdd� Zd d� Z dd� Z dd� Zdd� Zdd� Z � ZS )�Messagez�A Message object is a unicode object that can be translated. Translation of Message is done explicitly using the translate() method. For all non-translation intents and purposes, a Message is simply unicode, and can be treated as such. N�osloFc s@ |st �||�}t� �| |�}||_||_||_||_||_|S )a& Create a new Message object. In order for translation to work gettext requires a message ID, this msgid will be used as the base unicode text. It is also possible for the msgid and the base unicode text to be different by passing the msgtext parameter. ) r �_translate_msgid�super�__new__�msgid�domain�params�has_contextual_form�has_plural_form) �clsr �msgtextr r r r �args�msg�� __class__� ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/oslo_i18n/_message.pyr , s zMessage.__new__c C sB t �| j| j|| j| j�}| jdu r(|S t�| j|�}| � ||�S )aQ Translate this message to the desired locale. :param desired_locale: The desired locale to translate the message to, if no locale is provided the message will be translated to the system's default locale. :returns: the translated message in unicode N) r r r r r r r r Ztranslate_args�_safe_translate)�self�desired_locale�translated_message�translated_paramsr r r �translationE s � �zMessage.translationc C s� |s*t �t j�}|r|d s"d}n|d }tj�t�|��}tj |||gdd�}|sh|sh|j}|| �} nh|rz|rzt d��nV|r�| \} }|j}d�| t|�}||�} t| v r�|} n |r�| \} }}|j }|| ||�} | S )Nr �en_UST)� localedir� languages�fallbackzUnimplemented.z{}{}{})�locale� getlocale�LC_CTYPE�os�environ�getr Zget_locale_dir_variable_name�gettextr � ValueError�format�CONTEXT_SEPARATOR�ngettext)r r r r r Z system_localeZ locale_dir�langZ translatorr ZmsgctxZmsgtxtZmsg_with_ctxZ msgsingleZ msgplural�msgcountr r r r a s<