Author Topic: Re: HEBREW in QB64 console?  (Read 2721 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: HEBREW in QB64 console?
« Reply #15 on: August 16, 2019, 12:21:23 am »
So in English what were the letters of "hello world!" typed in reply #27? (one last try before I call it a night)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: HEBREW in QB64 console?
« Reply #16 on: August 16, 2019, 12:29:16 am »
Can you translate the Hebrew letters to English?

Never mind, there doesn't look to be a 1 to 1 translation, let alone alphabets going in same order.

Goodnight!
« Last Edit: August 16, 2019, 12:35:28 am by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: HEBREW in QB64 console?
« Reply #17 on: August 16, 2019, 10:03:02 am »
Hi Ron,

I am wondering if this function:
http://qb64.org/wiki/MAPUNICODE
under function

Needs to be used for translating Asc key press values from INKEY$

Fellippe, Petr, Fifi, TempodiBasic might have more experience here than I... if they would like to join the conversation? Or maybe they enjoy watching us twist in the wind of not knowing :D

Anyway, I will try to write a little test code for my theory for you to tell me if it works:

« Last Edit: August 16, 2019, 10:05:08 am by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: HEBREW in QB64 console?
« Reply #18 on: August 16, 2019, 12:27:34 pm »
Man! where was I?

I was right in the middle of posting code when my mouse dies, I start replacing batteries, nothing works. Oh the computer completely frozen.

I shut down, restart and next thing I know I am loading Windows update! The f..

Crap did I save the code? Well a backup restorer came up in QB64 when I restarted, who do I thank for that? Thanks!

Hi Ron,

I have something maybe worked out for English to Hebrew, maybe you tell me.
This code takes the Hebrew symbols made from code you posted earlier and gets from you what symbol you want associated with what key for capital letters A to Z, 26 symbols or 0 if no symbol works.

I convert these associations to DATA statement in _CLIPBOARD that you need to paste back in under the other Hebrew DATA lines, then we can make a better English2Heb translator:

Warning: this overwrites your clipboard contents so if you have anything important in clipboard get it saved before running code.
Code: QB64: [Select]
  1. _TITLE "Get Hebrew symbol data" 'b+ 2019-08-16
  2. _FONT _LOADFONT("C:\Windows\Fonts\Cour.ttf", 20, "MONOSPACE") 'select monospace font
  3.  
  4. RESTORE Microsoft_windows_cp1255 'or restore single DATA field w/o field name
  5. FOR ascii = 128 TO 255 'assign unicode values to ascii 128 to 255 only
  6.     READ unicode&
  7.     IF unicode& = 0 THEN unicode& = 9744 'make undefined characters look like a box
  8.     _MAPUNICODE unicode& TO ascii 'replace ascii with unicode value
  9.  
  10. 'FOR code = 128 TO 255
  11. '    PRINT code; CHR$(code); 'display unicode characters
  12. 'NEXT
  13. 'PRINT
  14.  
  15. 'PRINT "Ron, for each letter you see, type the 3 digit symbol code to the left"
  16. 'PRINT "of the Hebrew symbol you want to see associated with that key."
  17. DIM SHARED dat(1 TO 26) AS INTEGER
  18. FOR a = 65 TO 90
  19.     CLS
  20.     FOR code = 128 TO 255
  21.         PRINT code; CHR$(code); 'display unicode characters
  22.     NEXT
  23.     PRINT: PRINT
  24.     PRINT "Ron, for each letter you see, type the 3 digit symbol code to the left"
  25.     PRINT "of the Hebrew symbol you want to see associated with that key."
  26.     PRINT
  27.     PRINT CHR$(a); " ";
  28.     INPUT "code or 0 > "; code
  29.     dat(a - 64) = code
  30.  
  31. PRINT "OK, now we test Hebrew echo's of input:"
  32.     INPUT "Enter word or phrase (no commas, nothing quits) > "; test$
  33.     eng2heb test$
  34.     PRINT: PRINT
  35. LOOP UNTIL test$ = ""
  36. d$ = "English2Hebrew:" + CHR$(13) + CHR$(10) + "DATA "
  37. FOR i = 1 TO 26
  38.     d$ = d$ + _TRIM$(STR$(dat(i))) + ","
  39. PRINT: PRINT "Please paste the contents of your clipboard into this source program for storage."
  40.  
  41.  
  42. Microsoft_windows_cp1255:
  43. DATA 8364,0,8218,402,8222,8230,8224,8225,710,8240,0,8249,0,0,0,0
  44. DATA 0,8216,8217,8220,8221,8226,8211,8212,732,8482,0,8250,0,0,0,0
  45. DATA 160,161,162,163,8362,165,166,167,168,169,215,171,172,173,174,175
  46. DATA 176,177,178,179,180,181,182,183,184,185,247,187,188,189,190,191
  47. DATA 1456,1457,1458,1459,1460,1461,1462,1463,1464,1465,0,1467,1468,1469,1470,1471
  48. DATA 1472,1473,1474,1475,1520,1521,1522,1523,1524,0,0,0,0,0,0,0
  49. DATA 1488,1489,1490,1491,1492,1493,1494,1495,1496,1497,1498,1499,1500,1501,1502,1503
  50. DATA 1504,1505,1506,1507,1508,1509,1510,1511,1512,1513,1514,0,0,8206,8207,0
  51.  
  52. 'bplus test run pasted from clipboard after match english letters to Hebrew symbols
  53. English2Hebrew:
  54. DATA 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,
  55.  
  56. SUB eng2heb (s$)
  57.     c = _WIDTH
  58.     su$ = UCASE$(s$)
  59.     FOR i = 1 TO LEN(s$)
  60.         LOCATE , c
  61.         ch$ = MID$(su$, i, 1)
  62.         p = INSTR("ABCDEFGHIJKLMNOPQRSTUVWXYZ", ch$)
  63.         IF p > 0 THEN
  64.             IF dat(p) <> 0 THEN PRINT CHR$(dat(p)); ELSE PRINT "*";
  65.         ELSE
  66.             PRINT ch$;
  67.         END IF
  68.         c = c - 1
  69.     NEXT
  70.  

This is what I pasted in for testing, paste your correct version right over it please or let me know what's wrong or not working.
English2Hebrew:
DATA 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,
 
« Last Edit: August 16, 2019, 12:39:17 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: HEBREW in QB64 console?
« Reply #19 on: August 16, 2019, 01:10:21 pm »
Hi Ron,

Wow, that was quick PLUS good news!

OK I need the correct two lines you should have pasted in source for safe keeping storage, otherwise you have to run again and get clipboard contents pasted somewhere so you can copy and pass to me.

Then I can fix inputBack$ function and we might be back in business where we left off last night :)

Oh! are there other keys beside Capital Letters that might also need a Hebrew symbol to show on a keypress?

Update: OK I have to run errands now, be back in a couple hours...
« Last Edit: August 16, 2019, 01:27:46 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: HEBREW in QB64 console?
« Reply #20 on: August 16, 2019, 03:44:13 pm »
bplus listen... there is a problem cause the qwerty of hebrew is different then english in keyboard (for instence Q key in hebrew key is "/") so actually some letters are missing...

at first i didn't realized it and i didn't understand how to use your code now i do and i tell you it wont work...

i think we should stop here :

i made a hebrew chatbot without printback or inputback$ functions and that okay by me...

we made it the best way we could and i thank you for helping me...

here is the hebrew bot post:
https://www.qb64.org/forum/index.php?topic=1623.0

ron77

OK, but it is just a matter of translating key press codes to Hebrew symbols. It would have been nice to go through alphabet in sequence, easier on amount of data to store if we could have used a formula, but not necessary.

Once completed you can use code for other projects and having been completed, you might be eager to take on projects that need similar translating rather than avoid them. :)

On the other hand, it is probably no fun doing this without understanding what is going on. :(