
    ce                         d gZ ddZddZy)	translateNc                     ddl m} | }t        ||j                        st	        |       }t        ||j                        r|j                  |      S | S )a
  Gets the translated unicode representation of the given object.

    If the object is not translatable it is returned as-is.

    If the desired_locale argument is None the object is translated to
    the system locale.

    :param obj: the object to translate
    :param desired_locale: the locale to translate the message to, if None the
                           default system locale will be used
    :returns: the translated object in unicode, or the original object if
              it could not be translated

        )_message)	oslo_i18nr   
isinstanceMessagestrtranslation)objdesired_localer   messages       6/usr/lib/python3/dist-packages/oslo_i18n/_translate.pyr   r      sO     #Ggx//0 c('8++, "">22J    c                     t        | t              rt        fd| D              S t        | t              r$t        fd| j                         D              }|S t	        |       S )a  Translates all the translatable elements of the given arguments object.

    This method is used for translating the translatable values in method
    arguments which include values of tuples or dictionaries.
    If the object is not a tuple or a dictionary the object itself is
    translated if it is translatable.

    If the locale is None the object is translated to the system locale.

    :param args: the args to translate
    :param desired_locale: the locale to translate the args to, if None the
                           default system locale will be used
    :returns: a new args object with the translated contents of the original
    c              3   6   K   | ]  }t        |        y wNr   ).0vr   s     r   	<genexpr>z!translate_args.<locals>.<genexpr>B   s     @aYq.1@s   c              3   @   K   | ]  \  }}|t        |      f  y wr   r   )r   keyvaluer   s      r   r   z!translate_args.<locals>.<genexpr>D   s)      ?#-3 !$Yun%EF ?s   )r   tupledictitemsr   )argsr   translated_dicts    ` r   translate_argsr   2   sZ     $@4@@@$ ?15? ?T>**r   r   )__all__r   r    r   r   <module>r"      s   $ 
8+r   