Subject: Re: [bug#35394] [PATCH 3/3] system: Use locale information in grub.cfg.

From: Miguel Arruga Vivas <[email-masked]>
Date: Mon, 21 Oct 2019 12:46:32 +0200

* gnu/bootloader/grub.scm (define-module): Add new dependency.
(grub-configuration-file)[locale-config]: New variable with generated
locale configuration when locale parameter has been provided.
[builder]: Add locale-config.
---
 gnu/bootloader/grub.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
From c5f4f7d0d3564731dc29f563b70a05ab83eec061 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
 <[email-masked]>
Date: Sat, 19 Oct 2019 13:28:48 +0200
Subject: [PATCH 3/3] system: Use locale information in grub.cfg.

* gnu/bootloader/grub.scm (define-module): Add new dependency.
(grub-configuration-file)[locale-config]: New variable with generated
locale configuration when locale parameter has been provided.
[builder]: Add locale-config.
---
 gnu/bootloader/grub.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index a0d068d1bd..8c3bab6fa7 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016 Chris Marusich <[email-masked]>
 ;;; Copyright © 2017 Leo Famulari <[email-masked]>
 ;;; Copyright © 2017 Mathieu Othacehe <[email-masked]>
+;;; Copyright © 2019 Miguel Ángel Arruga Vivas <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -28,6 +29,7 @@
   #:use-module (gnu system uuid)
   #:use-module (gnu system file-systems)
   #:use-module (gnu system keyboard)
+  #:use-module (gnu system locale)
   #:autoload   (gnu packages bootloaders) (grub)
   #:autoload   (gnu packages gtk) (guile-cairo guile-rsvg)
   #:autoload   (gnu packages xorg) (xkeyboard-config)
@@ -353,6 +355,20 @@ entries corresponding to old generations of the system."
                #:system system
                #:port #~port))
 
+  (define locale-config
+    #~(let ((locale #$(and locale
+                           (locale-definition-source
+                            (locale-name->definition locale)))))
+        (when locale
+          (format port "\
+# Localization configuration.
+if search --file --set boot_partition /grub/grub.cfg; then
+    set locale_dir=(${boot_partition})/grub/locale
+else
+    set locale_dir=/boot/grub/locale
+fi
+set lang=~a~%" locale))))
+
   (define keyboard-layout-config
     (let ((layout (bootloader-configuration-keyboard-layout config))
           (grub   (bootloader-package
@@ -372,6 +388,7 @@ keymap ~a~%" keymap)))))
 # will be lost upon reconfiguration.
 ")
           #$sugar
+          #$locale-config
           #$keyboard-layout-config
           (format port "
 set default=~a
-- 
2.23.0