.. Internationalization
国際化
====================
.. 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.
Deform は完全な国際化およびローカライズが可能です。 deform と colander の
パッケージには、ローカライズされたエラーメッセージをレンダリングするために
様々な言語への翻訳 (現在は不完全) を含む :term:`gettext` ``.mo`` ファイル
が存在します。
.. Following should get you started with `i18n` in :mod:`pyramid`:
下記を見れば :mod:`pyramid` で `i18n` を始めることができるでしょう:
::
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)
config.add_translation_dirs(
'colander:locale',
'deform:locale',
)
def translator(term):
return get_localizer(get_current_request()).translate(term)
deform_template_dir = resource_filename('deform', 'templates/')
zpt_renderer = deform.ZPTRendererFactory(
[deform_template_dir],
translator=translator)
deform.Form.set_default_renderer(zpt_renderer)
.. 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.
deform がエラーメッセージとステータスメッセージをどのように
ローカライズすることができるかの例については
`国際化デモ `_ を参照してください。
このデモンストレーションは、 Deform のエラーメッセージを Chameleon
フォームレンダリングに含めるために `Pyramid の国際化とローカライズ機能
`_
を使用します。