Ask Your Question

How to make LibreOffice Writer change keyboard language automatically to match surrounding text?

asked 2016-02-02 07:23:57 +0200

jasonlibreoffice gravatar image

There is an option in MS Word's Advanced options, "Automatically switch keyboard to match language of surrounding text" that does just this. By selecting it, one does not have to manually change keyboard language via Alt+Shift. It is very handy for those who switch between two languages a lot, especially if one of them is CTL (Persian in my case). For more information on what I mean, see Is there an option in LibreOffice Writer to enable this feature so I don't have to manually change keyboard language frequently?

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2017-11-01 17:04:36 +0200

Jim K gravatar image

No, but it would be a good feature. Consider filing an enhancement request. Automatic keyboard switching is possible to implement cross-platform, for example SIL FieldWorks.

To others who know more about Ask LO than I do -- this question was already asked. Should this be flagged as a duplicate?

edit flag offensive delete link more

answered 2017-11-01 18:48:39 +0200

Lupp gravatar image

You may also want to read this older thread on the question which was unnecessarily closed.

As there isn't such a feature, next question may be if it can be established based on user code.
There was a thread recently (concerning localized dates) to which I contributed the following piece of user code in BASIC:

Function getCurrentCharLocale(pDoc)
theCtrl = pDoc.CurrentController
theVC   = theCtrl.GetViewCursor
theLoc  = theVC.CharLocale
REM If the current selection is not unambiguous regarding the Locale then
REM TypeName(theLoc) = "Empty".
REM Otherwise a CharLocale has three attributes: .Language .Country .Variant
REM A collapsed ViewCursor ("Caret") should always return non-empty CharLocale except
REM it was actually set empty (no language).
getCurrentCharLocale = theLoc  
End Function

The .CharLocale property is a structure containing the properties .Language .Country and .Variant.
Based on this info you will need to call a script for changing the keyboard settings. How to do so will depend on the Operating System - if possible at all. It's not my field.

edit flag offensive delete link more


How would getCurrentCharLocale be called -- based on some kind of Writer event, perhaps whenever the view cursor gets moved? It should be automatic.

Jim K gravatar imageJim K ( 2017-11-02 17:15:06 +0200 )edit

answered 2017-11-01 07:28:51 +0200

KH gravatar image

Looks like the question has been answered over there: no. Given that LibreOffice is designed to be cross-platform, I wouldn't expect such a feature to exist.

edit flag offensive delete link more


@KH why not?

Denis J Navas gravatar imageDenis J Navas ( 2017-11-01 08:45:29 +0200 )edit

Because it's complex (language and keyboard are not a one-to-one mapping, etc.) and has to be done differently on every operating system. But maybe I'm just being pessimistic ;-)

KH gravatar imageKH ( 2017-11-02 04:04:21 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-02-02 07:23:35 +0200

Seen: 2,045 times

Last updated: Nov 01 '17