Did I find the right examples for you? yes no Crawl my project Python Jobs
All Samples(8) | Call(8) | Derive(0) | Import(0)
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
raise e if babel.default_locale('LC_NUMERIC') in ('c', 'C', '', None): import os os.environ['LANG'] = 'en_US' os.environ['LC_NUMERIC'] = 'en_US' reload(babel) if babel.default_locale('LC_TIME') in ('c', 'C', '', None):
src/s/q/sqlkit-0.9.6/sqlkit/fields.py sqlkit(Download)
def __init__(self, *args, **kw): Field.__init__(self, *args, **kw) self.format = "#,###" self.locale = babel.default_locale('LC_NUMERIC')
def __init__(self, *args, **kw): Field.__init__(self, *args, **kw) #self.format = "#.###,000" self.format = None self.locale = babel.default_locale('LC_NUMERIC')
self.format = "#,###.%s" % ('0' * self.scale) self.format_f = "%%.%sf" % self.scale self.locale = babel.default_locale('LC_NUMERIC') def clean_value(self, value, obj=None):
def __init__(self, *args, **kw): Field.__init__(self, *args, **kw) self.format = 'short' self.locale = babel.default_locale('LC_TIME') #if format not in ('short', 'long', 'default', 'medium', 'full'):
src/m/o/money-1.2.0/src-py2/money/money.py money(Download)
if BABEL_AVAILABLE: if not locale: locale = babel.default_locale('LC_NUMERIC') locale = babel.Locale.parse(locale) if not pattern:
src/m/o/money-HEAD/src-py2/money/money.py money(Download)
if BABEL_AVAILABLE: if not locale: locale = babel.default_locale('LC_NUMERIC') locale = babel.Locale.parse(locale) if not pattern: