Quantcast

BA7-899 Zend_Form translate dynamic error messages

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

BA7-899 Zend_Form translate dynamic error messages

Richard Knop

Here is an array I'm using to translate Zend_Form error messages from English to Slovak:

return array(
    'Value is required and can\'t be empty' => 'Hodnota nemôže byť prázdna',
    'Captcha value is wrong' => 'Nesprávna hodnota captcha'
);

Now the problem. Values such as:

'Captcha value is wrong'

Or:

'Value is required and can\'t be empty'

Get translated alright because they are static (they don't change). But what about dynamic messages like:

'a' is less than 3 characters long

Where 'a' is always substituted with an actual text from input field and 3 can also be different number. What should I add to an array to translate messages like these?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Zend_Form translate dynamic error messages

Joó Ádám
Open the appropriate Zend_Validate class, and check the original
messages. In the case of Zend_Validate_StringLength use "'%value%' is
less than %min% characters long".


Regards,
Ádám
Loading...