From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id KGm4EPx7jV+uFAAA0tVLHw (envelope-from ) for ; Mon, 19 Oct 2020 11:43:56 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id mBN6DPx7jV/cUwAAbx9fmQ (envelope-from ) for ; Mon, 19 Oct 2020 11:43:56 +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 A3F8394023B for ; Mon, 19 Oct 2020 11:43:55 +0000 (UTC) Received: from localhost ([::1]:51320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kUTZx-0000x3-WD for larch@yhetil.org; Mon, 19 Oct 2020 07:43:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47886) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kUTZ8-0000Pl-QJ for guix-patches@gnu.org; Mon, 19 Oct 2020 07:43:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56859) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kUTZ8-0008Q6-Er for guix-patches@gnu.org; Mon, 19 Oct 2020 07:43:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kUTZ8-0002ZV-AI for guix-patches@gnu.org; Mon, 19 Oct 2020 07:43:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#35394] [PATCH 4/4 v4] Grub i18n Resent-From: Miguel =?UTF-8?Q?=C3=81ngel?= Arruga Vivas Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 19 Oct 2020 11:43:02 +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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 35394@debbugs.gnu.org Received: via spool by 35394-submit@debbugs.gnu.org id=B35394.16031077629857 (code B ref 35394); Mon, 19 Oct 2020 11:43:02 +0000 Received: (at 35394) by debbugs.gnu.org; 19 Oct 2020 11:42:42 +0000 Received: from localhost ([127.0.0.1]:40172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUTYo-0002Yv-FI for submit@debbugs.gnu.org; Mon, 19 Oct 2020 07:42:42 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:37159) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kUTYm-0002Yb-Jd for 35394@debbugs.gnu.org; Mon, 19 Oct 2020 07:42:41 -0400 Received: by mail-wm1-f68.google.com with SMTP id j136so12488918wmj.2 for <35394@debbugs.gnu.org>; Mon, 19 Oct 2020 04:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=v80rZY9bY8pfoJ7PfGqyZD/siBBIGi77Y1KaTQPLGek=; b=LrJ6AVI6lkSxmCFKlRO9sAzSj6cHFP+9/oLkcAIToTYF7zzqaH45AgJ887P1dATyse ro92aVmX+wXV4mvsDZTtoHd1U0DddWwsrMC/fPoKYsyGwBoGultW/UheTYaKm9th9eQs 7QptaSXhCwWD3N0aoUfOYViWpGXzugoQPjYbsFBsQ85rtSyjicJxns9bcWc+Kh7/9uHi HZ9j121lFV6bdE412gz213L7jpo6Pw7brJrowhjsUMkZ52qFSSb7OnnF6r0GgKM+0inK NDXo+LQl6PtV6+uJM8L+WqeXVBBqOiJKEUmnO3npIRZJw4XU5794Aog8BnnGNBa8P0Rb fTLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=v80rZY9bY8pfoJ7PfGqyZD/siBBIGi77Y1KaTQPLGek=; b=A0VTqnT8FJJ8Xi3DCD14ij4O6zqpNPupIuflawaXVFZ7ufWDymGQwfmxUpdhHMhqbs /eqdUUzoC++Ew5lXBvd7PCgWMVMPfhYHriMxeRmVhb/hiRXLE0DfmNZT+M2KNmE/86qD xWdNXyTelpVV0Yng2kMID5DHsNeFOkXGNax8D9RXzjymt+3xoQlybBCTcuIQtT6xvh+w 6hjko0+M6V8HmFCV6xS9bzB50qX94TUqD8oEQJYa9lwxowLzQqvNENaokLMfW8mbKvle aDA7bc+JydXq7EwX8aVFHcOxxlfrF4YWeEPIzWcEnepJaEPKDeCBTwMygvAHabfJeSWA UGPw== X-Gm-Message-State: AOAM531+6RD21H6vsg1tqvaDMl39Z3NVElD11hHj6IY87Ev0l73uY/Ye OWk3dCN/BN38CPy53wB8ImXDgYxPElPCUg== X-Google-Smtp-Source: ABdhPJw5Uj2wQ4VJGbth1WfGlWJBzumyxwHvuo8CZEcKnU5bCg6FNps651x/5XWwGUJ5XHu/VNW0Jw== X-Received: by 2002:a1c:ed04:: with SMTP id l4mr6741473wmh.143.1603107754378; Mon, 19 Oct 2020 04:42:34 -0700 (PDT) Received: from unfall (218.139.134.37.dynamic.jazztel.es. [37.134.139.218]) by smtp.gmail.com with ESMTPSA id 32sm4896782wro.31.2020.10.19.04.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Oct 2020 04:42:33 -0700 (PDT) From: Miguel =?UTF-8?Q?=C3=81ngel?= Arruga Vivas References: <20190423151702.05258473@gmail.com> <87ft6k7sn2.fsf@gmail.com> <87362c6cew.fsf@gnu.org> <87v9f7po4x.fsf_-_@gmail.com> <87o8kzpmjv.fsf@gmail.com> <87o8ky1tx6.fsf@gnu.org> Date: Mon, 19 Oct 2020 13:41:36 +0200 In-Reply-To: <87o8ky1tx6.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Mon, 19 Oct 2020 10:50:13 +0200") Message-ID: <878sc2phn3.fsf@gmail.com> 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: 0.2 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -0.8 (/) 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=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=LrJ6AVI6; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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: 0.09 X-TUID: OlfzKsuO+Zke Hi Ludo, Thanks for your review and your ideas, I'll comment inline. Ludovic Court=C3=A8s writes: >> + (define (translate-label label) >> + (match label >> + (('hurd name version) >> + ;; TRANSLATORS: The first parameter is the capitalized package n= ame >> + ;; for the Hurd kernel, which uses the definite article in Engli= sh. >> + ;; 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 n= ame >> + ;; 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 bo= oted. >> + #~(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 lab= el here: the > user is free to choose the label they want in the =E2=80=98label=E2=80=99= field, and we > don=E2=80=99t want to replicate =E2=80=9CGNU with the=E2=80=9D etc. in ea= ch 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=E2=80=99s also not great that we=E2=80=99re changing the boot paramete= rs 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=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)))))) 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 =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-l= ike 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-conc= atenation