Hi Hendricus,Hendricus wrote: ↑Wed Jan 24, 2024 10:16 pmI want to be able to change the Date Picker widget to match the language set by the i18n library using the following code
Unfortunately, the property 'the monthNames' as described in the Dictionary for the widget is also a core Livecode function and is raised as a compilation error in the Livecode IDE, saying that "token is not a property". Does anyone know what the correct property for changing the month names of the Date Picker widget must be?
As I mentioned you have to put quotes around "monthNames".
Also if you use "Custom" as namesToUse then you have to set the dayNames in the order as if the week starts on Sunday
Code: Select all
put ("SU,MO,TU,WE,TH,FR,SA") into tDayNames
regardless of how you want you week want to start (Monday/Sunday). Otherwise Date Picker gets confused
This works with your example script (without 'translate')
Code: Select all
on mouseUp
// set the date picker
set the namesToUse of widget "Date Picker" to "Custom"
set the weekStartsOn of widget "Date Picker" to "Monday"
put ("SU,MO,TU,WE,TH,FR,SA") into tDayNames
set the dayNames of widget "Date Picker" to tDayNames
put toUpper(("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec")) into tMonthNames
set the "monthNames" of widget "Date Picker" to tMonthNames
end mouseUp
Kind regards
Bernd