'Do a syntax check on the format string. Doing a semantic check
(verifying that the fields exist) is not useful in the presence of
custom fields, because they may or may not exist.'

def validate(self):

    tmpl = preprocess_template(self.opt_template.text())
    try:
        t = validation_formatter.validate(tmpl)
        if (t.find(validation_formatter._validation_string) < 0):
            return question_dialog(self, _('Constant    template'), _('The    template    contains    no    {fields},    so    all    books    will    have    the    same    name.    Is    this    OK?'))
    except Exception as err:
        error_dialog(self, _('Invalid    template'), ((('<p>' + (_('The    template    %s    is    invalid:') % tmpl)) + '<br>') + str(err)), show=True)
        return False
    return True
