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

All Samples(21)  |  Call(21)  |  Derive(0)  |  Import(0)
Find the best match between available and requested locale strings.

>>> Locale.negotiate(['de_DE', 'en_US'], ['de_DE', 'de_AT'])
Locale('de', territory='DE')
>>> Locale.negotiate(['de_DE', 'en_US'], ['en', 'de'])
Locale('de')
>>> Locale.negotiate(['de_DE', 'de'], ['en_US'])

You can specify the character used in the locale identifiers to separate
the differnet components. This separator is applied to both lists. Also,(more...)

src/a/d/adhocracy-HEAD/src/adhocracy/i18n/__init__.py   adhocracy(Download)
 
    if locale is None:
        locale = Locale.parse(Locale.negotiate(fallbacks, LOCALE_STRINGS_DASH,
                                               sep='-',
                                               aliases=A2_LOCALE_ALIASES)) \

src/a/l/AllSpeak-0.5.1/allspeak/__init__.py   AllSpeak(Download)
            if preferred:
                # To ensure a consistent matching, Babel algorithm is used.
                locale = Locale.negotiate(preferred,
                                          self.available_languages,
                                          sep='-')

src/g/a/gae-boilerplate-HEAD/bp_includes/lib/i18n.py   gae-boilerplate(Download)
        return None
    pairs_sorted_by_q = sorted(parsed.items(), key=lambda (lang, q): q, reverse=True)
    locale = Locale.negotiate([lang for (lang, q) in pairs_sorted_by_q], request.app.config.get('locales'), sep='_')
    return str(locale)
 
                    # 5. detect locale from IP address location
                    territory = get_country_code(request) or 'ZZ'
                    locale = str(Locale.negotiate(territory, locales))
                    if locale not in locales:
                        # 6. use default locale

src/b/o/bomfu-HEAD/boilerplate/lib/i18n.py   bomfu(Download)
        return None
    locale_list_sorted_by_q = sorted(parsed.iterkeys(), reverse=True)
    locale = Locale.negotiate(locale_list_sorted_by_q, request.app.config.get('locales'), sep='_')
    return str(locale)
 
                    # 5. detect locale from IP address location
                    territory = get_territory_from_ip(cls) or 'ZZ'
                    locale = str(Locale.negotiate(territory, locales))
                    if locale not in locales:
                        # 6. use default locale

src/l/i/livepythonconsole-app-engine-HEAD/boilerplate/lib/i18n.py   livepythonconsole-app-engine(Download)
        return None
    locale_list_sorted_by_q = sorted(parsed.iterkeys(), reverse=True)
    locale = Locale.negotiate(locale_list_sorted_by_q, request.app.config.get('locales'), sep='_')
    return str(locale)
 
                    # 5. detect locale from IP address location
                    territory = get_territory_from_ip(cls) or 'ZZ'
                    locale = str(Locale.negotiate(territory, locales))
                    if locale not in locales:
                        # 6. use default locale

src/s/t/stackgeek-gaeb-HEAD/lib/i18n.py   stackgeek-gaeb(Download)
        return None
    locale_list_sorted_by_q = sorted(parsed.iterkeys(), reverse=True)
    locale = Locale.negotiate(locale_list_sorted_by_q, config.locales, sep='_')
    return str(locale)
 
                    # 5. detect locale from IP address location
                    territory = get_territory_from_ip(cls) or 'ZZ'
                    locale = str(Locale.negotiate(territory, config.locales))
                    if locale not in config.locales:
                        # 6. use default locale

src/a/d/adhocracy-2.4.1/src/adhocracy/publixphere_theme/i18n/__init__.py   adhocracy(Download)
    if locale is None:
        locales = map(str, LOCALES)
        locale = Locale.parse(Locale.negotiate(fallbacks, locales)) \
            or get_default_locale()
 

src/a/d/adhocracy-2.4.1/parts/omelette/adhocracy/i18n/__init__.py   adhocracy(Download)
 
    if locale is None:
        locale = Locale.parse(Locale.negotiate(fallbacks, LOCALE_STRINGS)) \
            or get_default_locale()
 

src/a/d/adhocracy-2.4.1/src/adhocracy/i18n/__init__.py   adhocracy(Download)
 
    if locale is None:
        locale = Locale.parse(Locale.negotiate(fallbacks, LOCALE_STRINGS)) \
            or get_default_locale()
 

src/a/d/adhocracy-2.4.1/installed_eggs/adhocracy/i18n/__init__.py   adhocracy(Download)
 
    if locale is None:
        locale = Locale.parse(Locale.negotiate(fallbacks, LOCALE_STRINGS)) \
            or get_default_locale()
 

  1 | 2  Next