How to display Chinese prompts in DateField of wtform

class RegisterForm(Form):
    name = simple.StringField(
            label="",
            validators=[
                validators.DataRequired(message="")
            ],
            widget=widgets.TextInput(),
            render_kw={"class": "form-control"},
    )

    birthday = core.DateField(label="", format="%Y-%m-%d")   

ask for advice:

after rendering the page
if birthday does not fill in the time format, the prompt is "Not a valid date value"
how can this be changed to custom Chinese?

Apr.08,2021

to completely overwrite the error message, inherit the DateField and override the process_formdate () method, such as

-sharp -*- coding: utf-8 -*-
from wtforms import Form, DateField
from webob.multidict import MultiDict


class DemoDateField(DateField):
    def process_formdata(self, valuelist):
        try:
            DateField.process_formdata(self, valuelist)
        except ValueError:
            raise ValueError(u'')


class DemoForm(Form):
    day = DemoDateField('day')


form = DemoForm()
form.process(MultiDict(dict(day='abc')))
assert form.day.process_errors == [u'']

if you just translate English error messages, modify the locale setting or inherit the DateField and override the gettext () method.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5b044-455ff.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5b044-455ff.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?