Translation of dropdown options doesn't work

22 views
Skip to first unread message

Denis Rykov

unread,
May 10, 2012, 7:50:12 AM5/10/12
to forma...@googlegroups.com
I develop pyramid application and use pyramid formalchemy   fa.jquery. The name of application is ng_ornito.

When I describe models I use TranslationStringFactory:

from pyramid.i18n import TranslationStringFactory
_ = TranslationStringFactory('ng_ornito')

class Bird(Base):
    __tablename__ = 'bird'
    __label__ = _(u"Вид")
    __plural__ = _(u"Виды")
    id = Column(Integer, primary_key=True, label=_(u"Номер записи"))
    name_lat = Column(Unicode, unique=True, label=_(u"Латинское название"))
    name_rus = Column(Unicode, label=_(u"Русское название"))
...

class Report(Base):
    __tablename__ = 'report'
    __label__ = _(u"Наблюдение")
    __plural__ = _(u"Наблюдения")
    id = Column(Integer, primary_key=True, label=_(u"Номер записи"))
...

This part works fine, After compilation *.po file when I change language - form's name and field's label is translated flawlessly.

Then I modify my faforms.py file:

from models import _
Report.append(Report.age_class.dropdown(options=[_(u"Взрослая"),
                                                 _(u"Полувзрослая"),
                                                 _(u"Слёток"),
                                                 _(u"Птенец"),
                                                 _(u"Возраст не определён")]))
This part doesn't work. When I change language - dropdown options not translates. Also even if I use en locale month's names in date field looks like month_01, month_02.
Reply all
Reply to author
Forward
0 new messages