1. [tutor] ã“ã‚“ã«ã¡ã¯ä¸–界。 "Hello World"
- Posted by _tom (admin) Feb 26, 2019
- 2055 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
2. Re: [tutor] ã“ã‚“ã«ã¡ã¯ä¸–界。 "Hello World"
- Posted by irv Feb 26, 2019
- 1783 views
In EuGTK, you can use any image and any caption on a button:
btn = create(GtkButton,"gtk-quit#ã•よã†ãªã‚‰ã€‚","Quit") -- stock "quit" icon
The stock icon (or image file) is first, followed by a pound sign (#) and then the caption.
btn = create(GtkButton,"~/demos/thumbnails/mongoose.png#ã•よã†ãªã‚‰ã€‚","Quit") -- image from file
There's also a way to change captions using an .ini file, which means a single program can change languages without changes to the source code. Users can modify the captions to their favorite languages very easily. Example:
-- ΜετάφÏαση από την Google --! MainWindow.title = Δοκιμή αÏÎ¹Î¸Î¼Î¿Ï Ï€ÏογÏάμματος 3 --! MainWindow.border = 10 + MainWindow.HelpCaption = Βοήθεια + MainWindow.HelpTitle = Σχετικά με αυτό το Ï€ÏόγÏαμμα + MainWindow.HelpText = Δεν υπάÏχει τίποτα να πει κανείς, | είναι απλά Îνα Ï€ÏόγÏαμμα, ok?If they run your program without an .ini, your program reverts to english. You can have more than one .ini, one for each language.
See /demos/examples/misc/multi.ex
3. Re: [tutor] ã“ã‚“ã«ã¡ã¯ä¸–界。 "Hello World"
- Posted by _tom (admin) Feb 26, 2019
- 1732 views
Thanks Irv.
My conclusion is that rather than worry about "fonts" or "bytes per character" or other "details"--you can just use strings in the language you want.
_tom

