LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   How do I change languages in Mint? (while using OpenOffice mainly) (https://www.linuxquestions.org/questions/linux-desktop-74/how-do-i-change-languages-in-mint-while-using-openoffice-mainly-824352/)

Neyzan 08-05-2010 07:36 AM

How do I change languages in Mint? (while using OpenOffice mainly)
 
I have recently installed Linux Mint (Isadora) on my old -but still functioning- rustbucket of a PC, and its flying again! (Why didn't I leave Windows sooner?) Although I generally don't have many difficulties getting the hang of it, the issue of changing languages has got me beat. I could only find how to change keyboard layouts, but I can't seem to add more than 4 to the list. Now, because I need already 2 layouts for Greek, I am unable to write in all the languages that I need, so I wondered if there exists a button that I could put somewhere to change languages while writing and, if so, how I can add languages and use different layouts for each. Can someone help me?

MTK358 08-05-2010 07:46 AM

What desktop environment?

Neyzan 08-07-2010 04:31 AM

Gnome.

MTK358 08-07-2010 07:26 AM

(Posting from Mint in VirtualBox)

I just checked and it does seem to gray out the Add button when there are 4 layouts. I see no obvious technical reason for this.

But I figured out a way to bypass this supposedly intentional limitation. Here's how:
  1. Run the command gconf-editor in a terminal. A window will come up.
  2. In the tree view in the left side of the window, select / -> desktop -> gnome -> peripherals -> keyboard -> kbd
  3. In the list in the top-right side of the window, double-click on the layouts item.
  4. Here you will be able to add/remove items to the list. Note that you have to know the 2-letter code for the layout.
  5. Click OK.
  6. Done! You can now close gconf-editor.

Note that the extra layouts will not be accessible by clicking on the layout icon in the tray. You have to right-click it and choose it from the pop-up menu.

Neyzan 08-09-2010 03:33 AM

Thank you very much! Do you know if it is also possible to change languages (instead of layouts), so that while writing I can change from one language to another, each with its own layout(s)?

MTK358 08-09-2010 07:22 AM

...I thought that the layout changes the language you type in?

Neyzan 08-19-2010 09:59 AM

Well, yes and no. Some languages have more than one layout (e.g. Greek has one for monotonic and one for polytonic writing, Serbian one for Cyrillic and one for Latin alphabet, etc.). Although turning to a specific layout of course also changes the language, it would be much more easy and organised to be able to change languages and only see and be able to select between the layouts of the active language. In Windows this is standard (language bar), and it is one of the very few features of Windows that I like. Do you know if this is possible to be done in Mint (or any other edition of Linux)?

MTK358 08-19-2010 10:05 AM

Quote:

Originally Posted by Neyzan (Post 4071331)
Do you know if this is possible to be done in Mint (or any other edition of Linux)?

I don't know.

And this has nothing to do with Linux, it has to do with the desktop environment (GNOME in your case).

Neyzan 08-20-2010 07:01 AM

Thanks! There are probably ways to modify a desktop environment, do you know where I could find information about that?

MTK358 08-20-2010 07:09 AM

As I said, I don't know. Either wait for another member to post and/or do some Google searches.

Neyzan 09-04-2010 08:57 AM

I found out today (while trying to write in French) that while it is possible to add new keyboard layouts by using the bypass MTK358 suggested, unfortunately those new layouts (past the first four) do not work. Instead you just get one of the original four (in my case polytonic Greek). I don't understand why the developers of the Gnome version of Mint set such a limitation, and I hope that in future editions multilinguals will be considered and the limitation removed. Meanwhile, can anyone advise me if there is a way to break this limitation of Gnome; or alternatively, if some other edition of Linux does not have this limitation?

MTK358 09-04-2010 10:36 AM

I think that it's just a GNOME limitation, not Mint. And it's intentional.

And did you try switching using the right-click menu, not by left-clicking the icon?

Neyzan 09-07-2010 07:23 AM

Yes, I tried using the right-click menu, but when I clicked French, I got polytonic Greek instead. Possibly Gnome has a built in limitation of four layouts that can't be bypassed (I can't understand why). Maybe I should switch to the KDE version of Mint. Do you know if that hasn't this limitation?

MTK358 09-07-2010 07:33 AM

You don't need to "switch to the KDE version of mint", just install KDE using the package manager (the package is called "kde-full") and you will be able to choose between GNOME and KDE at the login screen.

craigevil 09-07-2010 07:55 AM

You need the openoffice.org-l10n-xxx package for whatever language you want to use in OpenOffice,probably want the appropriate dictionary as well. you also need the appropriate fonts installed.

Choosing language settings - OpenOffice.org Wiki
http://wiki.services.openoffice.org/...guage_settings

For Gnome system>administration>language support you can define a shortcut key to switch languages, then you can do:

Put your mouse on the top panel and right click on 'Add to Panel'.
Next scroll down to Utilities and click on 'keyboard indicator'.
That will allow you to switch between foo and English, if both are set up.

Change the User Interface Language in Ubuntu - How-To Geek
http://www.howtogeek.com/howto/17528...age-in-ubuntu/

Neyzan 09-09-2010 05:13 AM

Thanks, MTK358. I must say, I like KDE better, but my computer does not function as well with it as with Gnome (it's a really old one), so I 'll keep it for when needed.

Thank you also, craigevil. I have the language packages for OpenOffice with their dictionaries and fonts (plus a whole lot more fonts, as I am a font-maniac!).
I couldn't find "system>administration>language support", so I went to language support from the control panel, but I could not find a way to define a shortcut-key. I must say that I am not interested in changing the language that Gnome names files and its functions, utilities, etc., but rather I want to change languages in text (txt, doc, rtf, odt, etc.) while writing. This means I need to change keyboard layouts, but I want them organised by language.
I also couldn't find Utilities in the "Add to Panel" menu...
Do you maybe know the commands for all this?

MTK358 09-09-2010 06:32 AM

Also, you might like to try Xfce. I don't know exactly what Mint package you have to install to get it, but i think you can probably figure it out.

Or, you can use the
Code:

setxkbmap -layout en
command in a terminal (the above example will switch to a US English keyboard).

Just be sure that you somehow will be able to run it again to get back to your normal keyboard! In an extreme case, you can always use a character map application.

Neyzan 09-12-2010 04:09 PM

I just fell in love with the terminal!!! With the command setxkbmap -layout <xx> I was finally able to bypass the limitation of four layouts set by GNOME! Thank you very much, MTK358!
One bit of advice to any who read this and will want to use non-latin layouts: before typing the command setxkbmap -layout ru (I'm using Russian as an example), make sure to type first the command for a latin layout (e.g. setxkbmap -layout fr) and then to switch to the non-latin layout, so that when you will want to switch back to your original layout you will be able to copy-paste the command for the latin layout you typed earlier and then type the command for the layout you want. If you don't do this you won't be able to give any command in the terminal, as it needs commands in latin characters! The only backdraw of this is that you have to memorise the two or three letter code for the languages you want (I'm still trying to figure out the code for Frysian)...

Neyzan 09-13-2010 02:44 PM

There is another small backdraw at the use of the command mentioned at the previous two posts: The layouts set through the GUI are temporarely lost (until restart)...

MTK358 09-13-2010 03:02 PM

I wonder why GNOME decided to do such a stupid thing...

It might be possible to remove that limitation, but that would require getting GNOME's source, modifying it, compiling it, and after all that trouble end up GNOME not being managed by ther package manager.

Neyzan 10-04-2010 05:38 PM

I wonder very much too, I hope in the future this will be fixed...
I must say, I encountered the same limitation using KDE and Xfce. Assuming that it was because although I installed the respective packages the version of Mint remained Gnome (the introductory panel in KDE or Xfce session still stated Linux Mint Gnome), I have started to try out various Linux distros in VirtualBox. Until now I encounter still the same limitation! Is it possible that VirtualBox is influenced by my distro and so sets this limitation? It hardly seems possible. But the only other explanation I have is that besides Gnome also KDE and Xfce have this limitation (which I also find rather unbelievable). I am severely tempted to reformat my drive and install some other distro to see what will happen...

MTK358 10-04-2010 05:57 PM

It's IMPOSSIBLE for VirtualBox to affect this, both for the host and the guest OS.

Neyzan 10-05-2010 01:19 PM

That can only mean the KDE and Xfce have the same limitation! This is really getting very annoying. I will also check LXDE and Fluxbox out, hoping they will have escaped the menace of the four-language-limit. Do you know if there are distros which use their own desktop version and not one of the above?

MTK358 10-05-2010 01:43 PM

It's kind of strange that other desktops would have the same limitation, but who knows. Also, there is no distro with its own custom DE. Maybe it's because they think clicking on the icon to cycle throught more than 4 layouts is a bad idea.

But that gave me an idea: why not write your own layout switcher app? I don't think it would be too difficult to write a small Qt GUI app that has an icon, and would execute the setxkbmap command behind the scenes to actually switch the layout. I just wonder is it would somehow interfere with the DE's layout switcher.

MTK358 10-05-2010 02:04 PM

I made a little example Python script that has a combo box that lets you choose the layout. Try it by putting it in a text file, giving it executable permissions, and running it. Make sure you have PyQt4 installed (the Mint package "pyqt4-dev-tools").

Code:

#!/usr/bin/env python
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import sys

app = QApplication(sys.argv)

combo = QComboBox()

# the first string is the text visible in the combo box, the second is the code passed to "setxkbmap -layout".
combo.addItem('US English', 'us')
combo.addItem('Russian', 'ru')

def layoutSelected(index):
    layout = str(combo.itemData(index).toString())
    command = 'setxkbmap -layout %s' % (layout)
    QProcess.startDetached(command)

    # uncomment the following line and change the path to your xmodmap file if you use one
    # QProcess.startDetached("xmodmap /home/username/.Xmodmap")

QObject.connect(combo, SIGNAL('activated(int)'), layoutSelected)

combo.show()
sys.exit(app.exec_())

Don't worry, I tested it!

Neyzan 10-10-2010 10:14 AM

Great idea!!! Thank you, MTK358!!! I will get to it right away (of course, as I am inexperienced in app-writing, it will take me some time). When I have made something satisfactory I will upload it and tell you about it...
By the way, I tried LXDE, but it is even worse than the rest. The only way to change layouts is with the setxkbmap-command...

MTK358 10-10-2010 10:20 AM

If you want to try writing it yourself, learn Python and PyQt4 first:

http://docs.python.org/tutorial/

http://zetcode.com/tutorials/pyqt4/
http://www.rkblog.rk.edu.pl/w/p/introduction-pyqt4/

Note that Qt is actually a C++ toolkit and PyQt4 is just a set of bindings, but Python is a far easier language for beginners. Also there's the GTK+ toolkit, but I think that Qt is much easier to work with and has friendlier documentation.

And you can always ask here for help.

Neyzan 10-10-2010 11:32 AM

Thank you very much, MTK358. I will get right to it...
By the way, I tried your example Python script, it works beautifully! (of course, you temporarily lose the layouts you have set through the DE's layout switcher, until reboot)

MTK358 10-10-2010 07:44 PM

I just wanted to point out a flaw in my example app:

I used QProcess.startDetached(), which doesn't wait for the clild process to exit before continuing, and that might interfere with the fact that another process wll simultaneously be started if you use the xmodmap and that might have unpredictable results.

You should probably use Python's os.system() (be sure to import os first), which waits for the child process to exit before returning, instead of PyQt4's QtCore.QProcess.startDetached().

MTK358 10-19-2010 08:10 AM

Any progress?

Neyzan 10-23-2010 11:12 AM

Unfortunately I didn't have the time to really set my mind to it the last weeks, it was a very busy time. Next month will be hopefully a little bit less hectic, so that I will have the time to get to it...

Neyzan 02-29-2012 01:18 PM

Issue Update
 
I noticed that in KDE 4 you have the ability to use more that 4 layouts. To activate this just check the "Spare Layouts" box in "System Settings>Input Devices>Keyboard>Layouts" and add any extra layouts you want. These spare layouts can only be accessed by right-clicking on the layout button in the system tray (or if you assign a shortcut key combination to a layout).
Still no solution in Gnome 3. I really have to sit down and write a program for this (even in KDE -although a big improvement of course- I still don't find it very well organised), but it's not easy to find the time when trying to live in practically bankrupt Greece...

fammily 07-03-2012 05:24 PM

change language while writing
 
I have Linux mint 13 Maya:
how can I change language while writing from en to Russian or Arabia


All times are GMT -5. The time now is 06:14 PM.