ZF-3920: Unable to translate correct Barcode error message

Description

I found a bug in Zend_Validate_Barcode_UpcA and Zend_Validate_Barcode_Ean13.

These validators have same constant value for error messages:

class Zend_Validate_Barcode_UpcA .. protected $_messageTemplates = array( self::INVALID => "'%value%' is an invalid UPC-A barcode", self::INVALID_LENGTH => "'%value%' should be 12 characters", ); ..

class Zend_Validate_Barcode_Ean13 ... protected $_messageTemplates = array( self::INVALID => "'%value%' is an invalid EAN-13 barcode", self::INVALID_LENGTH => "'%value%' should be 13 characters", ); ...

So I am unable to translate right error message with e.g. Tmx adapter because translation ids are identical.

A simple solution would be to rename the 'invalid' to 'invalidupca' and 'invalidean13'.

Comments

I cannot fix this issue without a BC break. I have postponed it for now, until Matthew can tell me more.

Depends on ZF-3614.

BC break, will probably be addressed with the next release

Sorry... Wrong issue number... I meant ZF-3164

I propose to make a sort of standard for keys. A working solution would be to name the keys like: - classError

For example: barcodeUpcInvalid barCodeEanInvalid stringLengthInvalid

and so on. I think you get an idea.

Assigned to matthew after a discussion in #zftalk.

Issue has been postponed until 2.0 after a discussion with the dev-team. Reason is that the fix for this issue would be a BC break.

Probably fixed with r17874 for ZF 1.10