eumandy/eugtk/examples/test210.ex
2016-11-25 00:33:18 -07:00

48 lines
1.2 KiB
Elixir

------------------------------------------------------------------------
--# generates a sample text string in the designated language
------------------------------------------------------------------------
include GtkEngine.e
include GtkCairo.e
constant docs = `<u><b>Languages</b></u>
Enter a language code in the box below,
(es, en, fr, la, ja, ko, pt_BR, sv_FI, etc...)
click the OK button...
`
constant win = create(GtkWindow,{
{"position",GTK_WIN_POS_MOUSE},
{"border width",10},
{"icon","thumbnails/preferences-desktop-locale.svg"}})
connect(win,"destroy","Quit")
constant panel = create(GtkBox,VERTICAL)
add(win,panel)
constant lbl = create(GtkLabel)
set(lbl,"markup",docs)
add(panel,lbl)
constant inp = create(GtkEntry,{
{"text","sv_FI"},
{"activates default",TRUE}})
add(panel,inp)
constant btn = create(GtkButton,"gtk-ok","DisplayLanguage")
pack(panel,-btn)
set(btn,"can default",TRUE)
set(win,"default",btn)
show_all(win)
main()
---------------------------------
global function DisplayLanguage()
----------------------------------
atom x = create(PangoLanguage,get(inp,"text"))
object lang = get(x,"to string")
object text = get(x,"sample string")
return Info(win,"Language",lang,text)
end function