Impossible to translate the string 'Not a valid input' displayed in the event of input error on the username field with a PERL regular expression verification.
In the code of CB in cb.core.php, lines 64 and 96 are buggy.
I do not correct the line 64 which does not correspond to the error that I see.
I propose
- New line to replace the line 96
- Added the import file cbteamplugins_language.php
then
- Added error text in cbteamplugins_language.php
Replace line 89
Code:
function validate( &$field, &$user, $columnName, &$value, &$postdata, $reason ) {
$validated = parent::validate( $field, $user, $columnName, $value, $postdata, $reason );
if ( $validated && ( $value !== '' ) && ( $value !== null ) ) { // empty values (e.g. non-mandatory) are treated in the parent validation.
$pregExp = $this->_getRegexp( $field );
if ( $pregExp ) {
$validated = preg_match( $pregExp, $value );
if ( ! $validated ) {
$pregExpError = $field->params->get( 'pregexperror', CBTxt::T('Not a valid input') );
by
Code:
function validate( &$field, &$user, $columnName, &$value, &$postdata, $reason ) {
cbimport( 'language.cbteamplugins' );
$validated = parent::validate( $field, $user, $columnName, $value, $postdata, $reason );
if ( $validated && ( $value !== '' ) && ( $value !== null ) ) { // empty values (e.g. non-mandatory) are treated in the parent validation.
$pregExp = $this->_getRegexp( $field );
if ( $pregExp ) {
$validated = preg_match( $pregExp, $value );
if ( ! $validated ) {
$pregExpError = ISOtoUtf8( CBTxt::P($field->params->get( 'pregexperror', 'Not a valid input' ))) ;
We must also add in the file .../default_language/cbteamplugins_language.php
Code:
'Not a valid input' => 'Not a valid input.',