Shortcut for changing language?

The problem I initially faced is the exact opposite of this one. Using LibreOffice 3.5 on Linux (Mint 13), when I switch keyboard language between EN and GR (I suppose it’s the same for all other non-latin alphabet languages) the “input language” in Libre Office doesn’t change, which means that my GR text is considered EN or vice-versa. Given that the solutions proposed to similar questions so far don’t work (Xneur doesn’t recognize GR, and apparently there’s no way to connect the system language to the document language in Linux, which is strange because that’s exactly what happens in Windows), I decided to try a different approach and create a shortcut for switching languages, so that I don’t have to manually select each and every EN word that pops up in a GR document (or vice versa). Unfortunately although I navigated through the multitude of categories and functions under Customize/keyboard, I’ve yet to find a “switch/change” languages command.

Can anyone help me create a keyboard shortcut for the command “switch/change language” in Libre office?

See also → How can I auto-switch between languages in LibreOffice on Debian Linux?

That’s an “Windows-only” feature, see:

(1) http://www.openoffice.org/specs/appwide/linguistic/ → Set_Language_Attribute_for_Text.odt

1.5 Set Text Language to Input Language Automatically … (page 12)

(2) OOo issue 1035

You may create a macro (via "Record Macro") with these steps (mouse clicks):

Menu "Tools → Language → For Selection → Language xyz"

(repeat it for each needed language).

Assign each macro to a shortcut key

(I have used Ctrl+Shift+6, …, Ctrl+Shift+9,

see also: Special characters - #3 by manj_k).

Apply the corresponding shortcut key to switch the language while typing …

Sample

Recorded macro "Language → For Selection → French" (assigned to Ctrl+Shift+8):

sub select_fr
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Language"
args1(0).Value = "Current_French (France)"

dispatcher.executeDispatch(document, ".uno:LanguageStatus", "", 0, args1())

end sub
1 Like

~via.

As the other answer, this is about creating macros for each language and starting the macro with shortcuts.

  • Enable recording macros.

3.5.x
Menu Tools > Options > LibreOffice > General
:ballot_box_with_check: Enable experimental (unstable) features.

4.0.x
Menu Tools → Options → LibreOffice → Advanced
Optional (unstable) options
:ballot_box_with_check: Enable macro recording

More here.

  • Tools > Macros > Record macro

  • Select text, then go to Tools > Language, and chose the way you want the language to be applied with that specific macro: For selection, For paragraph or For all text - and chose the language. Then click ‘Stop recording’ in the floating window that appeared. An window should open to save the macro with a specific name. Do the same for different languages.

  • To assign shortcuts to each macro go to Tools > Customize > Keyboard, select the shortcut keys, and under Functions > Category > Libreoffice macros - etc - select the macro (as seen in the image below) and click modify.

Then click OK and you’re done.

1 Like