Recent

Author Topic: How to load other language keyboards?  (Read 9120 times)

Avishai

  • Hero Member
  • *****
  • Posts: 1021
How to load other language keyboards?
« on: March 13, 2011, 12:05:18 am »
How do you load another language keyboard like Russian or German?
« Last Edit: March 14, 2011, 10:16:03 am by Avishai »
Lazarus Trunk / fpc 2.6.2 / Win32

ik

  • Jr. Member
  • **
  • Posts: 88
  • ik
    • LINESIP
Re: How to load other language keyboard?
« Reply #1 on: March 13, 2011, 09:05:40 am »
It's not a trivial question. Not only that each system acts different, but each widget also depends on the graphic server/engine it is working on, if it support it at all.

I wrote back in 2002/3 (wow how time fly) for Delphi a component called TLanguageChanger for that, but it's Windows only, but if you already on this, please make it a more cross platform way, and port it to Lazarus as well :P


Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: How to load other language keyboard?
« Reply #2 on: March 13, 2011, 09:22:59 am »
In Delphi it's simple. ActivateKeyboardLayout(LangNum,0).  That's all it takes, but it's Windows only.  I've look everywhere I can think of to find code that is more generic, but so far I have found nothing.  Right now I'm using

{$ifDef Win}
ActivateKeyboardLayout(LangNum,0);
{$EndIf}

At first it wasn't an issue. My client said that all their machines were on Windows, but now things have changed so I have to find a solution.  If and when I find it, I will be sure to post it for other Lazarus users.  I'm sure Lazarus must have something but I haven't found it.
« Last Edit: March 13, 2011, 11:48:36 am by Avishai »
Lazarus Trunk / fpc 2.6.2 / Win32

ik

  • Jr. Member
  • **
  • Posts: 88
  • ik
    • LINESIP
Re: How to load other language keyboard?
« Reply #3 on: March 13, 2011, 03:56:55 pm »
For Linux/Unix you can finish the binding for xkb I've stared that support it (or just translate what is require).

I do not know anything about Mac though and other GUI environment.

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: How to load other language keyboard?
« Reply #4 on: March 13, 2011, 05:07:40 pm »
This is starting to look like a very serious problem.  If you can't load keyboards for other languages, you can't  internationalize your software.  That's a huge hole in any programming language.
Lazarus Trunk / fpc 2.6.2 / Win32

DirkS

  • Sr. Member
  • ****
  • Posts: 251
Re: How to load other language keyboard?
« Reply #5 on: March 13, 2011, 05:18:54 pm »
Quote
If you can't load keyboards for other languages, you can't  internationalize your software.
Why? I would say that normally keyboard layouts, etc are dealt with by the OS. Application software should not have to be bothered by this...

Gr.
Dirk.

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: How to load other language keyboard?
« Reply #6 on: March 13, 2011, 05:37:51 pm »
Presently I am working on a form that requires input from the user in different languages depending on which field they are in.  In Delphi I can set the input language in the OnEnter event by loading the appropriate keyboard.  If I can't load the Keyboard Layout, I can't do this.  This is not an unusual task.  Many programs are bi-lingual.
« Last Edit: March 14, 2011, 08:56:34 pm by Avishai »
Lazarus Trunk / fpc 2.6.2 / Win32

avra

  • Hero Member
  • *****
  • Posts: 2584
    • Additional info
Re: How to load other language keyboards?
« Reply #7 on: March 14, 2011, 11:23:26 am »
Until permanent solution is found, maybe you can mimic keystrokes that set specific keyboard?
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

ik

  • Jr. Member
  • **
  • Posts: 88
  • ik
    • LINESIP
Re: How to load other language keyboards?
« Reply #8 on: March 15, 2011, 09:57:46 am »
Avishai, language layout is not an operating system issue, or a programming language issue, but an environment issue.

Most operating systems are not GUI based, and only execute programs that are build for them that does the rest, such as Linux, BSD and more.

Windows have a lot of tools that "helps" you in one way but cripples you on another way.
You are looking for a one liner that will do everything, and it's not like that at all even on Windows.

As I suggested you, write a tool that will help everyone to do what you are looking for, because you are now working on this issue that can help almost everyone here, that's how you create a Delphi like tool to be cross platform and do what you like, and if you'll release it under LGPL or something like that, we all can use it as well, and even add things to it, and change things etc, and everyone win.

So instead of looking "there is" and "there isn't", you should look at how you can make it "there is" when "there isn't".

My 2 Cents.

Ido

 

TinyPortal © 2005-2018