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

All Samples(258)  |  Call(258)  |  Derive(0)  |  Import(0)
Create a `Locale` instance for the given locale identifier.

>>> l = Locale.parse('de-DE', sep='-')
>>> l.display_name
u'Deutsch (Deutschland)'

If the `identifier` parameter is not a string, but actually a `Locale`
object, that object is returned:

>>> Locale.parse(l)(more...)

src/t/r/Tribus-0.1.dev20131207073801/tribus/common/setup/maint.py   Tribus(Download)
    def get_locale_list(self):
        django_locales = set([i[0].replace('_', '-').lower() for i in settings.LANGUAGES])
        babel_locales = set([j.replace('_', '-').lower() for j in locale_identifiers()])
        sphinx_locales = set([k.replace('_', '-').lower() for k in chm_locales.keys()])
        locales = [str(Locale.parse(identifier=l, sep='-')) for l in django_locales & babel_locales & sphinx_locales]

src/p/l/Plurk_Solace-0.1/solace/i18n/__init__.py   Plurk_Solace(Download)
    """
    try:
        key = str(Locale.parse(locale))
    except UnknownLocaleError:
        return None
    for locale, quality in choices:
        try:
            locale = Locale.parse(locale, sep='-')
        except UnknownLocaleError:
            continue
        if str(locale) in enabled and \
           find_catalog(locale) is not None:
            return locale
    return Locale.parse(settings.DEFAULT_LANGUAGE)
def load_translations(locale):
    """Return the translations for the locale."""
    locale = Locale.parse(locale)
    key = str(locale)
    rv = _translations.get(key)
    for locale in os.listdir(LOCALE_PATH):
        try:
            l = Locale.parse(locale)
        except (ValueError, UnknownLocaleError):
            continue

src/s/o/solace-HEAD/solace/i18n/__init__.py   solace(Download)
    """
    try:
        key = str(Locale.parse(locale))
    except UnknownLocaleError:
        return None
    for locale, quality in choices:
        try:
            locale = Locale.parse(locale, sep='-')
        except UnknownLocaleError:
            continue
        if str(locale) in enabled and \
           find_catalog(locale) is not None:
            return locale
    return Locale.parse(settings.DEFAULT_LANGUAGE)
def load_translations(locale):
    """Return the translations for the locale."""
    locale = Locale.parse(locale)
    key = str(locale)
    rv = _translations.get(key)
    for locale in os.listdir(LOCALE_PATH):
        try:
            l = Locale.parse(locale)
        except (ValueError, UnknownLocaleError):
            continue

src/a/l/AllSpeak-0.5.1/allspeak/__init__.py   AllSpeak(Download)
        if isinstance(locale, basestring):
            locale = locale.replace('_', '-')
            locale = Locale.parse(locale, sep='-')
        request.locale = locale
        return request.locale

src/k/a/KalaPy-0.4.2/kalapy/i18n/utils.py   KalaPy(Download)
    if locale is None:
        try:
            locale = Locale.parse(request.accept_languages.best, sep='-')
            request.babel_locale = locale
        except:
            locale = Locale.parse(settings.DEFAULT_LOCALE)

src/k/a/kalapy-HEAD/kalapy/i18n/utils.py   kalapy(Download)
    if locale is None:
        try:
            locale = Locale.parse(request.accept_languages.best, sep='-')
            request.babel_locale = locale
        except:
            locale = Locale.parse(settings.DEFAULT_LOCALE)

src/h/u/hue-HEAD/desktop/core/ext-py/BabelDjango-0.2.2/babeldjango/middleware.py   hue(Download)
    def process_request(self, request):
        try:
            code = getattr(request, 'LANGUAGE_CODE', settings.LANGUAGE_CODE)
            locale = Locale.parse(code, sep='-')
        except (ValueError, UnknownLocaleError):

src/h/o/hortonworks-sandbox-HEAD/desktop/core/ext-py/BabelDjango-0.2.2/babeldjango/middleware.py   hortonworks-sandbox(Download)
    def process_request(self, request):
        try:
            code = getattr(request, 'LANGUAGE_CODE', settings.LANGUAGE_CODE)
            locale = Locale.parse(code, sep='-')
        except (ValueError, UnknownLocaleError):

src/a/l/AllSpeak-0.5.1/allspeak/utils.py   AllSpeak(Download)
    if isinstance(locale, basestring):
        locale = locale.replace('_', '-')
        return Locale.parse(locale, sep='-')
    if isinstance(locale, tuple):
        return Locale(*locale)

src/d/j/django-babel-0.3.3/django_babel/middleware.py   django-babel(Download)
    def process_request(self, request):
        try:
            code = getattr(request, 'LANGUAGE_CODE', get_language())
            locale = Locale.parse(code, sep='-')
        except (ValueError, UnknownLocaleError):

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