Revision bc64b83...

Go back to digest for 27th October 2013

Features in KDE Base

Konstantinos Smanis committed changes in [kcm-grub2] /:

*ADDED: Translation support for the GRUB menu.

There are two translatable points in GRUB:
1. The GRUB menu which is shown when booting. To be more specific, this
includes /only/ the instructions shown below the rectangular frame
containing the menu. This translation is triggered with a
'set lang=foobar' command in the GRUB menu file (/boot/grub/grub.cfg
by default), where foobar is a translation catalog (*.mo) contained
in the GRUB locale dir (/boot/grub/locale by default). The above
command is usually generated by scripts in the /etc/grub.d/
directory which process the 'LANG' [environment] variable.
2. The strings found in the GRUB menu file. To be more specific, this
includes entries' titles, echo commands etc. These strings are
generated by grub-mkconfig. This translation is triggered with the
'LANGUAGE' [environment] variable.

The above variables can be either set in the environment running
grub-mkconfig or in GRUB's configuration file (/etc/default/grub by
default) for a more permanent effect.

Unfortunately, after extensive testing in various distributions (Debian,
Kubuntu, Fedora, openSUSE) there are some limitations concerning the
use of these variables:
1. LANGUAGE should be set exclusively from the list of translation
catalogs in GRUB's locale dir.
2. LANG should be set exclusively from the list of locales as returned
by 'locale -a'.

If LANG is not an available locale, LANGUAGE will be cancelled out. So,
in order for a full translation of the GRUB boot menu, we set LANGUAGE
to a proper locale, use the user's current locale as LANG (it will be
later manually overwritten so we don't mind; we just want a locale that
truely exists) and finally 'set lang=' with the same locale we used in

This is not a very clean solution, but up to this point this is the best
I could make out from this situation that could work on as many distros
as possible. If anyone has more information on this, please let me know.

File Changes

Modified 8 files
  •   config.h.cmake
  •   src/common.h
  •   src/kcm_grub2.cpp
  •   src/kcm_grub2.h
  •   ui/kcm_grub2.ui
  •   cmake/modules/GRUBPaths.cmake
  •   src/helper/helper.cpp
  •   src/helper/helper.h
8 files changed in total