[tutor] ã“ã‚“ã«ã¡ã¯ä¸–界。 "Hello World"
- Posted by _tom (admin) Feb 26, 2019
- 1727 views
A console example
The oE|Phix programming languages are written in plain text.
You can use any people language for the name of your program file and string data.
In these examples I used google translate to make Euphoria programs that operate in Japanese.
-- oE include std/console.e atom answer = prompt_number("続行ã™ã‚‹ã«ã¯1を入力ã—ã¦ãã ã•ã„。", {} ) if answer = 1 then puts(1, "ã“ã‚“ã«ã¡ã¯ä¸–界。") else puts(1, "ã•ã‚ˆã†ãªã‚‰ã€‚" ) end if
Phix has "autoinclude" so it is a bit simpler.
--Phix atom answer = prompt_number("続行ã™ã‚‹ã«ã¯1を入力ã—ã¦ãã ã•ã„。", {} ) if answer = 1 then puts(1, "ã“ã‚“ã«ã¡ã¯ä¸–界。") else puts(1, "ã•ã‚ˆã†ãªã‚‰ã€‚" ) end if
Google translate provided
続行ã™ã‚‹ã«ã¯1を入力ã—ã¦ãã ã•ã„。 | Please enter 1 to continue. |
ã“ã‚“ã«ã¡ã¯ä¸–界。 | Hello world. |
ã•ã‚ˆã†ãªã‚‰ã€‚ | Goodbye. |
An example using oE and euGTK.
I saved the following file as ã“ã‚“ã«ã¡ã¯ä¸–ç•Œ . The file name ã“ã‚“ã«ã¡ã¯ä¸–ç•Œ now shows up in the title bar of the GTK window.
The "Quit" button is still English. You could invent your own buttons if you wish.
---------------------------------------------------------------------------- --# Yet Another Hello World! program ---------------------------------------------------------------------------- include GtkEngine.e constant --[1] create the widgets; win = create(GtkWindow,"border width=10,icon=face-laugh,$destroy=Quit"), pan = create(GtkBox,"orientation=vertical"), box = create(GtkButtonBox), btn = create(GtkButton,"gtk-quit", "Quit"), lbl = create(GtkLabel,"color=blue") --[2] style the label; set(lbl,"markup", -- style the text using basic html; "<b><u><span color='red'><big>ã“ã‚“ã«ã¡ã¯ä¸–ç•Œ</big></span></u></b>\n\n" & "ã“ã‚Œã¯ã€ãƒ©ãƒ™ãƒ«ã¨çµ‚了ボタンをæŒã¤å˜ç´”ãªã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã‚’デモã—ã¾ã™ã€‚\n") --[3] add widgets to containers; add(win,pan) add(pan,lbl) add(box,btn) pack(pan,-box) show_all(win) --[4] instantiate widgets; main() --[5] enter main processing loop;
You can customize an oE|Phix program for any people language with little effort. You do not have to fully understand UTF and fonts to make this happen.
_tom