Example #1
0
def test_checker_works():
    m = Message(id=u'hello', string=u'hello %(num)d')
    errors = [err for err in m.check()]
    eq_(len(errors), 1)
    eq_(
        str(errors[0]), 'Translation contains named placeholder but '
        'source doesn\'t: hello %(num)d')
Example #2
0
def validate(message: Message, catalog: Catalog) -> List[str]:
    errors = _validate_fuzzy(message)
    errors.extend([f'    {str(err)}' for err in message.check(catalog)])
    if message.python_format and not message.pluralizable and message.string:
        errors.extend(_validate_cfmt(message.id, message.string))

    return errors
Example #3
0
def test_checker_works():
    m = Message(id=u'hello', string=u'hello %(num)d')
    errors = [err for err in m.check()]
    eq_(len(errors), 1)
    eq_(str(errors[0]), 'Translation contains named placeholder but '
                        'source doesn\'t: hello %(num)d')