Tuesday, September 7, 2010

How to change the layout of matchbox-keyboard to another language

Unfortunately currently matchbox keyboard supports only on keyboard layout, this is written in README file of package.

Problem statement : We need to load English keyboard layout if the LANG environment variable is set to for example to en_US.UTF-8 and German keyboard layout if LANG is set to de_DE.UTF-8 .

Solution : That to do this we have to do some little coding in matchbox-keyboard.c file.

Change following code

      = (MBKeyboardLayout *)util_list_get_nth_data(kb->layouts, 0);

  char* lang = getenv("LANG");
  if (!strcmp(lang, "en_US.UTF-8")) {
      = (MBKeyboardLayout *)util_list_get_nth_data(kb->layouts, 1);
  } else {
      = (MBKeyboardLayout *)util_list_get_nth_data(kb->layouts, 0);
Also edit the keyboard.xml file to contain English and German keyboard layouts in my case. Approximately with this format.





Sorry for not so detailed instructions ... time is killing ...

Adios !

1 comment:

  1. shit ... xml code is eaten by browser ... so to view is look the sources of page :)