47 lines
1.3 KiB
Elixir
47 lines
1.3 KiB
Elixir
|
|
||
|
------------------------------------------------------------------------
|
||
|
--# Calendar with locale
|
||
|
------------------------------------------------------------------------
|
||
|
|
||
|
include GtkEngine.e
|
||
|
|
||
|
-- Translates buttons and calendar text if you have the language installed
|
||
|
-- note: if you include locale.e, you must use the gtk: namespace for
|
||
|
-- all gtk get/set calls, since set() and get() also exist in locale.e
|
||
|
|
||
|
include std/locale.e
|
||
|
|
||
|
object lang = "es_MX.UTF-8" -- try your favorite language spec here!
|
||
|
|
||
|
constant win = create(GtkWindow,"position=1,$destroy=Quit")
|
||
|
|
||
|
constant panel = create(GtkBox,VERTICAL)
|
||
|
add(win,panel)
|
||
|
|
||
|
constant cal = create(GtkCalendar)
|
||
|
gtk:set(cal,"mark day",gtk:get(cal,"day"))
|
||
|
add(panel,cal)
|
||
|
|
||
|
constant btnbox = create(GtkButtonBox,"border_width=10")
|
||
|
pack(panel,-btnbox)
|
||
|
add(btnbox,{
|
||
|
create(GtkButton,"gtk-quit","Quit"),
|
||
|
create(GtkButton,"gtk-ok",_("ShowDate"))})
|
||
|
|
||
|
show_all(win)
|
||
|
|
||
|
if locale:set(lang) = 0 then
|
||
|
Warn(0,,"Sorry, unable to load",lang)
|
||
|
end if
|
||
|
|
||
|
main()
|
||
|
|
||
|
------------------------------------------------------------------------
|
||
|
function ShowDate()
|
||
|
------------------------------------------------------------------------
|
||
|
object selected_date = gtk:get(cal,"date","%A, %b %d, %Y")
|
||
|
Info(win,"Calendar Results","Selected date",selected_date)
|
||
|
return 1
|
||
|
end function
|
||
|
|