request

Request related code.

pyramid_localize.request.locale_id(request)[source]

Return database id of a current locale name.

Returns:database id of a language code needed for translations
Return type:int
pyramid_localize.request.database_locales(request)[source]

Return all database locales available.

Returns:dictionary of Language objects language_code: Language
Return type:dict
pyramid_localize.request.locales(request, config=False)[source]

Return locales.

Parameters:config (bool) – Whether to restrict list with config
Returns:dictionary of Language objects language_code: Language
Return type:dict

LocalizeRequestMixin

class pyramid_localize.request.LocalizeRequestMixin[source]

Mixin adding overwriting Request methods.

default_locale(**kw)[source]

Set up default locale for path kwargs.

Can be used in custom route_url overwrites.

Parameters:kw (kwargs) – list of route parts
Returns:kw
route_url(route_name, *elements, **kw)[source]

Overwrite original route_url to handle default locale within route.