File: //home/arjun/projects/env/lib/python3.10/site-packages/tornado/__pycache__/locale.cpython-310.pyc
o
we�R � @ s2 d Z ddlZddlZddlZddlZddlZddlZddlZddlm Z ddl
mZ ddlm
Z
ddlmZmZmZmZmZ dai aetg�adad Zd
eddfd
d�Zdeddfdd�Zd dedee ddfdd�Zdededdfdd�Zdee fdd�ZG dd� de �Z!G dd� de!�Z"G dd� de!�Z#dS )!a� Translation methods for generating localized strings.
To load a locale and generate a translated string::
user_locale = tornado.locale.get("es_LA")
print(user_locale.translate("Sign out"))
`tornado.locale.get()` returns the closest matching locale, not necessarily the
specific locale you requested. You can support pluralization with
additional arguments to `~Locale.translate()`, e.g.::
people = [...]
message = user_locale.translate(
"%(list)s is online", "%(list)s are online", len(people))
print(message % {"list": user_locale.list(people)})
The first string is chosen if ``len(people) == 1``, otherwise the second
string is chosen.
Applications should call one of `load_translations` (which uses a simple
CSV format) or `load_gettext_translations` (which uses the ``.mo`` format
supported by `gettext` and related tools). If neither method is called,
the `Locale.translate` method will simply return the original string.
� N)�escape)�gen_log)�LOCALE_NAMES)�Iterable�Any�Union�Dict�Optional�en_USF��locale_codes�return�Localec G s
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()`.
)r �get_closest)r � r �G/home/arjun/projects/env/lib/python3.10/site-packages/tornado/locale.py�get>