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
This commit is contained in:
Sam Minnee 2010-10-19 05:01:18 +00:00
parent 5e0b978263
commit 89c3349a1c
3 changed files with 72 additions and 3 deletions

View File

@ -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 =<<<JS
Behaviour.register({
"#$formID": {
@ -497,6 +500,8 @@ class DateField_View_JQuery {
*/
static $locale_map = array(
'en_GB' => 'en-GB',
'en_US' => 'en-US',
'en_NZ' => 'en-GB',
'fr_CH' => 'fr-CH',
'pt_BR' => 'pt-BR',
'sr_SR' => 'sr-SR',

View File

@ -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)';

View File

@ -7,4 +7,68 @@
<language type="en"/>
<territory type="US"/>
</identity>
<dates>
<calendars>
<calendar type="gregorian">
<dateFormats>
<dateFormatLength type="full">
<dateFormat>
<pattern>EEEE, d MMMM yyyy</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="long">
<dateFormat>
<pattern>d MMMM yyyy</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="medium">
<dateFormat>
<pattern>MM/dd/yyyy</pattern>
</dateFormat>
</dateFormatLength>
<dateFormatLength type="short">
<dateFormat>
<pattern>MM/dd/yyyy</pattern>
</dateFormat>
</dateFormatLength>
</dateFormats>
<timeFormats>
<timeFormatLength type="full">
<timeFormat>
<pattern>HH:mm:ss v</pattern>
</timeFormat>
</timeFormatLength>
<timeFormatLength type="long">
<timeFormat>
<pattern>HH:mm:ss z</pattern>
</timeFormat>
</timeFormatLength>
<timeFormatLength type="medium">
<timeFormat>
<pattern>hh:mm a</pattern>
</timeFormat>
</timeFormatLength>
<timeFormatLength type="short">
<timeFormat>
<pattern>hh:mm a</pattern>
</timeFormat>
</timeFormatLength>
</timeFormats>
</calendar>
</calendars>
<timeZoneNames>
<metazone type="America_Eastern">
<commonlyUsed>true</commonlyUsed>
</metazone>
<metazone type="America_Central">
<commonlyUsed>true</commonlyUsed>
</metazone>
<metazone type="America_Mountain">
<commonlyUsed>true</commonlyUsed>
</metazone>
<metazone type="America_Pacific">
<commonlyUsed>true</commonlyUsed>
</metazone>
</timeZoneNames>
</dates>
</ldml>