Page 1 of 2
Date Picker localisation
Posted: Wed Jan 24, 2024 10:16 pm
by Hendricus
I want to be able to change the Date Picker widget to match the language set by the i18n library using the following code
Code: Select all
// set the date picker
set the namesToUse of widget "Date Picker" of group "Select Type Popup" of card "To Do" to "Custom"
put translate("MO,TU,WE,TH,FR,SA,SU") into tDayNames
set the dayNames of widget "Date Picker" of group "Select Type Popup" of card "To Do" to tDayNames
put toUpper(translate("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec")) into tMonthNames
set the monthNames of widget "Date Picker" of group "Select Type Popup" of card "To Do" to tMonthNames
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?
Re: Date Picker localisation
Posted: Thu Jan 25, 2024 1:47 pm
by Klaus
Hi Hendricus,
sorry, no solutuon for your problem, but you really should report this bug here:
https://quality.livecode.com
If not reported this will never get fixed.
Best
Klaus
Re: Date Picker localisation
Posted: Thu Jan 25, 2024 2:39 pm
by dunbarx
Hendricus.
After reporting the conflict, as it is not really a bug in the usual sense, you will have to roll your own "month names" function. At least then it will not conflict with a native LC function. I do not use widgets, but assume this is simple to do.
I think.
Craig
Re: Date Picker localisation
Posted: Thu Jan 25, 2024 2:46 pm
by Klaus
dunbarx wrote: ↑Thu Jan 25, 2024 2:39 pm
Hendricus.
After reporting the conflict, as it is not really a bug in the usual sense, you will have to roll your own "month names" function. At least then it will not conflict with a native LC function. I do not use widgets, but assume this is simple to do.
I think.
Craig
No, it isn't!
Code: Select all
set the monthNames of widget "Date Picker" of group "Select Type Popup" of card "To Do" to tMonthNames
"the monthnames" is a (custom?) property of that widget so you cannot work around this.
Congratulations Livecode for this very clever "catch 22", you shot your own foot with a .357 Magnum!
Re: Date Picker localisation
Posted: Thu Jan 25, 2024 8:47 pm
by dunbarx
Klaus.
I know. That is why I mentioned he would have to roll his own. But perhaps you meant that there is NO way to do this, due to the "closed" nature of a widget object type?
Craig
Re: Date Picker localisation
Posted: Thu Jan 25, 2024 9:37 pm
by Klaus
I meant that there is no workaround for THIS widget.
And that this is more than embarrassing for Livecode!
Re: Date Picker localisation
Posted: Fri Jan 26, 2024 1:53 am
by stam
There is funkiness here...
Code: Select all
get the monthNames of widget "date picker"
generates a runtime error
Execution error: Chunk: source is not a container
You can't even set the month names manually in the property inspector...
Clearly incorrect behaviour, has anyone bug-reported this?
Re: Date Picker localisation
Posted: Fri Jan 26, 2024 1:39 pm
by Klaus
stam wrote: ↑Fri Jan 26, 2024 1:53 am
...
Clearly incorrect behaviour, has anyone bug-reported this?
Just checked the "quality center", no report so far.
Re: Date Picker localisation
Posted: Fri Jan 26, 2024 6:08 pm
by bobcole
The monthNames used in the Calendar widget's header can be changed in the Property Inspector.
They are 3 character name by default but can be changed in the PI. That worked.
I tried to access the monthNames of the widget by script (as described in the dictionary) but that didn't work.
I tried to access the dayNames of the widget by script; that worked.
This should be fixed. Also, I suggest a unique name (not monthNames) for the Calendar widget.
Bob
Re: Date Picker localisation
Posted: Fri Jan 26, 2024 6:45 pm
by stam
Hi Bob,
I did not share your luck with changing monthNames in the PI.
I wonder if that's because you
may have used the
Calendar extension (an older extension by LC) rather than then new
Date Picker extension?? I ask because the monthNames in datePicker are
full words, not 3 letters, as
is the case with the Calendar extension.
In the
Date Picker extension's property inspector, any change I try to make in the PI is reset when I exit the field.
what's more interesting is that the PI presents these as comma-separated list, whereas if you type in the messageBox
Code: Select all
put the monthNames of widget "date picker"
you get a return-delimited list, which suggest the PI's type should be enum, not text/list.
And as mentioned, if you script this in a button you get get an execution error...
Seems like a hot mess?
Stam
Re: Date Picker localisation
Posted: Fri Jan 26, 2024 7:10 pm
by stam
I submitted a bug report here:
https://quality.livecode.com/show_bug.cgi?id=24480
If you're interested, add your emails to be notified of it's progress.
Stam
Re: Date Picker localisation
Posted: Fri Jan 26, 2024 7:44 pm
by Klaus
Thank you!
Re: Date Picker localisation
Posted: Sat Jan 27, 2024 2:12 am
by bobcole
Yes, I used the Calendar widget.
I wasn't aware there was another: Date Picker.
Sorry,
Bob
Re: Date Picker localisation
Posted: Sat Jan 27, 2024 2:14 am
by stam
I think it was released with the summer megabundle but might be mistaken. A lot of widgets in that were problematic….
Re: Date Picker localisation
Posted: Sun Jan 28, 2024 1:50 pm
by bn
It turns out that you can only set the monthNames if the "namesToUse" are set to "Custom"
this works for me with widget DatePicker
Code: Select all
on mouseUp pButtonNumber
set the namesToUse of widget 1 to "Custom"
set the weekStartsOn of widget 1 to "Sunday"
set the "MonthNames" of widget 1 to "JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC"
set the weekStartsOn of widget 1 to "Sunday"
set the dayNames of widget 1 to "su,mo,tu,wed,thu,fr,sa"
end mouseUp
Note: namesToUse "Custom" is case sensitive, upper "C" required, also note that "monthNames" are quoted, not case sensitive.
Kind regards
Bernd