unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Julien Lepiller <julien@lepiller.eu>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: Let’s translate!)
Date: Sat, 27 Apr 2019 15:52:57 +0200	[thread overview]
Message-ID: <87o94rh7wm.fsf@gnu.org> (raw)
In-Reply-To: <20190427143206.511ade7e@sybil.lepiller.eu> (Julien Lepiller's message of "Sat, 27 Apr 2019 14:32:06 +0200")

[-- Attachment #1: Type: text/plain, Size: 3167 bytes --]

Hi,

Julien Lepiller <julien@lepiller.eu> scribes:

> From 77c33ee55115475f582eb49da8dc045432fbdb3b Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <julien@lepiller.eu>
> 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."
                                          ^
“return”

> +(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’d remove all the ‘tmp-’ in here since they don’t add anything, and I’d
suggest adding a comment below the ‘define’, 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 …)))

> +          (define (translate-cross-reference content translations)
> +            "Take CONTENT, a string representing a .texi file and translate any
> +croos-reference in it (@ref, @xref and @pxref) that have a translation in
     ^^
Typo.

Should be ‘translate-cross-references’ (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 "," 'post)
> +                         'pre "ref{" msgstr "}" 'post))))))
> +              content translations))

Please align ‘if’ like so:

  (if condition
      then
      else)

You probably need something like this to add (guix build po) to the
result of ‘guix pull’:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 522 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 196 bytes --]


Otherwise LGTM!  Please make sure that ‘make as-derivation’ works as
intended (builds the translations, installs (guix build po)) if you
haven’t done it already.

Thanks!

Ludo’.

  reply	other threads:[~2019-04-27 13:53 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11  9:54 New template for 'guix-manual' made available Translation Project Robot
2019-04-12 20:43 ` Let’s translate! Ludovic Courtès
2019-04-13  1:56   ` Meiyo Peng
2019-04-13  6:45     ` pelzflorian (Florian Pelz)
2019-04-13  7:49       ` pelzflorian (Florian Pelz)
2019-04-13  9:33       ` Meiyo Peng
2019-04-13  7:14     ` Julien Lepiller
2019-04-13  9:27       ` Meiyo Peng
2019-04-23  0:42       ` [PATCH 0/2] Removal of generated files (was Re: Let’s translate!) Miguel
2019-04-23  0:43         ` [PATCH 1/2] bootstrap: Break automake dependency on generated files. " Miguel
2019-04-23  7:28           ` Julien Lepiller
2019-04-23 10:28             ` Miguel
2019-04-26  9:30               ` Julien Lepiller
2019-04-26 11:05                 ` Miguel
2019-04-26 18:55                   ` Julien Lepiller
2019-04-26 22:10                     ` Ludovic Courtès
2019-04-27 12:32                       ` Julien Lepiller
2019-04-27 13:52                         ` Ludovic Courtès [this message]
2019-04-23 14:30             ` Ludovic Courtès
2019-04-23 22:51               ` Miguel
2019-04-24 10:37                 ` Julien Lepiller
2019-04-25  8:50                   ` Ludovic Courtès
2019-04-25  9:54                     ` Julien Lepiller
2019-04-26  8:39                       ` Ludovic Courtès
     [not found]         ` <20190423024427.10cd6e87@gmail.com>
2019-04-23 22:42           ` [PATCH 2/2] doc: Add Spanish translation. " Ludovic Courtès
2019-04-13  7:49     ` Let’s translate! znavko
2019-04-13  9:46       ` Meiyo Peng
2019-04-15 12:38     ` Ludovic Courtès
2019-04-13  5:11 ` znavko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o94rh7wm.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=julien@lepiller.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).