Turkish Language Support

m339

New member
Hello,

As there is no Turkish language support in current version of teensyduino/arduino, I am not able to work with my teensy 3.0 with Turkish Keyboard.
How can I add my own Turkish language keyboard support to my teensy 3.0 ?

Regards,
 
Look in hardware/teensy/cores/teensy3 at the file keylayouts.h. Make a backup of it first, then open in a text editor to see how the various existing keyboards are defined. Make a new section (probably best to copy another keyboard that is similar) then edit. The thing to bear in mind is that the keys are named after the American keyboard layout so for example the top left key is called KEY_TILDE because there is a ~ there on the US layout. In the Turkish keyboard section you define that, for example, KEY_TILDE plus shift gives you é.

You will of course know how a Turkish keyboard is laid out but for other folks reading this thread this is the layout.

If you get it working then post it here as an attachment and if you get stuck, let us know.
 
It just occurred to me that your question could be interpreted two ways. One way (the way I answered) is about making a device using Teensy that acts like a Turkish USB keyboard.

But maybe you meant that your computer keyboard is not supported when you are progrmming? If that is the case then the answer probably involves modifying Java files and Paul would need to ansewr that (its also possible that the support would be better added to the Arduino environment so people not using Teensy would also benefit).
 
Would anyone be willing to put together a list of the Unicode numbers for those special keys (anything that has a Unicode number higher than 255)?
 
But maybe you meant that your computer keyboard is not supported when you are progrmming? ...... its also possible that the support would be better added to the Arduino environment so people not using Teensy would also benefit.

The Arduino IDE already has many translations.

http://playground.arduino.cc/Main/LanguagesIDE

Turkish is "in progress", so not yet in the File > Preferences list. That page has info about contributing to the translations.

Teensyduino does not have any non-English support, but it has relatively few messages that appear.
 
Would anyone be willing to put together a list of the Unicode numbers for those special keys (anything that has a Unicode number higher than 255)?

011E Ğ Latin capital letter G with breve
011F ğ Latin small letter g with breve
0130 İ Latin captial letter I with dot above
0131 ı Latin small letter dotless i
015E Ş Latin capital letter S with cedilla
0151 ş Latin small letter s with cedilla

There are five dead keys for accents shown in red here

Notice that in Turkish (rather logically in fact) the capital form of dotted i is capital dotted i and the lowercase form of I is lowercase dotless i.

Edit: can you believe that the Unicode code charts are in protected PDF so you can't copy paste from them? Hence two edits to this post to correct spelling mistakes, sigh.
 
Last edited:
That page has info about contributing to the translations.

Teensyduino does not have any non-English support, but it has relatively few messages that appear.

Ah yes, that is yet a third meaning of supported (the menus, messages etc are translated). I don't think that was the comment here though, due to the specific mention of the keyboard.
 
Last edited:
OK I just added a Turkish keyboard layout to my Win7, starte up Arduino 1.0.3+Teensyduino 112 and set the keyboard to Turkish. As expected, pressing the [ and ] keys produced "ğü". So a Turkish keyboard is supported in the Arduino environment, at least on Windows. I think "making a Teensy be a Turkish keyboard" was meant.
 
011E Ğ Latin capital letter G with breve
011F ğ Latin small letter g with breve
0130 İ Latin captial letter I with dot above
0131 ı Latin small letter dotless i
015E Ş Latin capital letter S with cedilla
0151 ş Latin small letter s with cedilla

Currently keylayouts.c has 2 arrays, one for code points 0 to 127, and another for 128 to 255. Unicode 20AC (the Euro sign) is handled as a special case. As things exist at the moment, there's no code to map other Unicode numbers to the keycodes.

It seems like most of the non-European keyboards will need only a handful of Unicode mappings, sparsely populating the 16 bit range above 00FF, so a huge array probably is not a good idea. Maybe an array of unicode numbers and keycode pairs would be better? It'll require a search, rather than a quick direct lookup, but maybe that's a reasonable trade-off? I guess the question is whether other layouts people request in the future will need only small numbers of Unicode mappings above 00FF, and how far they'll be distributed over the Unicode 16 bit range?
 
Hello Nantonos, could you share your Turkish keyboard layout please? When i use keyboard println, when i type cmd.exe for example it presses as cmdçexe

Regards,
 
Currently keylayouts.c has 2 arrays, one for code points 0 to 127, and another for 128 to 255. Unicode 20AC (the Euro sign) is handled as a special case. As things exist at the moment, there's no code to map other Unicode numbers to the keycodes.

Aha okay, I saw the ascii and 8859-1 (basic latin) arrays in keylayouts.c and I wasn't sure how € was being handled.

It seems like most of the non-European keyboards will need only a handful of Unicode mappings, sparsely populating the 16 bit range above 00FF, so a huge array probably is not a good idea.

Yes, a huge array is not a good idea, especially as it extends to 10FFFF.

Maybe an array of unicode numbers and keycode pairs would be better? It'll require a search, rather than a quick direct lookup, but maybe that's a reasonable trade-off? I guess the question is whether other layouts people request in the future will need only small numbers of Unicode mappings above 00FF, and how far they'll be distributed over the Unicode 16 bit range?

(Unicode does not have a 16-bit range).

Agreed, since most keyboards have relatively few keys (even with modifier keys included). The keyboards that produce a lot of characters (Japanese, Chinese, Korean) do so in combination with an input method editor (IME) running on the OS, so the actual keyboard part is relatively simple still; the complexity (and large dictionaries) are in the OS.
 
Hello Nantonos, could you share your Turkish keyboard layout please? When i use keyboard println, when i type cmd.exe for example it presses as cmdçexe

What OS are you using and do you have a Turkish keyboard layout installed there (i.e. when you type in a plain text editor, do the right letters come out as printed on the keyboard)?

When I say that I tried a Turkish keylayout, I mean that I switched to that in the OS (Windows 7) while running Arduino, and verified that the correct characters came out according to the Turkish keyboard layout on wikipedia.

keyboards.png
 
Yes, I am using Turkish Keyboard on Windows 7 64 Bit and all Turkish characters works fine except in Arduino.
 
Ok, here's my first attempt at a Turkish layout. This is untested, so expect some problems. I'll try to fix them as they're discovered.

Also, this will NOT support the 6 special characters mentioned above. Those require part of the Keyboard code to be rewritten. First, let's try to get just the other keys working...

To use this, add these lines to hardware/teensy/boards.txt

Code:
teensy3.menu.keys.tr-tr.name=Turkish
teensy3.menu.keys.tr-tr.build.define1=-DLAYOUT_TURKISH

Then add the contents of the attached file to hardware/teensy/cores/teensy3/keylayouts.h

Again, this is untested, and I did it after staying up all night, so it's almost certain to have some errors. Please try to be specific when reporting the problems, and I'll get them fixed.
 

Attachments

  • turkish_experimental.h
    16 KB · Views: 266
This seems to be largely correct. I found two errors (and six omissions, which it is cleaner to add for checking even if the values are not yet supported, and also helped me to find the errors). I guess Paul that you either didn't see, or didn't understand, when I said earlier:
Notice that in Turkish (rather logically in fact) the capital form of dotted i is capital dotted i and the lowercase form of I is lowercase dotless i.
On a Turkish keyboard the I key produces the dotless forms and the @/' key (which has an İ on it) produced the dotted forms.

These two lines are incorrect:
Code:
#define ASCII_69        KEY_I                                   // 105 i
#define ISO_8859_1_E9   ACUTE_ACCENT_BITS + KEY_E               // 233 é     e ACUTE

and should be replaced by these two:
Code:
#define ASCII_69        KEY_QUOTE                               // 105 i
#define ISO_8859_1_E9   KEY_TILDE + SHIFT_BITS                  // 233 é     e ACUTE

while these should be added:
Code:
// not yet implemented
#define UNICODE_011E    KEY_LEFT_BRACE + SHIFT_MASK                // 011E    Ğ    Latin capital letter G with breve
#define UNICODE_011F    KEY_LEFT_BRACE                             // 011F    ğ    Latin small letter g with breve
#define UNICODE_0130    KEY_QUOTE + SHIFT_MASK                     // 0130    İ    Latin captial letter I with dot above
#define UNICODE_0131    KEY_I                                      // 0131    ı    Latin small letter dotless i
#define UNICODE_015E    KEY_SEMICOLON + SHIFT_MASK                 // 015E    Ş    Latin capital letter S with cedilla
#define UNICODE_0151    KEY_SEMICOLON                              // 0151    ş    Latin small letter s with cedilla
 
This keyboard layout is handy as a cheat sheet for the key names. It is derived from the wikipedia US ANSI keyboard layout, with the engraved letters faded out and the key names and modifier names added. This is a PNG since the forum does not allow SVG uploads.

keynames.png
 
and should be replaced by these two:
Code:
#define ASCII_69        KEY_QUOTE                               // 105 i
#define ISO_8859_1_E9   KEY_TILDE + SHIFT_BITS                  // 233 é     e ACUTE

Thanks!

I've updated my copy. This will be included in Teensyduino 1.13.

while these should be added:
Code:
// not yet implemented
#define UNICODE_011E    KEY_LEFT_BRACE + SHIFT_MASK                // 011E    Ğ    Latin capital letter G with breve
#define UNICODE_011F    KEY_LEFT_BRACE                             // 011F    ğ    Latin small letter g with breve
#define UNICODE_0130    KEY_QUOTE + SHIFT_MASK                     // 0130    İ    Latin captial letter I with dot above
#define UNICODE_0131    KEY_I                                      // 0131    ı    Latin small letter dotless i
#define UNICODE_015E    KEY_SEMICOLON + SHIFT_MASK                 // 015E    Ş    Latin capital letter S with cedilla
#define UNICODE_0151    KEY_SEMICOLON                              // 0151    ş    Latin small letter s with cedilla

I'll add these too. However, I'm not planning to implement them this way. It may be a while until I rewrite the keyboard code to support these, and eventually other layouts using more of the unicode space beyond 0x00FF.
 
Thanks!
I've updated my copy. This will be included in Teensyduino 1.13.

Cool.

I'll add these too. However, I'm not planning to implement them this way.

Sounds as if you have some early thoughts on a different method (or are aware of issues with the way € is handled currently) - care to share?

It may be a while until I rewrite the keyboard code to support these, and eventually other layouts using more of the unicode space beyond 0x00FF.

Of course, there is only one of you (I think). It will open up some large markets once completed however (Japan, India, China ... and basically everywhere except for US/Canada/Mexico/Australia/NZ and parts of Europe, which are already covered).
 
Sounds as if you have some early thoughts on a different method (or are aware of issues with the way € is handled currently) - care to share?

I'm planning on a 3rd array of 2-field structs, with each unicode and keycode pair. Initially it'll probably be a linear search for any unicode value >= 0x0100, but if any layouts with a large number of non-latin keys are implemented, it could be changed to a binary search.


It will open up some large markets once completed however (Japan, India, China ... and basically everywhere except for US/Canada/Mexico/Australia/NZ and parts of Europe, which are already covered).

Those may be very large markets in terms of the number of people, but so far very few people from those countries have ever purchased any Teensy board. Still, I'm willing to do them (like I did just do this one)... but with so many other things so many people want (audio, usb host, etc), my general plan is to wait until people ask.
 
When will you release Teensyduino 1.13 ?

Thanks!

I've updated my copy. This will be included in Teensyduino 1.13.



I'll add these too. However, I'm not planning to implement them this way. It may be a while until I rewrite the keyboard code to support these, and eventually other layouts using more of the unicode space beyond 0x00FF.
 
Back
Top