grub.d/xen.cfg: fix default entry when using l10n
authorHans van Kranenburg <hans@knorrie.org>
Wed, 20 Dec 2017 10:38:14 +0000 (11:38 +0100)
committerHans van Kranenburg <hans@knorrie.org>
Wed, 2 Jan 2019 19:59:36 +0000 (20:59 +0100)
When a user uses a locale that results in translating menu item titles
into another language than English, the hardcoded "Debian GNU/Linux,
with Xen hypervisor" would not match anything.

So, use gettext to make it match the right translated entry.
Also see
- https://bugs.launchpad.net/ubuntu/+source/xen/+bug/1321144
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=865086

Note that (thanks Ian for the info):
* When GRUB_TERMINAL is not empty and set to anything other than
  `gfxterm', grub will not do translation at all, because grub-mkconfig
  thinks that other GRUB_TERMINAL values including `serial' preclude
  non-ASCII characters, and that causes it to set LANG=C. (I have
  GRUB_TERMINAL="serial console", which caused much confusion when
  trying to test all of this).
* Just trying the printf "$(gettext... below is not enough to test if a
  translation shows up. It needs -d grub additionally for gettext, or
  TEXTDOMAIN=grub in the environment, which is probably present when
  this file gets run by update-grub.

Signed-off-by: Hans van Kranenburg <hans@knorrie.org>
debian/tree/xen-hypervisor-common/etc/default/grub.d/xen.cfg

index b2d2f6ee9323fb634b1ac22532d9a8876167cca5..c16e65706728098379c62c00c2fd57212e40c3a6 100644 (file)
@@ -50,5 +50,7 @@ if [ "$XEN_OVERRIDE_GRUB_DEFAULT" = "" ]; then
        XEN_OVERRIDE_GRUB_DEFAULT=1
 fi
 if [ "$XEN_OVERRIDE_GRUB_DEFAULT" = "1" ]; then
-       GRUB_DEFAULT="Debian GNU/Linux, with Xen hypervisor"
+       GRUB_DEFAULT=$( \
+               printf "$(gettext "%s, with Xen hypervisor")" \
+               "$GRUB_DISTRIBUTOR GNU/Linux")
 fi