Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Better US Localization

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

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

Page: 1
Go to End
Author Topic: 2170 Views
  • pianomansam
    Avatar
    Community Member
    9 Posts

    Better US Localization Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5502 Posts

    Re: Better US Localization Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: Better US Localization Link to this post

    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

  • BLU42 Media
    Avatar
    Community Member
    71 Posts

    Re: Better US Localization Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: Better US Localization Link to this post

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

    2170 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.