unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Miguel Ángel Arruga Vivas" <rosen644835@gmail.com>
To: 35394@debbugs.gnu.org
Subject: [bug#35394] [PATCH 1/1 v4] Grub i18n
Date: Sun, 11 Oct 2020 16:18:41 +0200	[thread overview]
Message-ID: <87ft6k7sn2.fsf@gmail.com> (raw)
In-Reply-To: <20190423151702.05258473@gmail.com> (Miguel's message of "Tue, 23 Apr 2019 15:17:02 +0200")

[-- Attachment #1: Type: text/plain, Size: 288 bytes --]

Hi,

This is the latest version of the patch, that could be applied to
master.

They have been reduced to one patch, and as on previous versions of this
series of patches only the grub messages are translated, not the menu
entries generated by guix (yet).

WDYT?

Best regards,
Miguel
--

[-- Attachment #2: 0001-service-add-locale-to-grub.patch --]
[-- Type: text/x-patch, Size: 9680 bytes --]

From 885a7c167faafa295b0f3edaae1ee456eacf1e63 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
 <rosen644835@gmail.com>
Date: Sat, 2 Nov 2019 18:18:45 +0100
Subject: [PATCH] system: Use locale information in grub.cfg.

* gnu/bootloader/grub.scm (define-module): Add new dependency.
(grub-configuration-file): Add locale keyword.
(grub-configuration-file)[locale-config]: New variable with generated
locale configuration when locale parameter has been provided.
[builder]: Add locale-config.
* gnu/machine/ssh.scm (roll-back-managed-host): Use locale information
from boot-parameters.
* gnu/system.scm (define-module)[export]: Add boot-parameters-locale.
(<boot-parameters>)[locale]: New field.
[boot-parameters-locale]: New accessor.
(read-boot-parameters): Read locale field.
(operating-system-boot-parameters): Provide operating-system locale to
oboot-parameters record.
(operating-system-boot-parameters-file): Likewise.
(operating-system-bootcfg): Provide locale information to the bootloader.
* guix/system/script.scm (reinstall-bootloader): Likewise.
---
 gnu/bootloader/grub.scm | 18 ++++++++++++++++++
 gnu/machine/ssh.scm     |  3 +++
 gnu/system.scm          | 13 +++++++++++++
 guix/scripts/system.scm |  2 ++
 4 files changed, 36 insertions(+)

diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 516a7d48c8..611580a350 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2017 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2017, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2019, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2019 Miguel Ángel Arruga Vivas <rosen644835@gmail.com>
 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2020 Stefan <stefan-guix@vodafonemail.de>
 ;;;
@@ -33,6 +34,7 @@
   #:use-module (gnu system uuid)
   #:use-module (gnu system file-systems)
   #:use-module (gnu system keyboard)
+  #:use-module (gnu system locale)
   #:use-module (gnu packages bootloaders)
   #:autoload   (gnu packages gtk) (guile-cairo guile-rsvg)
   #:autoload   (gnu packages xorg) (xkeyboard-config)
@@ -334,6 +336,7 @@ code."
 
 (define* (grub-configuration-file config entries
                                   #:key
+                                  (locale #f)
                                   (system (%current-system))
                                   (old-entries '())
                                   store-directory-prefix)
@@ -398,6 +401,20 @@ menuentry ~s {
                  #:store-directory-prefix store-directory-prefix
                  #: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
@@ -422,6 +439,7 @@ keymap ~a~%" #$keymap))))
 # will be lost upon reconfiguration.
 ")
           #$(sugar)
+          #$locale-config
           #$keyboard-layout-config
           (format port "
 set default=~a
diff --git a/gnu/machine/ssh.scm b/gnu/machine/ssh.scm
index 35b42add48..72ba6bfacf 100644
--- a/gnu/machine/ssh.scm
+++ b/gnu/machine/ssh.scm
@@ -484,11 +484,14 @@ an environment type of 'managed-host."
                                             (drop boot-parameters 2)))
                        (bootloader -> (operating-system-bootloader
                                        (machine-operating-system machine)))
+                       (locale -> (boot-parameters-locale
+                                   (second boot-parameters)))
                        (bootcfg (lower-object
                                  ((bootloader-configuration-file-generator
                                    (bootloader-configuration-bootloader
                                     bootloader))
                                   bootloader entries
+                                  #:locale locale
                                   #:old-entries old-entries)))
                        (remote-result (machine-remote-eval machine remote-exp)))
     (when (eqv? 'error remote-result)
diff --git a/gnu/system.scm b/gnu/system.scm
index ab1b0ff3de..32e0eeaf17 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2019 Meiyo Peng <meiyo.peng@gmail.com>
+;;; Copyright © 2019 Miguel Ángel Arruga Vivas <rosen644835@gmail.com>
 ;;; Copyright © 2020 Danny Milosavljevic <dannym@scratchpost.org>
 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
 ;;; Copyright © 2020 Florian Pelz <pelzflorian@pelzflorian.de>
@@ -147,6 +148,7 @@
             boot-parameters-kernel-arguments
             boot-parameters-initrd
             boot-parameters-multiboot-modules
+            boot-parameters-locale
             read-boot-parameters
             read-boot-parameters-file
             boot-parameters->menu-entry
@@ -291,6 +293,7 @@ directly by the user."
    boot-parameters-bootloader-menu-entries)
   (store-device     boot-parameters-store-device)
   (store-mount-point boot-parameters-store-mount-point)
+  (locale           boot-parameters-locale)
   (kernel           boot-parameters-kernel)
   (kernel-arguments boot-parameters-kernel-arguments)
   (initrd           boot-parameters-initrd)
@@ -368,6 +371,11 @@ file system labels."
          ((_ args) args)
          (#f       '())))
 
+      (locale
+       (match (assq 'locale rest)
+         ((_ locale) locale)
+         (#f         #f)))
+
       (store-device
        ;; Linux device names like "/dev/sda1" are not suitable GRUB device
        ;; identifiers, so we just filter them out.
@@ -1214,6 +1222,7 @@ a list of <menu-entry>, to populate the \"old entries\" menu."
   (let* ((file-systems    (operating-system-file-systems os))
          (root-fs         (operating-system-root-file-system os))
          (root-device     (file-system-device root-fs))
+         (locale          (operating-system-locale os))
          (params          (operating-system-boot-parameters
                            os root-device
                            #:system-kernel-arguments? #t))
@@ -1225,6 +1234,7 @@ a list of <menu-entry>, to populate the \"old entries\" menu."
        (bootloader-configuration-bootloader bootloader-conf)))
 
     (generate-config-file bootloader-conf (list entry)
+                          #:locale locale
                           #:old-entries old-entries
                           #:store-directory-prefix
 			  (btrfs-store-subvolume-file-name file-systems))))
@@ -1264,6 +1274,7 @@ such as '--root' and '--load' to <boot-parameters>."
   (let* ((initrd          (and (not (operating-system-hurd os))
                                (operating-system-initrd-file os)))
          (store           (operating-system-store-file-system os))
+         (locale          (operating-system-locale os))
          (bootloader      (bootloader-configuration-bootloader
                            (operating-system-bootloader os)))
          (bootloader-name (bootloader-name bootloader))
@@ -1282,6 +1293,7 @@ such as '--root' and '--load' to <boot-parameters>."
      (bootloader-name bootloader-name)
      (bootloader-menu-entries
       (bootloader-configuration-menu-entries (operating-system-bootloader os)))
+     (locale locale)
      (store-device (ensure-not-/dev (file-system-device store)))
      (store-mount-point (file-system-mount-point store)))))
 
@@ -1334,6 +1346,7 @@ being stored into the \"parameters\" file)."
                              (or (and=> (operating-system-bootloader os)
                                         bootloader-configuration-menu-entries)
                                  '())))
+                     (locale #$(boot-parameters-locale params))
                      (store
                       (device
                        #$(device->sexp (boot-parameters-store-device params)))
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 939559e719..9ed5c26483 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -384,6 +384,7 @@ STORE is an open connection to the store."
          ;; Make the specified system generation the default entry.
          (params (first (profile-boot-parameters %system-profile
                                                  (list number))))
+         (locale (boot-parameters-locale params))
          (old-generations
           (delv number (reverse (generation-numbers %system-profile))))
          (old-params (profile-boot-parameters
@@ -396,6 +397,7 @@ STORE is an open connection to the store."
           ((bootcfg (lower-object
                      ((bootloader-configuration-file-generator bootloader)
                       bootloader-config entries
+                      #:locale locale
                       #:old-entries old-entries)))
            (drvs -> (list bootcfg)))
         (mbegin %store-monad
-- 
2.28.0


  parent reply	other threads:[~2020-10-11 14:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23 13:17 [bug#35394] [PATCH 0/3] Bootloader localization Miguel
2019-04-23 13:26 ` [bug#35394] [PATCH 1/3] system: Add locale to boot-parameters Miguel
2019-04-23 13:26 ` [bug#35394] [PATCH 2/3] system: Provide locale information to the bootloader Miguel
2019-04-23 13:26 ` [bug#35394] [PATCH 3/3] system: Use locale information in grub.cfg Miguel
2019-04-26 10:50 ` [bug#35394] [PATCH 3/4] gnu: grub: Add locale output for bootloading Miguel
2019-05-03 12:27   ` Miguel
2019-04-26 10:51 ` [bug#35394] [PATCH 4/4] system: Use locale information in grub.cfg Miguel
2019-05-03 12:27   ` Miguel
2019-04-29  7:56 ` [bug#35394] [PATCH 0/3] Bootloader localization Ludovic Courtès
     [not found]   ` <20191021124035.531bed75@gmail.com>
2019-10-21 10:46     ` [bug#35394] [PATCH 1/3] system: Add locale to boot-parameters Miguel Arruga Vivas
2019-10-21 10:46     ` [bug#35394] [PATCH 2/3] system: Provide locale information to the bootloader Miguel Arruga Vivas
2019-10-21 10:46     ` [bug#35394] [PATCH 3/3] system: Use locale information in grub.cfg Miguel Arruga Vivas
2020-10-11 14:18 ` Miguel Ángel Arruga Vivas [this message]
2020-10-17 16:32   ` [bug#35394] [PATCH 1/1 v4] Grub i18n Ludovic Courtès
2020-10-18 15:09     ` [bug#35394] [PATCH 4/4 " Miguel Ángel Arruga Vivas
2020-10-18 15:43       ` Miguel Ángel Arruga Vivas
2020-10-19  8:50         ` Ludovic Courtès
2020-10-19 11:41           ` Miguel Ángel Arruga Vivas
2020-10-19 13:21             ` Ludovic Courtès
2020-10-19 13:44               ` Miguel Ángel Arruga Vivas
2020-10-20 20:50                 ` Ludovic Courtès
2020-10-20 21:19                   ` bug#35394: " Miguel Ángel Arruga Vivas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ft6k7sn2.fsf@gmail.com \
    --to=rosen644835@gmail.com \
    --cc=35394@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).