Fetching contributors…
Cannot retrieve contributors at this time
45 lines (31 sloc) 1.46 KB


Deform is fully internationalizable and localizable. :term:`gettext` .mo files exist in the :mod:`deform` and :mod:`colander` packages which contain (currently incomplete) translations to various languages for the purpose of rendering localized error messages.

Following should get you started with i18n in :mod:`pyramid`:

import deform

from pkg_resources import resource_filename
from pyramid.i18n import get_localizer
from pyramid.threadlocal import get_current_request

def main(global_config, **settings):
    config = Configurator(settings=settings)

    def translator(term):
        return get_localizer(get_current_request()).translate(term)

    deform_template_dir = resource_filename('deform', 'templates/')
    zpt_renderer = deform.ZPTRendererFactory(

See the Internationalization demo for an example of how deform error and status messages can be localized. This demonstration uses the internationalization and localization features of Pyramid to render Deform error messages into :term:`Chameleon` form renderings.