DateTimePicker with Custom Culture

Posted by: ulf on 31 October 2022, 11:47 am EST

    • Post Options:
    • Link

    Posted 31 October 2022, 11:47 am EST

    Hi, How do I change Culture in DateTimePicker ?, https://www.grapecity.com/spreadjs/demos/features/cells/drop-downs/date-time-picker#demo_source_name , so Month, Day-names and Today-text are translated to a chosen language. I tried the example here: https://www.grapecity.com/spreadjs/docs/features/culture/culturecustom , but datetimepicket does not seem to pickup the german culture.

    Best Regards

    Ulf

  • Posted 1 November 2022, 1:55 am EST

    Hi,

    Using the getResources and setResources methods, you may change the weekdays, month names, and “today” label.

    Please see the following snippet of code:

    var resInfo = GC.Spread.Common.CultureManager.getResources();
    // Change WeekDay Names
    resInfo.CellTypes.Calendar_ShortWeeks_1 = 'A';
    resInfo.CellTypes.Calendar_ShortWeeks_2 = 'B';
    resInfo.CellTypes.Calendar_ShortWeeks_3 = 'C';
    resInfo.CellTypes.Calendar_ShortWeeks_4 = 'D';
    resInfo.CellTypes.Calendar_ShortWeeks_5 = 'E';
    resInfo.CellTypes.Calendar_ShortWeeks_6 = 'F';
    resInfo.CellTypes.Calendar_ShortWeeks_7 = 'G';
    // Change Month Names
    resInfo.CellTypes.Calendar_Months_1 = 'Month1';
    resInfo.CellTypes.Calendar_Months_2 = 'Month2';
    resInfo.CellTypes.Calendar_Months_3 = 'Month3';
    resInfo.CellTypes.Calendar_Months_4 = 'Month4';
    resInfo.CellTypes.Calendar_Months_5 = 'Month5';
    resInfo.CellTypes.Calendar_Months_6 = 'Month6';
    resInfo.CellTypes.Calendar_Months_7 = 'Month7';
    resInfo.CellTypes.Calendar_Months_8 = 'Month8';
    resInfo.CellTypes.Calendar_Months_9 = 'Month9';
    resInfo.CellTypes.Calendar_Months_10 = 'Month10';
    resInfo.CellTypes.Calendar_Months_11 = 'Month11';
    resInfo.CellTypes.Calendar_Months_12 = 'Month12';
    // Change Today Text
    resInfo.CellTypes.Calendar_Today = "Custom Today Text";
    
    GC.Spread.Common.CultureManager.addCultureInfo("de-DE", null, resInfo);
    

    Sample: https://jscodemine.grapecity.com/share/MWbNsALDL0mFpMNcN17mIQ/

    API References:

    getResources method: https://www.grapecity.com/spreadjs/api/classes/GC.Spread.Common.CultureManager#getresources

    addCultureInfo method: https://www.grapecity.com/spreadjs/api/classes/GC.Spread.Common.CultureManager#addcultureinfo

    Regards,

    Ankit

  • Posted 1 November 2022, 3:43 am EST

    Thanks, Solution worked fine!

    Regards, Ulf

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels