GNU bug report logs - #35394
[PATCH 0/3] Bootloader localization

Previous Next

Package: guix-patches;

Reported by: Miguel <rosen644835 <at> gmail.com>

Date: Tue, 23 Apr 2019 13:18:02 UTC

Severity: normal

Tags: patch

Done: Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35394 in the body.
You can then email your comments to 35394 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Tue, 23 Apr 2019 13:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Miguel <rosen644835 <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 23 Apr 2019 13:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Miguel <rosen644835 <at> gmail.com>
To: Guix-devel <guix-patches <at> gnu.org>
Subject: [PATCH 0/3] Bootloader localization
Date: Tue, 23 Apr 2019 15:17:02 +0200
Hello Guix!

As a Grub translator, I've been hacking a little bit in order to
provide locale information to Grub. I use Guix in a daily basis, as my
main computer operating system, and I this is a key step in order to
provide a better experience to the all kind of users, who may do not
know other languages than their native one.

My current idea, implemented in the following patches, is something
along these lines:
  1. Store locale information into boot-parameters file. This patch
  contains a quite silly test that requires wiser review.
  2. Provide this information to the bootloader at the configuration
  time. This, ideally, should provided at installation time too, but
  I'm stuck seeing my first messages in english when grub asks for the
  whole-disk encryption passphrase as I don't know how to create a
  working core.img yet.
  3. Add a snippet to the generated grub.cfg file with the language
  information. Some configurations, as /boot in a separate partition,
  does not work with this patch, but take it as a proof of concept.

Lacking points:
  1. No support for other bootloaders yet. I don't know any of them too
  much, but I'm unaware of their localization support.
  2. Grub installation process is not transactional enough. I have some
  ideas for that, to be discussed in another thread, although one key
  point is tightly related with this topic: /boot/grub/locale
  generation. Having this folder as a derivation would make explicit
  the dependency, but I have to work more on this and I'm open to any
  ideas.

WDYT?

Best regards,
Miguel




Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Tue, 23 Apr 2019 13:27:01 GMT) Full text and rfc822 format available.

Message #8 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel <rosen644835 <at> gmail.com>
To: 35394 <at> debbugs.gnu.org
Subject: [PATCH 1/3] system: Add locale to boot-parameters.
Date: Tue, 23 Apr 2019 15:26:20 +0200
[Message part 1 (text/plain, inline)]
system: Add locale to boot-parameters.

* gnu/system.scm (<boot-parameters>): New locale field.
(boot-parameters-locale): New accessor.
(read-boot-parameters): Read locale field.
(operating-system-boot-parameters): Add locale to boot-parameters form.
(opeating-system-boot-parameters-file): Add locale to file-like object.
* tests/boot-parameters.scm: New test file.
* Makefile.am (SCM_TESTS): Add tests/boot-parameters.scm.
---
 Makefile.am               |   1 +
 gnu/system.scm            |  19 +++-
 tests/boot-parameters.scm | 232 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 248 insertions(+), 4 deletions(-)
[0001-system-Add-locale-to-boot-parameters.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Tue, 23 Apr 2019 13:27:02 GMT) Full text and rfc822 format available.

Message #11 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel <rosen644835 <at> gmail.com>
To: 35394 <at> debbugs.gnu.org
Subject: [PATCH 2/3] system: Provide locale information to the bootloader.
Date: Tue, 23 Apr 2019 15:26:28 +0200
[Message part 1 (text/plain, inline)]
system: Provide locale information to the bootloader. 

* gnu/bootloader/depthcharge.scm (depthcharge-configuration-file): Add
locale keyword.
* gnu/bootloader/extlinux.scm (extlinux-configuration-file): Likewise.
* gnu/bootloader/grub.scm (grub-configuration-file): Likewise.
* gnu/system.scm (operating-system-bootcfg): Provide locale information
to the bootloader.
* guix/system/script.scm (reinstall-bootloader): Use locale information
from boot-parameters.
---
 gnu/bootloader/depthcharge.scm | 3 ++-
 gnu/bootloader/extlinux.scm    | 3 ++-
 gnu/bootloader/grub.scm        | 3 ++-
 gnu/system.scm                 | 4 +++-
 guix/scripts/system.scm        | 4 +++-
 5 files changed, 12 insertions(+), 5 deletions(-)
[0002-system-Provide-locale-information-to-the-bootloader.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Tue, 23 Apr 2019 13:27:02 GMT) Full text and rfc822 format available.

Message #14 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel <rosen644835 <at> gmail.com>
To: 35394 <at> debbugs.gnu.org
Subject: [PATCH 3/3] system: Use locale information in grub.cfg.
Date: Tue, 23 Apr 2019 15:26:35 +0200
[Message part 1 (text/plain, inline)]
system: Use locale information in grub.cfg.

* gnu/bootloader/grub.scm (locale-config-entries): New procedure.
(grub-configuration-file): Use locale-config-entries.
---
 gnu/bootloader/grub.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
[0003-system-Use-locale-information-in-grub.cfg.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Fri, 26 Apr 2019 10:51:01 GMT) Full text and rfc822 format available.

Message #17 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel <rosen644835 <at> gmail.com>
To: 35394 <at> debbugs.gnu.org
Subject: [PATCH 3/4] gnu: grub: Add locale output for bootloading.
Date: Fri, 26 Apr 2019 12:50:41 +0200
[Message part 1 (text/plain, inline)]
gnu: grub: Add locale output for bootloading.

* gnu/packages/bootloaders.scm (grub): Add needed modules and new output
generated with new phase 'install-locale-folder.
---
 gnu/packages/bootloaders.scm | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)
[0003-gnu-grub-Add-locale-output-for-bootloading.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Fri, 26 Apr 2019 10:52:02 GMT) Full text and rfc822 format available.

Message #20 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel <rosen644835 <at> gmail.com>
To: 35394 <at> debbugs.gnu.org
Subject: [PATCH 4/4] system: Use locale information in grub.cfg.
Date: Fri, 26 Apr 2019 12:51:23 +0200
[Message part 1 (text/plain, inline)]
system: Use locale information in grub.cfg.

* gnu/bootloader/grub.scm (module-declaration): Add (gnu system locale).
(locale-config-entries): New procedure.
(grub-configuration-file): Use locale-config-entries.
---
 gnu/bootloader/grub.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
[0004-system-Use-locale-information-in-grub.cfg.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Fri, 26 Apr 2019 11:00:02 GMT) Full text and rfc822 format available.

Message #23 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel <rosen644835 <at> gmail.com>
To: 35394 <at> debbugs.gnu.org
Cc: guix-devel <at> gnu.org
Subject: Bootloader localization
Date: Fri, 26 Apr 2019 12:59:13 +0200
Hi everybody!

I've been working on these patches and I've been able to generate a
derivation with the format expected by Grub during bootloading, use it
in the grub.cfg file. I removed the test for the folder inside the
configuration file and added a check for the "locale" output during
the file generation. Maybe it is not quite elegant, but I'm open to
ideas. Now there are 4 patches instead of 3.

What do you think?

Best regards,
Miguel

PS: I CC'ed the mailing list too looking for other ideas.

El Tue, 23 Apr 2019 15:17:02 +0200
Miguel <rosen644835 <at> gmail.com> escribió:
> Hello Guix!
> 
> As a Grub translator, I've been hacking a little bit in order to
> provide locale information to Grub. I use Guix in a daily basis, as my
> main computer operating system, and I this is a key step in order to
> provide a better experience to the all kind of users, who may do not
> know other languages than their native one.
> 
> My current idea, implemented in the following patches, is something
> along these lines:
>   1. Store locale information into boot-parameters file. This patch
>   contains a quite silly test that requires wiser review.
>   2. Provide this information to the bootloader at the configuration
>   time. This, ideally, should provided at installation time too, but
>   I'm stuck seeing my first messages in english when grub asks for the
>   whole-disk encryption passphrase as I don't know how to create a
>   working core.img yet.
>   3. Add a snippet to the generated grub.cfg file with the language
>   information. Some configurations, as /boot in a separate partition,
>   does not work with this patch, but take it as a proof of concept.
> 
> Lacking points:
>   1. No support for other bootloaders yet. I don't know any of them
> too much, but I'm unaware of their localization support.
>   2. Grub installation process is not transactional enough. I have
> some ideas for that, to be discussed in another thread, although one
> key point is tightly related with this topic: /boot/grub/locale
>   generation. Having this folder as a derivation would make explicit
>   the dependency, but I have to work more on this and I'm open to any
>   ideas.
> 
> WDYT?
> 
> Best regards,
> Miguel





Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Mon, 29 Apr 2019 07:57:01 GMT) Full text and rfc822 format available.

Message #26 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Miguel <rosen644835 <at> gmail.com>
Cc: 35394 <at> debbugs.gnu.org
Subject: Re: [bug#35394] [PATCH 0/3] Bootloader localization
Date: Mon, 29 Apr 2019 09:56:25 +0200
Hi Miguel,

Miguel <rosen644835 <at> gmail.com> skribis:

> As a Grub translator, I've been hacking a little bit in order to
> provide locale information to Grub. I use Guix in a daily basis, as my
> main computer operating system, and I this is a key step in order to
> provide a better experience to the all kind of users, who may do not
> know other languages than their native one.

Thanks a lot for this work.  FWIW, I’m holding off review and
integration after 1.0, but I’m happy if someone else reviews :-), and
I’ll be really happy to see it in master once 1.0 is out.

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Fri, 03 May 2019 12:30:02 GMT) Full text and rfc822 format available.

Message #29 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel <rosen644835 <at> gmail.com>
To: 35394 <at> debbugs.gnu.org
Subject: Re: [PATCH 4/4] system: Use locale information in grub.cfg.
Date: Fri, 3 May 2019 14:27:41 +0200
[Message part 1 (text/plain, inline)]
This patch fixes the module uses.

---
system: Use locale information in grub.cfg.

* gnu/bootloader/grub.scm (module-declaration): Add dependencies.
(locale-config-entries): New procedure.
(grub-configuration-file): Use locale-config-entries.
---
 gnu/bootloader/grub.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
[0004-system-Use-locale-information-in-grub.cfg.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Fri, 03 May 2019 12:30:02 GMT) Full text and rfc822 format available.

Message #32 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel <rosen644835 <at> gmail.com>
To: 35394 <at> debbugs.gnu.org
Subject: Re: [PATCH 3/4] gnu: grub: Add locale output for bootloading.
Date: Fri, 3 May 2019 14:27:12 +0200
[Message part 1 (text/plain, inline)]
Last patches contain a couple of problems, unbound variables are fixed
in the attached patch.  Commit message has been reworded. 

-----
gnu: grub: Add locale output.

* gnu/packages/bootloaders.scm (grub): Add new phase 'install-locale-folder
to generate new output used for bootloader localization.
---
 gnu/packages/bootloaders.scm | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)
[0003-gnu-grub-Add-locale-output.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Mon, 21 Oct 2019 10:47:01 GMT) Full text and rfc822 format available.

Message #35 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel Arruga Vivas <rosen644835 <at> gmail.com>
To: 35394 <at> debbugs.gnu.org
Cc: guix-devel <at> gnu.org, Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: [bug#35394] [PATCH 0/3] Bootloader localization
Date: Mon, 21 Oct 2019 12:40:35 +0200
Hi Ludo’,

El Mon, 29 Apr 2019 09:56:25 +0200
Ludovic Courtès <ludo <at> gnu.org> escribió:
> Hi Miguel,
> 
> Thanks a lot for this work.

I've been quite silent about this because I wanted to solve the issue
with .mo files in a better way, but my current understanding is that
the best way to go with that is to make grub installation
(store-)reproducible and removing /boot altogether, so I'll open
a different thread on the mailing list about that.  For the moment,
the patches following this mail rely on the installation
of /boot/grub/locale, usually generated by grub-install.  The generated
grub.cfg scriptlet enables the use case for /boot in a different
partition found in many other distributions (which breaks the boot
when /gnu/store is encrypted in a different partition, I'm going to fill
a bug for that too).

I've tested them on the following machine configurations, on top of
commit 5f760515c8:
	- grub-efi on x86_64-gnu-linux:
		* Encrypted partition for the whole disk.
		* Separate "/boot" (ext4) and "/" (ext4 and btrfs)
		  partitions.
	- grub-pc on x86_64-gnu-linux:
		* Same as grub-efi, plus
		* Encrypted and different "/boot" and "/" partitions,
		  typing manually in the console
		  "cryptomount (hdX,msdosX)" with the "/" partition to
		  allow grub loading the kernel image.


> FWIW, I’m holding off review and integration after 1.0, but I’m happy
> if someone else reviews :-),

I'm CCing the list to bring some attention onto it, I think it's
on-topic enough to worth a try.  The hardest part for review is the new
test case, because I wanted to be 100% sure I didn't break anything.
As you can see, the tested code didn't need almost any change, although
I've made some changes on the test case from the last set of patches.

> and I’ll be really happy to see it in master once 1.0 is out.

I wish we'll see it in master soon.

Best regards,
Miguel




Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Mon, 21 Oct 2019 10:47:04 GMT) Full text and rfc822 format available.

Message #38 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel Arruga Vivas <rosen644835 <at> gmail.com>
To: 35394 <at> debbugs.gnu.org
Subject: Re: [bug#35394] [PATCH 1/3] system: Add locale to boot-parameters.
Date: Mon, 21 Oct 2019 12:46:14 +0200
[Message part 1 (text/plain, inline)]
* 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
boot-parameters record.
(opeating-system-boot-parameters-file): Likewise.
* Makefile.am (SCM_TESTS): Add tests/boot-parameters.scm.
* tests/boot-parameters.scm: New test file.
---
 Makefile.am               |   1 +
 gnu/system.scm            |  19 ++-
 tests/boot-parameters.scm | 250 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 266 insertions(+), 4 deletions(-)
 create mode 100644 tests/boot-parameters.scm
[0001-system-Add-locale-to-boot-parameters.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Mon, 21 Oct 2019 10:47:07 GMT) Full text and rfc822 format available.

Message #41 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel Arruga Vivas <rosen644835 <at> gmail.com>
To: 35394 <at> debbugs.gnu.org
Subject: Re: [bug#35394] [PATCH 2/3] system: Provide locale information to
 the bootloader.
Date: Mon, 21 Oct 2019 12:46:24 +0200
[Message part 1 (text/plain, inline)]
* gnu/bootloader/depthcharge.scm (depthcharge-configuration-file): Add
locale keyword.
* gnu/bootloader/extlinux.scm (extlinux-configuration-file): Likewise.
* gnu/bootloader/grub.scm (grub-configuration-file): Likewise.
* gnu/system.scm (operating-system-bootcfg): Provide locale information
to the bootloader.
* guix/system/script.scm (reinstall-bootloader): Use locale information
from boot-parameters.
---
 gnu/bootloader/depthcharge.scm | 3 ++-
 gnu/bootloader/extlinux.scm    | 3 ++-
 gnu/bootloader/grub.scm        | 3 ++-
 gnu/system.scm                 | 4 +++-
 guix/scripts/system.scm        | 4 +++-
 5 files changed, 12 insertions(+), 5 deletions(-)
[0002-system-Provide-locale-information-to-the-bootloader.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Mon, 21 Oct 2019 10:47:08 GMT) Full text and rfc822 format available.

Message #44 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel Arruga Vivas <rosen644835 <at> gmail.com>
To: 35394 <at> debbugs.gnu.org
Subject: Re: [bug#35394] [PATCH 3/3] system: Use locale information in
 grub.cfg.
Date: Mon, 21 Oct 2019 12:46:32 +0200
[Message part 1 (text/plain, inline)]
* 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(+)
[0003-system-Use-locale-information-in-grub.cfg.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Sun, 11 Oct 2020 14:20:02 GMT) Full text and rfc822 format available.

Message #47 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com>
To: 35394 <at> debbugs.gnu.org
Subject: Re: [bug#35394] [PATCH 1/1 v4] Grub i18n
Date: Sun, 11 Oct 2020 16:18:41 +0200
[Message part 1 (text/plain, inline)]
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
--
[0001-system-Use-locale-information-in-grub.cfg.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Sat, 17 Oct 2020 16:33:02 GMT) Full text and rfc822 format available.

Message #50 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com>
Cc: 35394 <at> debbugs.gnu.org
Subject: Re: [bug#35394] [PATCH 1/1 v4] Grub i18n
Date: Sat, 17 Oct 2020 18:32:39 +0200
Hi Miguel,

Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com> skribis:

> 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).

Sounds good.  I think the way you split patches in v3 was fine too (the
added test was also a nice bonus), so I actually have a slight
preference for v3.

>>From 885a7c167faafa295b0f3edaae1ee456eacf1e63 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
>  <rosen644835 <at> 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.

This (and v3) LGTM!  We’ll have to do another round of testing before
1.2.

¡Gracias!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Sun, 18 Oct 2020 15:11:02 GMT) Full text and rfc822 format available.

Message #53 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35394 <at> debbugs.gnu.org
Subject: Re: [bug#35394] [PATCH 4/4 v4] Grub i18n
Date: Sun, 18 Oct 2020 17:09:02 +0200
[Message part 1 (text/plain, inline)]
Hi Ludo,

Ludovic Courtès <ludo <at> gnu.org> writes:
> Sounds good.  I think the way you split patches in v3 was fine too (the
> added test was also a nice bonus), so I actually have a slight
> preference for v3.
> (...)
> This (and v3) LGTM!  We’ll have to do another round of testing before
> 1.2.

I plan to push them today.  The code is the same as v4 (as it contained
the code for roll-back in ssh.scm) plus the test from v3, with only
cosmetic changes to avoid touching other lines and an update for
multiboot-modules in the test.  Thank you very much for your review.

Nonetheless, I have a nice last minute addition for this to keep this
open for a bit more. :-)

It brings the whole glibc-locales to the grub and extlinux configuration
builders, and changes again boot-parameters.  It would be optimal to
create a minimal locale with the desired locale, as glibc-utf8-locales
doesn't work with my to-go test target (es_ES.utf8) because setlocale
raises an exception.

I have in my TODO list to extract translate-label somewhere else, even
though I'm not sure where could it fit, and to sanitize some inputs to
ensure the correct generation.  The latter should be ready this week,
the first depends on finding (or creating) the right place.

WDYT?

Happy hacking!
Miguel
[0001-system-nls-for-boot-labels.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Sun, 18 Oct 2020 15:45:02 GMT) Full text and rfc822 format available.

Message #56 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35394 <at> debbugs.gnu.org
Subject: Re: [bug#35394] [PATCH 4/4 v4] Grub i18n
Date: Sun, 18 Oct 2020 17:43:16 +0200
[Message part 1 (text/plain, inline)]
Sorry, please disregard the last patch, it was a non-working version.  I
tested this one with Grub and the boot-parameters test (for the label
modification).

I leave the open points for reference.

Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com> writes:
> (...)
> It brings the whole glibc-locales to the grub and extlinux configuration
> builders, and changes again boot-parameters.  It would be optimal to
> create a minimal locale with the desired locale, as glibc-utf8-locales
> doesn't work with my to-go test target (es_ES.utf8) because setlocale
> raises an exception.
>
> I have in my TODO list to extract translate-label somewhere else, even
> though I'm not sure where could it fit, and to sanitize some inputs to
> ensure the correct generation.  The latter should be ready this week,
> the first depends on finding (or creating) the right place.

Happy hacking!
Miguel

[0001-system-nls-for-boot-labels.patch (text/x-patch, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Mon, 19 Oct 2020 08:51:01 GMT) Full text and rfc822 format available.

Message #59 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com>
Cc: 35394 <at> debbugs.gnu.org
Subject: Re: [bug#35394] [PATCH 4/4 v4] Grub i18n
Date: Mon, 19 Oct 2020 10:50:13 +0200
Hi!

Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com> skribis:

> From e9f3c255c13abc14e1f0decf5460b7a2f9a2d162 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
>  <rosen644835 <at> gmail.com>
> Date: Sat, 17 Oct 2020 21:27:51 +0200
> Subject: [PATCH] system: nls for boot labels.
>
> * gnu/bootloader/extlinux.scm (extlinux-configuration-file): Add
> keyword locale.
> [translate-label]: New function that formats the label after
> translation.
> [menu-entry->gexp]: Use translate-label.
> [init-gettext]: Init gettext with the language provided through the
> configuration.
> [builder]: Use init-gettext, define G_ and translate strings.
> * gnu/bootloader/grub.scm (eye-candy): Translate string.
> (grub-configuration-file)[translate-label]: New function.
> [menu-entry->gexp]: Use translate-label.
> [init-gettext]: New g-exp variable.
> [locale-config]: Translate string.
> [builder]: Use init-gettext, define G_ and translate strings.
> * gnu/system.scm (kernel->boot-label): Modify return type, and
> document it, to allow correct translation of the labels.
> * po/guix/POTFILES.in: Add gnu/bootloader/grub.scm.
> * tests/boot-parameters.scm (%default-label): Update to the new
> format.
> (%old-label): Renamed from old %default-label.
> (read old format): New test case.

[...]

>  (define* (extlinux-configuration-file config entries
>                                        #:key
> +                                      (locale #f)
>                                        (system (%current-system))
>                                        (old-entries '())
>                                        #:allow-other-keys)
> @@ -38,8 +43,38 @@ corresponding to old generations of the system."
>    (define all-entries
>      (append entries (bootloader-configuration-menu-entries config)))
>  
> +  (define (translate-label label)
> +    (match label
> +      (('hurd name version)
> +       ;; TRANSLATORS: The first parameter is the capitalized package name
> +       ;; for the Hurd kernel, which uses the definite article in English.
> +       ;; The second parameter contains the version string.
> +       #~(format #f (G_ "GNU with the ~a ~a") package version))
> +      (('linux name version)
> +       ;; TRANSLATORS: The first parameter is the capitalized package name
> +       ;; for Linux kernel, which doesn't use the definite article in
> +       ;; English.  The second parameter contains the version string.
> +       #~(format #f (G_ "GNU with ~a ~a") package version))
> +      (('unknown)
> +       ;; TRANSLATORS: This is the label for an unknown system to be booted.
> +       #~(G_ "GNU"))
> +      ((? string? old-format)
> +       ;; We cannot translate properly the old format.
> +       old-format)))

It’s not good that we’re baking assumptions about the label here: the
user is free to choose the label they want in the ‘label’ field, and we
don’t want to replicate “GNU with the” etc. in each bootloader.

It’s also not great that we’re changing the boot parameters again as
this can make compatibility trickier down the road.

(Brainstorm…)

I would simply translate it on the client side by temporarily setting
LANGUAGE to the target locale.  The downside is that this will not be
translated if the target locale is not supported by the host.

Alternately, we could have:

  (define (formatted-i18n-string locale fmt . args)
    (computed-file "formatted-i18n-string"
                   #~(begin
                       (textdomain …)
                       (setlocale …)
                       (call-with-output-file #$output
                         (lambda (port)
                           (format port …))))))

We would then need to adjust all bootloaders to read the label from that
file.  If the user-supplied ‘label’ is a plain string, we’d wrap it in
(plain-file …) so that ‘label’ is always a file-like object.

WDYT?

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Mon, 19 Oct 2020 11:43:02 GMT) Full text and rfc822 format available.

Message #62 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35394 <at> debbugs.gnu.org
Subject: Re: [bug#35394] [PATCH 4/4 v4] Grub i18n
Date: Mon, 19 Oct 2020 13:41:36 +0200
Hi Ludo,

Thanks for your review and your ideas, I'll comment inline.

Ludovic Courtès <ludo <at> gnu.org> writes:
>> +  (define (translate-label label)
>> +    (match label
>> +      (('hurd name version)
>> +       ;; TRANSLATORS: The first parameter is the capitalized package name
>> +       ;; for the Hurd kernel, which uses the definite article in English.
>> +       ;; The second parameter contains the version string.
>> +       #~(format #f (G_ "GNU with the ~a ~a") package version))
>> +      (('linux name version)
>> +       ;; TRANSLATORS: The first parameter is the capitalized package name
>> +       ;; for Linux kernel, which doesn't use the definite article in
>> +       ;; English.  The second parameter contains the version string.
>> +       #~(format #f (G_ "GNU with ~a ~a") package version))
>> +      (('unknown)
>> +       ;; TRANSLATORS: This is the label for an unknown system to be booted.
>> +       #~(G_ "GNU"))
>> +      ((? string? old-format)
>> +       ;; We cannot translate properly the old format.
>> +       old-format)))
>
> It’s not good that we’re baking assumptions about the label here: the
> user is free to choose the label they want in the ‘label’ field, and we
> don’t want to replicate “GNU with the” etc. in each bootloader.

I guess the main problem here was calling it 'old-format', as this is
the format that would be received for the labels provided by the user
too, I should have called it 'fixed-label' instead.  I didn't though of
this at first so that was the name, but the user provided label works as
always: the installation image was the first example I checked, as it
does exactly that---that startled me a bit until I noticed, by the way.

> It’s also not great that we’re changing the boot parameters again as
> this can make compatibility trickier down the road.

That was an important point of this design, and the reason why I created
the test in the first place: the tests try to cover all the
possibilities, the old format and the new one(s). :-)

> (Brainstorm…)
>
> I would simply translate it on the client side by temporarily setting
> LANGUAGE to the target locale.  The downside is that this will not be
> translated if the target locale is not supported by the host.
>
> Alternately, we could have:
>
>   (define (formatted-i18n-string locale fmt . args)
>     (computed-file "formatted-i18n-string"
>                    #~(begin
>                        (textdomain …)
>                        (setlocale …)
>                        (call-with-output-file #$output
>                          (lambda (port)
>                            (format port …))))))

I'd prefer this option, as it avoids triggering the translation on the
client side, and it could be used in other places too if needed.  It
needs xgettext support and a tag (like F_ or L_) would be very concise,
and useful from my point of view.  There are some other places
(e.g. gnu/machine/ssh.scm:395) which use string-append for user visible
strings[1].  They should be localized with a proper format, and
including the format call into the i18n call itself helps to ensure
that.

> We would then need to adjust all bootloaders to read the label from that
> file.  If the user-supplied ‘label’ is a plain string, we’d wrap it in
> (plain-file …) so that ‘label’ is always a file-like object.

I'll probably raise some questions about the design here and there, and
maybe open another thread for the point before, but as soon as I have
anything tangible, I'll send a patch. :-)

Happy hacking!
Miguel

[1] https://www.gnu.org/software/gettext/manual/gettext.html#No-string-concatenation




Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Mon, 19 Oct 2020 13:22:02 GMT) Full text and rfc822 format available.

Message #65 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com>
Cc: 35394 <at> debbugs.gnu.org
Subject: Re: [bug#35394] [PATCH 4/4 v4] Grub i18n
Date: Mon, 19 Oct 2020 15:21:16 +0200
Hi,

Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com> skribis:

>> (Brainstorm…)
>>
>> I would simply translate it on the client side by temporarily setting
>> LANGUAGE to the target locale.  The downside is that this will not be
>> translated if the target locale is not supported by the host.
>>
>> Alternately, we could have:
>>
>>   (define (formatted-i18n-string locale fmt . args)
>>     (computed-file "formatted-i18n-string"
>>                    #~(begin
>>                        (textdomain …)
>>                        (setlocale …)
>>                        (call-with-output-file #$output
>>                          (lambda (port)
>>                            (format port …))))))
>
> I'd prefer this option, as it avoids triggering the translation on the
> client side, and it could be used in other places too if needed.  It
> needs xgettext support and a tag (like F_ or L_) would be very concise,
> and useful from my point of view.

That’s OK, we can do (as we did in other places) something like:

  (define-syntax formatted-i18n-string
    (syntax-rules (G_ N_)
      ((_ locale (G_ fmt) args ...)
       (%formatted-i18n-string locale fmt args ...))
      …))

That way, xgettext is happy.

> There are some other places (e.g. gnu/machine/ssh.scm:395) which use
> string-append for user visible strings[1].  They should be localized
> with a proper format, and including the format call into the i18n call
> itself helps to ensure that.

Yup!

>> We would then need to adjust all bootloaders to read the label from that
>> file.  If the user-supplied ‘label’ is a plain string, we’d wrap it in
>> (plain-file …) so that ‘label’ is always a file-like object.
>
> I'll probably raise some questions about the design here and there, and
> maybe open another thread for the point before, but as soon as I have
> anything tangible, I'll send a patch. :-)

Sure!

We may end up delaying that post-release if there’s potential for
breakage.  We’ll see.

Thanks!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Mon, 19 Oct 2020 13:46:02 GMT) Full text and rfc822 format available.

Message #68 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35394 <at> debbugs.gnu.org
Subject: Re: [bug#35394] [PATCH 4/4 v4] Grub i18n
Date: Mon, 19 Oct 2020 15:44:12 +0200
[Message part 1 (text/plain, inline)]
Hi,

I take note about your comments, just one quick thing:

Ludovic Courtès <ludo <at> gnu.org> writes:
> We may end up delaying that post-release if there’s potential for
> breakage.  We’ll see.

With the release coming this week I wouldn't push anything more of this
into this release unless it's the most expected feature, which it isn't
by far.  I can test Grub and be really confident about not breaking
anything, but I don't almost any experience with the other bootloaders,
and neither lots of places nor time to test them.

Happy hacking!
Miguel
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#35394; Package guix-patches. (Tue, 20 Oct 2020 20:51:01 GMT) Full text and rfc822 format available.

Message #71 received at 35394 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com>
Cc: 35394 <at> debbugs.gnu.org
Subject: Re: [bug#35394] [PATCH 4/4 v4] Grub i18n
Date: Tue, 20 Oct 2020 22:50:14 +0200
Hola,

Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com> skribis:

> Ludovic Courtès <ludo <at> gnu.org> writes:
>> We may end up delaying that post-release if there’s potential for
>> breakage.  We’ll see.
>
> With the release coming this week I wouldn't push anything more of this
> into this release unless it's the most expected feature, which it isn't
> by far.  I can test Grub and be really confident about not breaking
> anything, but I don't almost any experience with the other bootloaders,
> and neither lots of places nor time to test them.

Sounds good, let’s take it post-release then.

Perhaps we should track it in a different issue and close this one?

Thanks!

Ludo’.




Reply sent to Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com>:
You have taken responsibility. (Tue, 20 Oct 2020 21:21:02 GMT) Full text and rfc822 format available.

Notification sent to Miguel <rosen644835 <at> gmail.com>:
bug acknowledged by developer. (Tue, 20 Oct 2020 21:21:02 GMT) Full text and rfc822 format available.

Message #76 received at 35394-done <at> debbugs.gnu.org (full text, mbox):

From: Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35394-done <at> debbugs.gnu.org
Subject: Re: [bug#35394] [PATCH 4/4 v4] Grub i18n
Date: Tue, 20 Oct 2020 23:19:06 +0200
[Message part 1 (text/plain, inline)]
Salut!

Ludovic Courtès <ludo <at> gnu.org> writes:
> Hola,
>
> Miguel Ángel Arruga Vivas <rosen644835 <at> gmail.com> skribis:
>
>> Ludovic Courtès <ludo <at> gnu.org> writes:
>>> We may end up delaying that post-release if there’s potential for
>>> breakage.  We’ll see.
>>
>> With the release coming this week I wouldn't push anything more of this
>> into this release unless it's the most expected feature, which it isn't
>> by far.  I can test Grub and be really confident about not breaking
>> anything, but I don't almost any experience with the other bootloaders,
>> and neither lots of places nor time to test them.
>
> Sounds good, let’s take it post-release then.
>
> Perhaps we should track it in a different issue and close this one?

Done, probably tomorrow I'll open a new one with a good description and
send the patch there as soon as it's ready.

> Thanks!

Thank you too, very much. :-)

Happy hacking!
Miguel
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 18 Nov 2020 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 131 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.