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/b/a/BabelDjango-0.2.2/babeldjango/middleware.py   BabelDjango(Download)
    def process_request(self, request):
        try:
            code = getattr(request, 'LANGUAGE_CODE', settings.LANGUAGE_CODE)
            locale = Locale.parse(code, sep='-')
        except (ValueError, UnknownLocaleError):

src/d/j/django-babel-HEAD/babeldjango/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):

src/o/p/openspending-HEAD/openspending/ui/i18n/__init__.py   openspending(Download)
def get_default_locale():
    from pylons import config
    return Locale.parse(config.get('lang')) or \
        Locale.parse('en')
 
    tmpl_context.language = locale = None
    if 'locale' in session:
        locale = Locale.parse(session.get('locale'))
    else:
        requested = [l.replace('-', '_') for l in request.languages]
        locale = Locale.parse(
            Locale.negotiate(

src/o/p/openspending.etl-HEAD/etl/ui/i18n/__init__.py   openspending.etl(Download)
def get_default_locale():
    from pylons import config
    return Locale.parse(config.get('lang')) or \
            Locale.parse('en')
 
    tmpl_context.language = locale = None
    if 'locale' in session:
        locale = Locale.parse(session.get('locale'))
    else:
        requested = [l.replace('-', '_') for l in request.languages]
        locale = Locale.parse(Locale.negotiate(_KNOWN_LOCALES, requested))

src/a/d/adhocracy-2.4.1/src/adhocracy/publixphere_theme/i18n/__init__.py   adhocracy(Download)
            return c.instance.locale
        locale = config.get('adhocracy.language', 'en_US')
        return babel.Locale.parse(locale)
    except TypeError:
        return babel.Locale.parse('en_US')
    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)
            return c.instance.locale
        locale = config.get('adhocracy.language')
        return babel.Locale.parse(locale)
    except TypeError:
        return babel.Locale.parse('en_US')
 
    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)
            return c.instance.locale
        locale = config.get('adhocracy.language')
        return babel.Locale.parse(locale)
    except TypeError:
        return babel.Locale.parse('en_US')
 
    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)
            return c.instance.locale
        locale = config.get('adhocracy.language')
        return babel.Locale.parse(locale)
    except TypeError:
        return babel.Locale.parse('en_US')
 
    if locale is None:
        locale = Locale.parse(Locale.negotiate(fallbacks, LOCALE_STRINGS)) \
            or get_default_locale()
 

src/p/o/PO-Projects-0.3.5.1/po_projects/management/commands/popo.py   PO-Projects(Download)
    def locale_tuple(self):
        """
        Testing locale identifier parsing attributes
        """
        l = Locale.parse('en-AU')
    def check_locale(self):
        """
        Testing locale identifier parsing with error
        """
        print Locale.parse('fr')
        try:
            print Locale.parse('francais')
        except UnknownLocaleError:
            print 'UnknownLocaleError!'
        print Locale.parse('zh_CN')
        print Locale.parse('en_AU')
 

src/a/d/adhocracy-HEAD/src/adhocracy/i18n/__init__.py   adhocracy(Download)
            return c.instance.locale
        locale = config.get('adhocracy.language')
        return babel.Locale.parse(locale)
    except TypeError:
        return babel.Locale.parse('en_US')
 
    if locale is None:
        locale = Locale.parse(Locale.negotiate(fallbacks, LOCALE_STRINGS_DASH,
                                               sep='-',
                                               aliases=A2_LOCALE_ALIASES)) \

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