WTForms Locale(翻译)

时间:2016-01-30 17:20:05

标签: python flask wtforms

我正在使用Flask,SQLAlchemy,WTForms 2.1和WTForms-Alchemy(Python 2.7.10)构建APP。 我想更改WTForms的语言环境来翻译默认消息(例如“电子邮件已存在”等)。但是当我在Form类上设置“locales”时,我收到以下错误:

IOError: [Errno 2] No translation file found for domain: 'wtforms'

我的表格是:

class UserForm(ModelForm):
    class Meta:
        model = User
        locales = ('pt')

    submit = SubmitField('Save')

用户模型是:

class User(db.Model):
    __tablename__ = 'usuario'

    id = db.Column(db.Integer, primary_key=True)
    nome = db.Column(db.String(80), info={'label': u'Nome*:'}, nullable=False)

如何设置WTForms区域设置?我看到他们的语言环境文件夹中有很多语言。

0 个答案:

没有答案
相关问题