Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(193)  |  Call(97)  |  Derive(0)  |  Import(96)
Returns the system default locale for a given category, based on
environment variables.

>>> for name in ['LANGUAGE', 'LC_ALL', 'LC_CTYPE']:
...     os.environ[name] = ''
>>> os.environ['LANG'] = 'fr_FR.UTF-8'
>>> default_locale('LC_MESSAGES')
'fr_FR'

The "C" or "POSIX" pseudo-locales are treated as aliases for the(more...)

        def default_locale(category=None, aliases=LOCALE_ALIASES):
    """Returns the system default locale for a given category, based on
    environment variables.

    >>> for name in ['LANGUAGE', 'LC_ALL', 'LC_CTYPE']:
    ...     os.environ[name] = ''
    >>> os.environ['LANG'] = 'fr_FR.UTF-8'
    >>> default_locale('LC_MESSAGES')
    'fr_FR'

    The "C" or "POSIX" pseudo-locales are treated as aliases for the
    "en_US_POSIX" locale:

    >>> os.environ['LC_MESSAGES'] = 'POSIX'
    >>> default_locale('LC_MESSAGES')
    'en_US_POSIX'

    The following fallbacks to the variable are always considered:

    - ``LANGUAGE``
    - ``LC_ALL``
    - ``LC_CTYPE``
    - ``LANG``

    :param category: one of the ``LC_XXX`` environment variable names
    :param aliases: a dictionary of aliases for locale identifiers
    """
    varnames = (category, 'LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'LANG')
    for name in filter(None, varnames):
        locale = os.getenv(name)
        if locale:
            if name == 'LANGUAGE' and ':' in locale:
                # the LANGUAGE variable may contain a colon-separated list of
                # language codes; we just pick the language on the list
                locale = locale.split(':')[0]
            if locale in ('C', 'POSIX'):
                locale = 'en_US_POSIX'
            elif aliases and locale in aliases:
                locale = aliases[locale]
            try:
                return get_locale_identifier(parse_locale(locale))
            except ValueError:
                pass
        


src/l/i/livepythonconsole-app-engine-HEAD/boilerplate/external/babel/messages/plurals.py   livepythonconsole-app-engine(Download)
"""Plural form definitions."""
 
from babel.core import default_locale, Locale
from babel.util import itemgetter
 
 
LC_CTYPE = default_locale('LC_CTYPE')

src/g/l/glow-HEAD/vendor/lib/python/babel/numbers.py   glow(Download)
    have_decimal = False
 
from babel.core import default_locale, Locale
 
__all__ = ['format_number', 'format_decimal', 'format_currency',
           'format_percent', 'format_scientific', 'parse_number',
           'parse_decimal', 'NumberFormatError']
__docformat__ = 'restructuredtext en'
 
LC_NUMERIC = default_locale('LC_NUMERIC')

src/p/r/proofofexistence-HEAD/babel/messages/plurals.py   proofofexistence(Download)
"""
 
from babel.core import default_locale, Locale
from operator import itemgetter
 
 
# XXX: remove this file, duplication with babel.plural
 
 
LC_CTYPE = default_locale('LC_CTYPE')

src/k/u/kuma-lib-HEAD/packages/Babel/babel/messages/plurals.py   kuma-lib(Download)
 
from operator import itemgetter
from babel.core import default_locale, Locale
 
 
LC_CTYPE = default_locale('LC_CTYPE')

src/a/l/algae-HEAD/gae/libs/babel/messages/plurals.py   algae(Download)
"""Plural form definitions."""
 
from babel.core import default_locale, Locale
from babel.util import itemgetter
 
 
LC_CTYPE = default_locale('LC_CTYPE')

src/p/l/plexnet-HEAD/third_party/python/babel/messages/plurals.py   plexnet(Download)
"""Plural form definitions."""
 
from babel.core import default_locale, Locale
from babel.util import itemgetter
 
 
LC_CTYPE = default_locale('LC_CTYPE')

src/i/n/input-lib-HEAD/packages/Babel/babel/messages/plurals.py   input-lib(Download)
 
from operator import itemgetter
from babel.core import default_locale, Locale
 
 
LC_CTYPE = default_locale('LC_CTYPE')

src/g/a/gae-boilerplate-HEAD/bp_includes/external/babel/numbers.py   gae-boilerplate(Download)
    have_decimal = False
 
from babel.core import default_locale, Locale
from babel.util import rsplit
 
__docformat__ = 'restructuredtext en'
 
LC_NUMERIC = default_locale('LC_NUMERIC')
 
def get_currency_name(currency, locale=LC_NUMERIC):

src/w/e/WebPutty-HEAD/libs/babel/messages/plurals.py   WebPutty(Download)
"""Plural form definitions."""
 
from babel.core import default_locale, Locale
from babel.util import itemgetter
 
 
LC_CTYPE = default_locale('LC_CTYPE')

src/p/l/playdoh-lib-HEAD/lib/python/babel/messages/plurals.py   playdoh-lib(Download)
 
from operator import itemgetter
from babel.core import default_locale, Locale
 
 
LC_CTYPE = default_locale('LC_CTYPE')

Previous  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10  Next