From 89c3349a1c72d321afa0dbde9f0517fa38c0415d Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 19 Oct 2010 05:01:18 +0000 Subject: [PATCH] BUGFIX More common defaults for en_US.xml used by Zend_DateFormat (and DateField/DatetimeField), with less error prone numerical format replacing the Zend default of shortened month names (fixes #6071, thanks dalesaurus) BUGFIX Correct locale mapping in DateField_View_JQuery for "en_US" and "en_NZ" MINOR Fixed form validation message in DateField to include actual date format, rather than a hardcoded value (from r111843) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112928 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- forms/DateField.php | 9 +++- lang/en_US.php | 2 +- thirdparty/Zend/Locale/Data/en_US.xml | 64 +++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 3 deletions(-) diff --git a/forms/DateField.php b/forms/DateField.php index 335deae33..63ff71f57 100755 --- a/forms/DateField.php +++ b/forms/DateField.php @@ -210,8 +210,11 @@ class DateField extends TextField { if(Validator::get_javascript_validator_handler() == 'none') return true; if($this->getConfig('dmyfields')) { - $error = _t('DateField.VALIDATIONJS', 'Please enter a valid date format (DD/MM/YYYY).'); - $error = 'Please enter a valid date format (DD/MM/YYYY) from dmy.'; + $error = _t('DateField.VALIDATIONJS', 'Please enter a valid date format.'); + // Remove hardcoded date formats from translated strings + $error = preg_replace('/\(.*\)/', '', $error); + $error .= ' (' . $this->getConfig('dateformat') .')'; + $jsFunc =<< 'en-GB', + 'en_US' => 'en-US', + 'en_NZ' => 'en-GB', 'fr_CH' => 'fr-CH', 'pt_BR' => 'pt-BR', 'sr_SR' => 'sr-SR', diff --git a/lang/en_US.php b/lang/en_US.php index c0c556906..da85575a7 100644 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -150,7 +150,7 @@ $lang['en_US']['Date']['YEAR'] = ' year'; $lang['en_US']['Date']['YEARS'] = ' years'; $lang['en_US']['DateField']['NOTSET'] = 'not set'; $lang['en_US']['DateField']['TODAY'] = 'today'; -$lang['en_US']['DateField']['VALIDATIONJS'] = 'Please enter a valid date format (DD/MM/YYYY).'; +$lang['en_US']['DateField']['VALIDATIONJS'] = 'Please enter a valid date format.'; $lang['en_US']['DateField']['VALIDDATEFORMAT'] = 'Please enter a valid time format.'; $lang['en_US']['DateField']['VALIDDATEFORMAT2'] = 'Please enter a valid date format (%s)'; $lang['en_US']['DateField']['VALIDDATEMAXDATE'] = 'Your date has to be older or matching the maximum allowed date (%s)'; diff --git a/thirdparty/Zend/Locale/Data/en_US.xml b/thirdparty/Zend/Locale/Data/en_US.xml index eef47372d..e6fc80ddf 100644 --- a/thirdparty/Zend/Locale/Data/en_US.xml +++ b/thirdparty/Zend/Locale/Data/en_US.xml @@ -7,4 +7,68 @@ + + + + + + + EEEE, d MMMM yyyy + + + + + d MMMM yyyy + + + + + MM/dd/yyyy + + + + + MM/dd/yyyy + + + + + + + HH:mm:ss v + + + + + HH:mm:ss z + + + + + hh:mm a + + + + + hh:mm a + + + + + + + + true + + + true + + + true + + + true + + +