Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Better US Localization


Go to End


5 Posts   3142 Views

Avatar
pianomansam

Community Member, 9 Posts

4 November 2008 at 11:15am

Edited: 04/11/2008 11:17am

Since I'm in the United States, I made some heavy changes to the core of SilverStripe and the Ecommerce module. In Silverstripe, I changed practically all references of Surname to Last name. In the Ecommerce module, I added support for State and Zip Codes. Linked are the results of my work. Thanks!

US-customized Silverstripe w/ Ecommerce

Sam Oltz
Spearia, Inc.

Avatar
Willr

Forum Moderator, 5523 Posts

4 November 2008 at 6:06pm

If you want this to be included / debated for the core. Which I seem as quite reasonable you might like to post a patch to open.silverstripe.com

Avatar
UncleCheese

Forum Moderator, 4102 Posts

5 November 2008 at 3:57am

Better support for the M/D/Y format would be great, too. So many of my clients are confused by the CalendarDateField when they're entering data. "What on earth is month 19?!"

And of course, with manual entry, you end up getting a lot of December 31, 1969's :-)

Avatar
BLU42 Media

Community Member, 71 Posts

7 November 2008 at 7:59am

I'm based in NYC and have needed US date formats for my customers. It's not comprehensive, but for adjusting the CMS I've used the following successfully:

/jsparty/calendar/calendar-setup.js

Change line 5 in initialise()
ifFormat : "%m/%d/%Y", // the date format

Change line 32 in setToToday()
this.value = ( date.getMonth() + 1 ) + '/' + date.getDate() + '/' + date.getYear();

/sapphire/forms/DateField.php

Change line 18 in setValue()
$this->value = preg_replace('/^([\d]{2,4})-([\d]{1,2})-([\d]{1,2})/','\\2/\\3/\\1', $val);

Change line 29 in dataValue()
return "$parts[3]-$parts[1]-$parts[2]";

It would be nice to see the d/m/y (m/d/y) type code moved to the _config.php file so it could be easily updated. Has anyone done that successfully?

Hope that helps someone!

-John

Avatar
UncleCheese

Forum Moderator, 4102 Posts

7 November 2008 at 8:05am

Perfect!Thank you. Yes, I agree. This should be a no-brainer.