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:
parent
2e035eb9ba
commit
203ffbfa31
9 changed files with 368 additions and 8 deletions
23
util/grub-gettext_lib.in
Normal file
23
util/grub-gettext_lib.in
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Configuration of grub-gettext
|
||||
# Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# GRUB is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# GRUB is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
|
||||
TEXTDOMAINDIR=@prefix@/share/locale
|
||||
TEXTDOMAIN=grub
|
||||
. gettext.sh
|
|
@ -215,3 +215,14 @@ version_find_latest ()
|
|||
done
|
||||
echo "$a"
|
||||
}
|
||||
|
||||
get_locale_lang ()
|
||||
{
|
||||
lang="`echo ${LANG} | cut -d _ -f 1`"
|
||||
if [ "x${lang}" = "x" ] ; then
|
||||
return 1
|
||||
else
|
||||
echo "${lang}"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -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=
|
||||
|
|
|
@ -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' ' '`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue