Detecting current Keyboard layout in English
Michael Meeks
michael.meeks at suse.com
Mon Apr 15 00:09:54 PDT 2013
Hi Pantelis,
On Sat, 2013-04-13 at 21:01 +0300, Pantelis Koukousoulas wrote:
> As you know, in Windows libreoffice detects the current input language
> and can change the current document language accordingly (assuming
> the user wants this). This works great for language pairs like english/greek
> that use different alphabets / layouts.
Right :-)
> It would be nice to have this functionality in Linux as well. I don't believe
> it will solve all spellchecking issues (e.g., it will still be
> desirable to be able to do trigram-based language detection per word as well),
> but it would be a step in the right direction.
Sounds like a great innovation.
> So, I think this comes down to having a way to be notified about a change
> in the keyboard layout and to get the current layout for each backend
> so that GetInputLanguage() in the SalFrame backends of Linux will
> return something better than LANGUAGE_DONTKNOW. It seems to
> me that nowadays we could do this using dbus.
>
> For KDE:
> in vcl/unx/kde4/KDESalFrame.cxx:
> -> It should listen for "currentLayoutChanged()" signal and use
...
> For GNOME:
> in vcl/unx/gtk/window/gtkframe.cxx:
> -> The list of available layouts can be found in
> org.gnome.desktop.input-sources sources.
It sounds reasonable to me.
> -> So, it should be possible to subscribe to the changed
> event for this key.
I like the approach of asking once, and then having a local state
synchronised with a signal.
> Does this sound like a reasonable plan, is there something
> I have misunderstood in how input language detection works
> in libreoffice?
It's likely that there is no expert here that knows more than you from
your great code reading & research - so I'd just go for it !
The only trick here is which dbus API to use for maximum cross-platform
goodness; I think the answer is either dbus-glib or raw dbus - GDBus is
not usable for dependency reasons: we have to build / run on very old
systems :-)
Otherwise - I'd say go for it ! and it's a shame (of course) that there
is (apparently) no cross-desktop standard for that stuff.
Thanks !
Michael.
--
michael.meeks at suse.com <><, Pseudo Engineer, itinerant idiot
More information about the LibreOffice
mailing list