WhatSock / apex

Apex 4X: The Comprehensive ARIA Development Suite
MIT License
29 stars 9 forks source link

localizer #43

Closed carlafranca closed 1 year ago

carlafranca commented 1 year ago

Is there a way to add localization to this plugin? I would lile to have it as a configuration. also to have different types of displaying the day name as single letter or double letter.

this.dayShort = date.toLocaleString(lang, { weekday: "short" }); this.month = date.toLocaleString(lang, { month: "long" }); this.monthShort = date.toLocaleString(lang, { month: "short" }); this.monthNumber = Number(date.toLocaleString(lang, { month: "2-digit" }));

By the way, thanks for this accessiblity datepicker.

accdc commented 1 year ago

Hi, yes of course. :) When I built it I tried to make sure everything could be customized.

You can change the short and long weekday and even the month assignments by adding the following code to your setup declaration.

// Set month names
months: [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December'
],

// Set short and long weekday names
days: [
{
s: 'S',
l: 'Sunday'
},
{
s: 'M',
l: 'Monday'
},
{
s: 'T',
l: 'Tuesday'
},
{
s: 'W',
l: 'Wednesday'
},
{
s: 'T',
l: 'Thursday'
},
{
s: 'F',
l: 'Friday'
},
{
s: 'S',
l: 'Saturday'
}
],

This is directly copied from the setup config options within the help file in the download by opening: Help/Module Imports/Dynamic Components/Datepicker.txt

There you can see all of the other configuration options you can use to customize the format, layout, and functionality of the datepicker however you wish.

Does this answer your question?

carlafranca commented 1 year ago

Yes, thank you