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
"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

        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/f/j/fjord-HEAD/vendor/packages/Babel/babel/dates.py   fjord(Download)
from bisect import bisect_right
 
from babel.core import default_locale, get_global, Locale
from babel.util import UTC, LOCALTZ
from babel._compat import string_types, integer_types, number_types
 
 
LC_TIME = default_locale('LC_TIME')

src/m/i/microblog-HEAD/flask/lib/python2.7/site-packages/babel/dates.py   microblog(Download)
from bisect import bisect_right
 
from babel.core import default_locale, get_global, Locale
from babel.util import UTC, LOCALTZ
from babel._compat import string_types, integer_types, number_types
 
 
LC_TIME = default_locale('LC_TIME')

src/z/e/ZenPacks.zenoss.OpenStack-HEAD/src/Babel-1.3/babel/dates.py   ZenPacks.zenoss.OpenStack(Download)
from bisect import bisect_right
 
from babel.core import default_locale, get_global, Locale
from babel.util import UTC, LOCALTZ
from babel._compat import string_types, integer_types, number_types
 
 
LC_TIME = default_locale('LC_TIME')

src/h/u/hue-HEAD/desktop/core/ext-py/Babel-0.9.6/babel/dates.py   hue(Download)
import re
 
from babel.core import default_locale, get_global, Locale
from babel.util import UTC
 
__all__ = ['format_date', 'format_datetime', 'format_time',
           'get_timezone_name', 'parse_date', 'parse_datetime', 'parse_time']
__docformat__ = 'restructuredtext en'
 
LC_TIME = default_locale('LC_TIME')

src/h/o/hortonworks-sandbox-HEAD/desktop/core/ext-py/Babel-0.9.6/babel/dates.py   hortonworks-sandbox(Download)
import re
 
from babel.core import default_locale, get_global, Locale
from babel.util import UTC
 
__all__ = ['format_date', 'format_datetime', 'format_time',
           'get_timezone_name', 'parse_date', 'parse_datetime', 'parse_time']
__docformat__ = 'restructuredtext en'
 
LC_TIME = default_locale('LC_TIME')

src/b/a/Babel-1.3/babel/dates.py   Babel(Download)
from bisect import bisect_right
 
from babel.core import default_locale, get_global, Locale
from babel.util import UTC, LOCALTZ
from babel._compat import string_types, integer_types, number_types
 
 
LC_TIME = default_locale('LC_TIME')

src/s/o/socorro-HEAD/webapp-django/vendor/lib/python/babel/dates.py   socorro(Download)
import re
 
from babel.core import default_locale, get_global, Locale
from babel.util import UTC
 
__all__ = ['format_date', 'format_datetime', 'format_time',
           'get_timezone_name', 'parse_date', 'parse_datetime', 'parse_time']
__docformat__ = 'restructuredtext en'
 
LC_TIME = default_locale('LC_TIME')

src/k/i/kitsune-HEAD/vendor/packages/Babel/babel/dates.py   kitsune(Download)
import re
 
from babel.core import default_locale, get_global, Locale
from babel.util import UTC
 
__all__ = ['format_date', 'format_datetime', 'format_time',
           'get_timezone_name', 'parse_date', 'parse_datetime', 'parse_time']
__docformat__ = 'restructuredtext en'
 
LC_TIME = default_locale('LC_TIME')

src/g/l/glow-HEAD/vendor/lib/python/babel/dates.py   glow(Download)
import re
 
from babel.core import default_locale, get_global, Locale
from babel.util import UTC
 
__all__ = ['format_date', 'format_datetime', 'format_time',
           'get_timezone_name', 'parse_date', 'parse_datetime', 'parse_time']
__docformat__ = 'restructuredtext en'
 
LC_TIME = default_locale('LC_TIME')

src/g/a/gae-boilerplate-HEAD/bp_includes/external/babel/dates.py   gae-boilerplate(Download)
import re
 
from babel.core import default_locale, get_global, Locale
from babel.util import UTC
 
__all__ = ['format_date', 'format_datetime', 'format_time',
           'get_timezone_name', 'parse_date', 'parse_datetime', 'parse_time']
__docformat__ = 'restructuredtext en'
 
LC_TIME = default_locale('LC_TIME')

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next