TIP Openoffice and dead keys
From Gentoo Linux Wiki
| Terminals / Shells • Network • X Window System • Portage • System • Filesystems • Kernel • Other |
[edit] Introduction
OpenOffice needs the default system locale to be UTF-8 compliant to recognize some dead keys. For example to make with slovak keyboard some of accents with shift + '+' + c, to make č .
For slovak language you can :
localedef -i sk_SK -f UTF-8 sk_SK.UTF-8 export LC_ALL="sk_SK.UTF-8" swriter
OpenOffice can easily be setup for western european languages on a US or other keyboard by using the deadkeys in X. This works not only for openoffice but most other programs which use X. For example, evolution and gaim work well for accents and other special characters by using deadkeys.
[edit] Set Language Setting
Localedef command creates utf-8 compliant locale from sk_SK locale. You can try at first without generation, but open office will probably complain about missing locale.
You can make the export statement permanent by adjusting the proper file in /etc/env.d/.
Check if you allready have the setting somewhere. (ex. /etc/env.d/02locales)
find /etc/env.d/ -type f | xargs grep LC_ALL
Otherwise create a file with the name ##locales.
| File: /etc/env.d/02locales Example for Dutch language |
LANG="nl_BE" LC_ALL="nl_BE.UTF-8" |
After doing so update your environment by running
env-update
[edit] Remember
- Do not forget you need to execute source /etc/profile for every terminal that is not new.
- To get it working without having to run openoffice from a terminal, you might want to restart your x.
- If you start X manually, don't forget to run source /etc/profile again
[edit] Using Dead Keys
First you need to check your xorg.conf settings. You must check to make sure the following line is either commented or does not exist :
under the Section "InputDevice" Option "XkbVariant" "nodeadkeys"
The second step is setting up the actual deadkeys. You need to change your keyboard mappings first. To save the list of current keymappings to a file(keymappings) use the following command:
xmodmap -pke > keymappings
The keymappings file will contain a list of the keycodes and the correspoding characters. Every keycode has four possible mappings: normal, shifted, modified and modified shifted. To use dead keys you only need to worry about normal and shifted. Using a deadkey means that if you press the key once and a letter(a, for example) the letter receives and accent. If you press the key again, the original key character appears. For example to do accents or the ñ character in spanish two deadkeys are needed. One for the accent and one for the tilde over the ñ. On my us keyboard I set keycode 49 like so:
keycode 49 = dead_acute dead_tilde
This key on the us keyboard is the grave and tilde. By pressing the key unshifted and then a letter I get an acute accent. So:
´+a=á
If I use the tilde and n:
~+n=ñ
This can be modified for many characters including acute and grave accents, diaeresis, tildes, and circumflex. See How to Handle Special Characters in OpenOffice.org for more information.
After changing the keymappings to your liking you need to make X use them. I renamed the file keymappings(the file I changed) to .Xmodmap so it's hidden. You then have to add the following at the beginning of your .xinitrc file in your home directory:
usermodmap=$HOME/.Xmodmap
if [ -f "$usermodmap" ]; then
xmodmap $usermodmap
fi
Lots of information taken from How to Handle Special Characters in OpenOffice.org.
This article is still a Stub. You can help Gentoo-Wiki by expanding it.
