Zend Framework

Zend_Validate message can not translate when using Zend_Translate_Adapter_Ini

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Not an Issue
  • Affects Version/s: 1.9.4
  • Fix Version/s: 1.10.0
  • Labels:
    None

Description

Hi.
To translate Zend_Validate error messages, docs described to use Zend_Validate actual error messages as message identifiers.

http://framework.zend.com/manual/en/zend.form.i18n.html#zend.form.i18n.standard

Alternately, as of 1.6.0, you may provide translation strings using the actual error messages as message identifiers.
This is the preferred use case for 1.6.0 and up, as we will be deprecating translation of message keys in future releases.

Using ini file as messages file, and set error messages as message identifiers.

'%value%' is an empty string = "TRANSLATION MESSAGE"

Zend_Translate returns parse error, becouse some of error messages contains '()'.

$locale = new Zend_Locale('ja');
$path = dirname(__FILE__) . '/ja.ini';
$translate = new Zend_Translate('ini', $path , $locale);

parse_ini_file() dose not allow to use characters '()'.

http://php.net/manual/en/function.parse-ini-file.php

Note: There are reserved words which must not be used as keys for ini files.
These include: null, yes, no, true, false, on, off, none. Values null, no and false results in "", yes and true results in "1".
Characters {}|&~![()^" must not be used anywhere in the key and have a special meaning in the value.

Zend_Validate_Ccnum and Zend_Validate_Hostname message uses not allowed characters and should be changed, in my opinion.
-Luhn algorithm (mod-10 checksum) failed on '%value%'
+Luhn algorithm 'mod-10 checksum' failed on '%value%'

-'%value%' appears to be a DNS hostname but contains a dash ( - ) in an invalid position
+'%value%' appears to be a DNS hostname but contains a dash '-' in an invalid position

Regards.

Activity

Hide
Thomas Weidner added a comment -

No issue.
The available translation ressources are using the Array adapter.
Additionally Ccnum is depreciated as with 1.10 because it have massive security problems.

Show
Thomas Weidner added a comment - No issue. The available translation ressources are using the Array adapter. Additionally Ccnum is depreciated as with 1.10 because it have massive security problems.
Hide
Shinya Ohyanagi added a comment -

Thomas, thank you for comments and change Zend_Validate_Hostname message.

Regards.

Show
Shinya Ohyanagi added a comment - Thomas, thank you for comments and change Zend_Validate_Hostname message. Regards.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: