Adds gettext support in Grub. Building system needs to be improved and maybe userland utilites improved.

YYYY-MM-DD  Carles Pina i Estany <carles@pina.cat>

	* Makefile.in: Add uptrans target to help to update .pot file
	* conf/common.rmk: Add grub-gettext_lib target, dependency and SOURCES, CFLAGS, LDFLAGS
	* kern/misc.c: Define grub_gettext symbol and add implement grub_gettext_dummy function
	* po/TODO: Temporary file with instructions of what Makefile.in will do
	* po/ca.po: Catalan translation stub
	* include/grub/misc.h: Define macro _(char *s). Declare grub_gettext_dummy and grub_gettext
	* gettext/gettext.c: New file with gettext implementation
	* normal/menu.c (print_message): add _( ) to some strings
	* util/grub.d/10_linux.in: include grub-gettext_lib file. For the Linux menuentry, call eval_gettext
	* util/grub.d/00_header.in: add locale_prefix and gettext locale detection and setting up the access to the mo directory
	* util/grub-mkconfig_lib.in: add get_locale_lang
	* util/grub-gettext_lib.in: new file
This commit is contained in:
Carles Pina i Estany 2009-11-13 20:39:33 +00:00
parent 2e035eb9ba
commit 203ffbfa31
9 changed files with 368 additions and 8 deletions

View file

@ -22,6 +22,7 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
grub_prefix=`echo /boot/grub | sed ${transform}`
locale_prefix="/usr/share/locale" # TODO: dynamic with exec_prefix ?
. ${libdir}/grub/grub-mkconfig_lib
@ -100,6 +101,21 @@ EOF
;;
esac
if test -e ${grub_prefix}/gettext.mod -a -d /usr/share/locale; then
# Make the locales accesible
prepare_grub_to_access_device `${grub_probe} --target=device ${locale_prefix}`
lang=`get_locale_lang`
grub_locale_prefix=`make_system_path_relative_to_its_root ${locale_prefix}`
cat << EOF
# Gettext variables and module
set locale_prefix=${grub_locale_prefix}
set lang=${lang}
insmod gettext
EOF
else
echo "gettext module or /usr/share/locale is not available"
fi
if [ "x${GRUB_HIDDEN_TIMEOUT}" != "x" ] ; then
if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
verbose=

View file

@ -95,11 +95,11 @@ while [ "x$list" != "x" ] ; do
linux_root_device_thisversion=${GRUB_DEVICE}
fi
linux_entry "${OS}, with Linux ${version}" \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
linux_entry $eval_gettext ("${OS}, with Linux ${version}" \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}")
if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then
linux_entry "${OS}, with Linux ${version} (recovery mode)" \
"single ${GRUB_CMDLINE_LINUX}"
linux_entry $eval_gettext ("${OS}, with Linux ${version} (recovery mode)" \
"single ${GRUB_CMDLINE_LINUX}")
fi
list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`