From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id aCqME7xTjV/HNAAA0tVLHw (envelope-from ) for ; Mon, 19 Oct 2020 08:52:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id +EpxD7xTjV9KFAAA1q6Kng (envelope-from ) for ; Mon, 19 Oct 2020 08:52:12 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8EDFA9402A2 for ; Mon, 19 Oct 2020 08:52:11 +0000 (UTC) Received: from localhost ([::1]:58962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kUQtl-0008I9-8T for larch@yhetil.org; Mon, 19 Oct 2020 04:52:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kUQsg-0007P7-Cr for guix-patches@gnu.org; Mon, 19 Oct 2020 04:51:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56648) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kUQsg-0003hu-3B for guix-patches@gnu.org; Mon, 19 Oct 2020 04:51:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kUQsg-000683-16 for guix-patches@gnu.org; Mon, 19 Oct 2020 04:51:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#35394] [PATCH 4/4 v4] Grub i18n Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 19 Oct 2020 08:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35394 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Miguel =?UTF-8?Q?=C3=81ngel?= Arruga Vivas Cc: 35394@debbugs.gnu.org Received: via spool by 35394-submit@debbugs.gnu.org id=B35394.160309742423507 (code B ref 35394); Mon, 19 Oct 2020 08:51:01 +0000 Received: (at 35394) by debbugs.gnu.org; 19 Oct 2020 08:50:24 +0000 Received: from localhost ([127.0.0.1]:39961 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUQs4-000675-9G for submit@debbugs.gnu.org; Mon, 19 Oct 2020 04:50:24 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUQs2-00066r-E1 for 35394@debbugs.gnu.org; Mon, 19 Oct 2020 04:50:22 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58840) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kUQrx-0003Lv-3w; Mon, 19 Oct 2020 04:50:17 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=59046 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kUQrv-00030L-Ga; Mon, 19 Oct 2020 04:50:17 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20190423151702.05258473@gmail.com> <87ft6k7sn2.fsf@gmail.com> <87362c6cew.fsf@gnu.org> <87v9f7po4x.fsf_-_@gmail.com> <87o8kzpmjv.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 28 =?UTF-8?Q?Vend=C3=A9miaire?= an 229 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 19 Oct 2020 10:50:13 +0200 In-Reply-To: <87o8kzpmjv.fsf@gmail.com> ("Miguel =?UTF-8?Q?=C3=81ngel?= Arruga Vivas"'s message of "Sun, 18 Oct 2020 17:43:16 +0200") Message-ID: <87o8ky1tx6.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -1.51 X-TUID: dKRAansJlpj9 Hi! Miguel =C3=81ngel Arruga Vivas skribis: > From e9f3c255c13abc14e1f0decf5460b7a2f9a2d162 Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?Miguel=3D20=3DC3=3D81ngel=3D20Arruga=3D20Vivas?=3D > > 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))) >=20=20 > + (define (translate-label label) > + (match label > + (('hurd name version) > + ;; TRANSLATORS: The first parameter is the capitalized package na= me > + ;; for the Hurd kernel, which uses the definite article in Englis= h. > + ;; 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 na= me > + ;; 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 boo= ted. > + #~(G_ "GNU")) > + ((? string? old-format) > + ;; We cannot translate properly the old format. > + old-format))) It=E2=80=99s not good that we=E2=80=99re baking assumptions about the label= here: the user is free to choose the label they want in the =E2=80=98label=E2=80=99 f= ield, and we don=E2=80=99t want to replicate =E2=80=9CGNU with the=E2=80=9D etc. in each= bootloader. It=E2=80=99s also not great that we=E2=80=99re changing the boot parameters= again as this can make compatibility trickier down the road. (Brainstorm=E2=80=A6) 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 =E2=80=A6) (setlocale =E2=80=A6) (call-with-output-file #$output (lambda (port) (format port =E2=80=A6)))))) We would then need to adjust all bootloaders to read the label from that file. If the user-supplied =E2=80=98label=E2=80=99 is a plain string, we= =E2=80=99d wrap it in (plain-file =E2=80=A6) so that =E2=80=98label=E2=80=99 is always a file-lik= e object. WDYT? Thanks, Ludo=E2=80=99.