From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:44317) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hZ9T6-0002n9-2h for guix-patches@gnu.org; Fri, 07 Jun 2019 03:39:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hZ9Ss-0001z5-OU for guix-patches@gnu.org; Fri, 07 Jun 2019 03:39:10 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37765) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hZ9So-0001uB-Do for guix-patches@gnu.org; Fri, 07 Jun 2019 03:39:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hZ9So-00064S-AP for guix-patches@gnu.org; Fri, 07 Jun 2019 03:39:02 -0400 Subject: [bug#35790] [PATCH] scripts: lint: Handle warnings with a record type. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20190518093206.22069-1-mail@cbaines.net> <878suz27ke.fsf@gnu.org> <87ef4dxgvl.fsf@cbaines.net> Date: Fri, 07 Jun 2019 09:38:05 +0200 In-Reply-To: <87ef4dxgvl.fsf@cbaines.net> (Christopher Baines's message of "Sat, 01 Jun 2019 20:09:02 +0100") Message-ID: <87pnnpj15u.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Christopher Baines Cc: 35790@debbugs.gnu.org Hello, Christopher Baines skribis: > Ludovic Court=C3=A8s writes: [...] >>> +(define* (make-warning package message >>> + #:key field location) >>> + (make-lint-warning >>> + package >>> + message >> >> In practice MESSAGE is already translated. I think it would be more >> flexible if it were not; =E2=80=98lint-warning-message=E2=80=99 would al= ways return the >> English message, and it=E2=80=99d be up to the user to call =E2=80=98get= text=E2=80=99 on it, >> like we do for package descriptions. >> >> To achieve this, you=E2=80=99d need a little trick so that =E2=80=98xget= text=E2=80=99 can still >> extract the messages, like: >> >> >> (define-syntax-rule make-warning >> (syntax-rule (G_) >> ((_ package (G_ message) rest ...) >> (%make-warning package message rest ...)))) >> >> where =E2=80=98%make-warning=E2=80=99 is the procedure you define above. >> >> Then you need an explicit call to =E2=80=98G_=E2=80=99 at the point wher= e messages are >> displayed. >> >> Does that make sense? > > Yes, but I'm unsure it'll work for all the messages. > > Some of them it translates a format string first, then uses that format > string, and that becomes the message, e.g. > > (format #f (G_ "invalid description: ~s") description) > > Given that you'd be trying to get the translation for "invalid > description: guile" for example, I'm not sure you can defer the > translation without also defering customising the message, if that makes > sense? Good point! A possibility would be to pass =E2=80=98make-warning=E2=80=99 a =E2=80=98fo= rmat=E2=80=99 list instead of a single string: (make-warning package (list (G_ "~a is bad") 'something) =E2=80=A6) That=E2=80=99d solve the problem but it=E2=80=99d have to be packaged nicel= y to avoid having too much boilerplate. WDYT? Thanks, Ludo=E2=80=99.