From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: Re: [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: =?utf-8?Q?Let=E2=80=99s?= translate!) Date: Sat, 27 Apr 2019 15:52:57 +0200 Message-ID: <87o94rh7wm.fsf@gnu.org> References: <87zhovlztm.fsf@gnu.org> <87wojyllbk.fsf@riseup.net> <20190423024234.706dcc8a@gmail.com> <20190423024342.1abcff62@gmail.com> <39EC6770-B600-4529-81D3-3DB19119AD7D@lepiller.eu> <20190423122752.177e99e2@gmail.com> <20190426113004.13a26056@sybil.lepiller.eu> <20190426130514.6639920e@gmail.com> <20190426205523.1e1134b3@sybil.lepiller.eu> <877ebgju4j.fsf@gnu.org> <20190427143206.511ade7e@sybil.lepiller.eu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:36474) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hKNlI-0002Qn-SR for guix-devel@gnu.org; Sat, 27 Apr 2019 09:53:05 -0400 In-Reply-To: <20190427143206.511ade7e@sybil.lepiller.eu> (Julien Lepiller's message of "Sat, 27 Apr 2019 14:32:06 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Julien Lepiller Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Julien Lepiller scribes: > From 77c33ee55115475f582eb49da8dc045432fbdb3b Mon Sep 17 00:00:00 2001 > From: Julien Lepiller > Date: Fri, 26 Apr 2019 14:54:52 +0200 > Subject: [PATCH] self: Rebuild translated manuals. > > * guix/self.scm (info-manual): Run po4a and related commands to generate > translated texi files before building translated manuals. > * guix/build/po.scm: New file. > * Makefile.am (MODULES): Add it. I would put po.scm in MODULES_NOT_COMPILED. > +(define (read-po-file port) > + "Read a .po file from PORT and returns an alist of msgid and msgstr." ^ =E2=80=9Creturn=E2=80=9D > +(define (translate-texi-manuals source) > + "Retrun the translated texinfo manuals built from SOURCE" ^ ^ Typos. :-) > + (define (translate-tmp-texi po source tmp-name) > + (invoke #+(file-append po4a "/bin/po4a-translate") > + "-M" "UTF-8" "-L" "UTF-8" "-k" "0" "-f" "texinfo" > + "-m" source "-p" po "-l" tmp-name)) I=E2=80=99d remove all the =E2=80=98tmp-=E2=80=99 in here since they don=E2= =80=99t add anything, and I=E2=80=99d suggest adding a comment below the =E2=80=98define=E2=80=99, like: ;; Translate Texinfo file SOURCE using messages from PO, and write the ;; result to OUTPUT. > + (define (make-ref-regex msgid end) > + (make-regexp (string-append > + "ref\\{" (string-join (string-split msgid #\ = ) "[ \n]+") > + end))) The thing in the middle should be wrapped like this: (regexp-quote (string-join (string-split =E2=80=A6))) > + (define (translate-cross-reference content translations) > + "Take CONTENT, a string representing a .texi file and transl= ate any > +croos-reference in it (@ref, @xref and @pxref) that have a translation in ^^ Typo. Should be =E2=80=98translate-cross-references=E2=80=99 (plural), no? > +TRANSLATIONS, an alist of msgid and msgstr." > + (if (or (equal? msgstr "") > + (string-any (lambda (chr) > + (member chr '(#\{ #\} #\( #\) #= \newline #\,))) > + msgid)) > + content > + ;; Otherwise, they might be the name of a section, = so we > + ;; need to translate any occurence in @(p?x?)ref{..= .}. > + (let ((regexp1 (make-ref-regex msgid ",")) > + (regexp2 (make-ref-regex msgid "\\}"))) > + (regexp-substitute/global > + #f regexp2 > + (regexp-substitute/global > + #f regexp1 content 'pre "ref{" msgstr "," 'po= st) > + 'pre "ref{" msgstr "}" 'post)))))) > + content translations)) Please align =E2=80=98if=E2=80=99 like so: (if condition then else) You probably need something like this to add (guix build po) to the result of =E2=80=98guix pull=E2=80=99: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/guix/self.scm b/guix/self.scm index 2a10d1d25f..12bc816fa8 100644 --- a/guix/self.scm +++ b/guix/self.scm @@ -578,6 +578,7 @@ Info manual." ;; us to avoid an extra dependency on guile-gdbm-ffi. #:extra-files `(("guix/man-db.scm" ,(local-file "../guix/man-db.scm")) + ("guix/build/po.scm" ,(local-file "../guix/build/po.scm")) ("guix/store/schema.sql" ,(local-file "../guix/store/schema.sql"))) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Otherwise LGTM! Please make sure that =E2=80=98make as-derivation=E2=80=99= works as intended (builds the translations, installs (guix build po)) if you haven=E2=80=99t done it already. Thanks! Ludo=E2=80=99. --=-=-=--