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.

Archive

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

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

Better US Localization


Reply

5 Posts   2186 Views

Avatar
pianomansam

4 November 2008 at 11:15am (Last edited: 4 November 2008 11:17am), Community Member, 9 Posts

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!

[url=http://dev.spearia.com/~samueloltz/silverstripe-US.zip]US-customized Silverstripe w/ Ecommerce[/url]

Sam Oltz
Spearia, Inc.

Avatar
Willr

4 November 2008 at 6:06pm Forum Moderator, 5511 Posts

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

5 November 2008 at 3:57am 4085 Posts

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

7 November 2008 at 7:59am Community Member, 71 Posts

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

7 November 2008 at 8:05am 4085 Posts

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