* New template for 'guix-manual' made available
@ 2019-04-11 9:54 Translation Project Robot
2019-04-12 20:43 ` Let’s translate! Ludovic Courtès
2019-04-13 5:11 ` znavko
0 siblings, 2 replies; 29+ messages in thread
From: Translation Project Robot @ 2019-04-11 9:54 UTC (permalink / raw)
To: guix-devel
Hello, gentle maintainer.
This is a message from the Translation Project robot. (If you have
any questions, send them to <coordinator@translationproject.org>.)
A new POT file for textual domain 'guix-manual' has been made available
to the language teams for translation. It is archived as:
https://translationproject.org/POT-files/guix-manual-1.0.0-pre1.pot
Whenever you have a new distribution with a new version number ready,
containing a newer POT file, please send the URL of that distribution
tarball to the address below. The tarball may be just a pretest or a
snapshot, it does not even have to compile. It is just used by the
translators when they need some extra translation context.
Below is the URL which has been provided to the translators of your
package. Please inform the translation coordinator, at the address
at the bottom, if this information is not current:
https://lepiller.eu/files/guix-1.0.0-pre1.tar.gz
We can arrange things so that translated PO files are automatically e-mailed
to you when they arrive. Ask at the address below if you want this.
Thank you for all your work,
The Translation Project robot, in the
name of your translation coordinator.
<coordinator@translationproject.org>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Let’s translate!
2019-04-11 9:54 New template for 'guix-manual' made available Translation Project Robot
@ 2019-04-12 20:43 ` Ludovic Courtès
2019-04-13 1:56 ` Meiyo Peng
2019-04-13 5:11 ` znavko
1 sibling, 1 reply; 29+ messages in thread
From: Ludovic Courtès @ 2019-04-12 20:43 UTC (permalink / raw)
To: guix-devel
Hello Guix!
> A new POT file for textual domain 'guix-manual' has been made available
> to the language teams for translation. It is archived as:
>
> https://translationproject.org/POT-files/guix-manual-1.0.0-pre1.pot
Now’s the right time to translate Guix and the manual so that 1.0 is
available in your native language!
https://translationproject.org/domain/guix.html
https://translationproject.org/domain/guix-packages.html
https://translationproject.org/domain/guix-manual.html
Ludo’.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Let’s translate!
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)
` (3 more replies)
0 siblings, 4 replies; 29+ messages in thread
From: Meiyo Peng @ 2019-04-13 1:56 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Hi Ludovic,
Ludovic Courtès writes:
> Hello Guix!
>
>> A new POT file for textual domain 'guix-manual' has been made available
>> to the language teams for translation. It is archived as:
>>
>> https://translationproject.org/POT-files/guix-manual-1.0.0-pre1.pot
>
> Now’s the right time to translate Guix and the manual so that 1.0 is
> available in your native language!
>
> https://translationproject.org/domain/guix.html
> https://translationproject.org/domain/guix-packages.html
> https://translationproject.org/domain/guix-manual.html
I can translate the Guix manual into Chinese if no one else is willing
to do so. But I don't have much time and will probably miss the
deadline for Guix 1.0.
I have no previous experience with i18n. What should I know in order to
translate the Guix manual? How do I edit the ".pot" file? Is there an
emacs package for the job?
--
Meiyo Peng
https://www.pengmeiyu.com/
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Let’s translate!
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 5:11 ` znavko
1 sibling, 0 replies; 29+ messages in thread
From: znavko @ 2019-04-13 5:11 UTC (permalink / raw)
To: Ludovic Courtès, guix-devel
I had this idea to translate guix manual into Russian from October '18. That was not easy to get around with this. But now I have emacs with po-mode. And I will do it in a free time. Think, till January '20 Russian guix manual will be ready.
April 12, 2019 8:43 PM, "Ludovic Courtès" <ludo@gnu.org> wrote:
> Hello Guix!
>
>> A new POT file for textual domain 'guix-manual' has been made available
>> to the language teams for translation. It is archived as:
>>
>> https://translationproject.org/POT-files/guix-manual-1.0.0-pre1.pot
>
> Now’s the right time to translate Guix and the manual so that 1.0 is
> available in your native language!
>
> https://translationproject.org/domain/guix.html
> https://translationproject.org/domain/guix-packages.html
> https://translationproject.org/domain/guix-manual.html
>
> Ludo’.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Let’s translate!
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
` (2 subsequent siblings)
3 siblings, 2 replies; 29+ messages in thread
From: pelzflorian (Florian Pelz) @ 2019-04-13 6:45 UTC (permalink / raw)
To: Meiyo Peng; +Cc: guix-devel
On Sat, Apr 13, 2019 at 09:56:31AM +0800, Meiyo Peng wrote:
> I have no previous experience with i18n. What should I know in order to
> translate the Guix manual? How do I edit the ".pot" file? Is there an
> emacs package for the job?
>
emacs’ po-mode is part of gettext.
You will also need to join the Translation Project:
https://translationproject.org/team/index.html
You need to put your translations in a .po file, not in the .pot file.
This is what I did back then (once there is a po file it is no longer
this complicated). I am not sure if there are easier ways to test an
initial po file.
On Sat, Oct 27, 2018 at 02:55:10AM +0200, pelzflorian (Florian Pelz) wrote:
> I’m not sure what doc/htmlxref.cnf is for, but I did this to my copy
> of Guix to get the PO going, now that Julien Lepiller has paved the
> way by adding PO4A:
>
> cd ~/git/guix
> guix environment guix --ad-hoc po4a
>
Then I did this but it was not the right command:
> # if you do not have a po file yet:
> msginit -i po/doc/guix-manual.pot -o po/doc/guix-manual.de.po -l de_DE
You should not need to do this msginit. You should instead use the po
file at the Translation Project if they have one for your language
team. If not, then you should not use po/doc/guix-manual.pot as I did
but use the .pot file at
https://translationproject.org/domain/guix-manual.html or else the
Translation Project will not accept the po.
Then:
> # (in the newly created po file, adjust the version.texi to be
> # version-de.texi, contributing.texi to be contributing-de.texi and translate
> # the table of contents)
> # (adjust doc/htmlxref.cnf doc/local.mk po/doc/local.mk to list your
> # language next to the existing translations, in lexicographic order)
>
> # then:
> po4a-translate -f texinfo -m doc/guix.texi -p po/doc/guix-manual.de.po \
> -M UTF-8 -k 0 -l doc/guix.de.texi # ignore outdated warning
> po4a-translate -f texinfo -m doc/contributing.texi -p po/doc/guix-manual.de.po \
> -M UTF-8 -k 0 -l doc/contributing.de.texi # ignore warning
> ./bootstrap
> ./configure
> make # only needs to run past MAKEINFO; probably some of the GEN doc/os-config…
> # and po4a steps do the right thing
> ./bootstrap # only now bootstrap will detect that it needs guix.de.info
> ./configure
>
> make doc-pot-update # if desired
> make po/doc/guix-manual.de.po
>
> rm doc/guix.de.texi
> rm doc/contributing.de.texi
> make doc/guix.de.info
>
You should check if you get a working manual before submitting the po
file to the Translation Project robot’s e-mail.
Regards,
Florian
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Let’s translate!
2019-04-13 1:56 ` Meiyo Peng
2019-04-13 6:45 ` pelzflorian (Florian Pelz)
@ 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-13 7:49 ` Let’s translate! znavko
2019-04-15 12:38 ` Ludovic Courtès
3 siblings, 2 replies; 29+ messages in thread
From: Julien Lepiller @ 2019-04-13 7:14 UTC (permalink / raw)
To: guix-devel, Meiyo Peng, Ludovic Courtès
Le 13 avril 2019 03:56:31 GMT+02:00, Meiyo Peng <meiyo@riseup.net> a écrit :
>Hi Ludovic,
>
>Ludovic Courtès writes:
>
>> Hello Guix!
>>
>>> A new POT file for textual domain 'guix-manual' has been made
>available
>>> to the language teams for translation. It is archived as:
>>>
>>>
>https://translationproject.org/POT-files/guix-manual-1.0.0-pre1.pot
>>
>> Now’s the right time to translate Guix and the manual so that 1.0 is
>> available in your native language!
>>
>> https://translationproject.org/domain/guix.html
>> https://translationproject.org/domain/guix-packages.html
>> https://translationproject.org/domain/guix-manual.html
>
>I can translate the Guix manual into Chinese if no one else is willing
>to do so. But I don't have much time and will probably miss the
>deadline for Guix 1.0.
>
>I have no previous experience with i18n. What should I know in order
>to
>translate the Guix manual? How do I edit the ".pot" file? Is there an
>emacs package for the job?
>
>--
>Meiyo Peng
>https://www.pengmeiyu.com/
Hi!
I'm glal you're willing to translate to your native language! So get started, you need to register with the translation project for your language. You do not need to sign the waiver form for guix, so it should be rather quick.
To start working on translations, you'll have to download the pot file from the TP. Do not use the one in our repository. Then I know there is an emacs mode for gettext, but I don't know how to use it. You can also use poedit which is easy to use and can import pot files. In any case you'll have to produce a po file, which is very similar to the pot file, except for some headers. I also started developping offlate (https://framagit.org/tyreunom/offlate) that can automate fetching from the TP and sending to them, but it's not as good as I'd want.
Once you have translated, you'll have to send your work to the TP robot. You can do that even if your work is only partial.
I think the priority is to translate the guix domain first, before the manual. Make sure noone is listed as responsible for the translation on the TP and you should be good.
Thank you!
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Let’s translate!
2019-04-13 1:56 ` Meiyo Peng
2019-04-13 6:45 ` pelzflorian (Florian Pelz)
2019-04-13 7:14 ` Julien Lepiller
@ 2019-04-13 7:49 ` znavko
2019-04-13 9:46 ` Meiyo Peng
2019-04-15 12:38 ` Ludovic Courtès
3 siblings, 1 reply; 29+ messages in thread
From: znavko @ 2019-04-13 7:49 UTC (permalink / raw)
To: Julien Lepiller, guix-devel, Meiyo Peng, Ludovic Courtès
I've found this emacs config (~/.emacs) in linux.org.ru, that makes workable emacs commands (such as C-c C-c) when keyboard layout is not English. It works for me in Russian layout, and Chinese too as I tried.
;;Make emacs commands work when keyboard layout is not English
(defun reverse-input-method (input-method)
"Build the reverse mapping of single letters from INPUT-METHOD."
(interactive
(list (read-input-method-name "Use input method (default current): ")))
(if (and input-method (symbolp input-method))
(setq input-method (symbol-name input-method)))
(let ((current current-input-method)
(modifiers '(nil (control) (meta) (control meta))))
(when input-method
(activate-input-method input-method))
(when (and current-input-method quail-keyboard-layout)
(dolist (map (cdr (quail-map)))
(let* ((to (car map))
(from (quail-get-translation
(cadr map) (char-to-string to) 1)))
(when (and (characterp from) (characterp to))
(dolist (mod modifiers)
(define-key local-function-key-map
(vector (append mod (list from)))
(vector (append mod (list to)))))))))
(when input-method
(activate-input-method current))))
(defadvice read-passwd (around my-read-passwd act)
(let ((local-function-key-map nil))
ad-do-it))
(reverse-input-method 'russian-computer)
There are suggestions for emacs config to make po-mode by default and also ispell spellchecker in my blog:
dev-znavko.pantheonsite.io
Hope it helps!
April 13, 2019 7:15 AM, "Julien Lepiller" <julien@lepiller.eu> wrote:
> Le 13 avril 2019 03:56:31 GMT+02:00, Meiyo Peng <meiyo@riseup.net> a écrit :
>
>> Hi Ludovic,
>>
>> Ludovic Courtès writes:
>>
>>> Hello Guix!
>>
>> A new POT file for textual domain 'guix-manual' has been made
>> available
>> to the language teams for translation. It is archived as:
>>
>> https://translationproject.org/POT-files/guix-manual-1.0.0-pre1.pot
>>> Now’s the right time to translate Guix and the manual so that 1.0 is
>>> available in your native language!
>>>
>>> https://translationproject.org/domain/guix.html
>>> https://translationproject.org/domain/guix-packages.html
>>> https://translationproject.org/domain/guix-manual.html
>>
>> I can translate the Guix manual into Chinese if no one else is willing
>> to do so. But I don't have much time and will probably miss the
>> deadline for Guix 1.0.
>>
>> I have no previous experience with i18n. What should I know in order
>> to
>> translate the Guix manual? How do I edit the ".pot" file? Is there an
>> emacs package for the job?
>>
>> --
>> Meiyo Peng
>> https://www.pengmeiyu.com
>
> Hi!
>
> I'm glal you're willing to translate to your native language! So get started, you need to register
> with the translation project for your language. You do not need to sign the waiver form for guix,
> so it should be rather quick.
>
> To start working on translations, you'll have to download the pot file from the TP. Do not use the
> one in our repository. Then I know there is an emacs mode for gettext, but I don't know how to use
> it. You can also use poedit which is easy to use and can import pot files. In any case you'll have
> to produce a po file, which is very similar to the pot file, except for some headers. I also
> started developping offlate (https://framagit.org/tyreunom/offlate) that can automate fetching from
> the TP and sending to them, but it's not as good as I'd want.
>
> Once you have translated, you'll have to send your work to the TP robot. You can do that even if
> your work is only partial.
>
> I think the priority is to translate the guix domain first, before the manual. Make sure noone is
> listed as responsible for the translation on the TP and you should be good.
>
> Thank you!
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Let’s translate!
2019-04-13 6:45 ` pelzflorian (Florian Pelz)
@ 2019-04-13 7:49 ` pelzflorian (Florian Pelz)
2019-04-13 9:33 ` Meiyo Peng
1 sibling, 0 replies; 29+ messages in thread
From: pelzflorian (Florian Pelz) @ 2019-04-13 7:49 UTC (permalink / raw)
To: Meiyo Peng; +Cc: guix-devel
On Sat, Apr 13, 2019 at 08:45:52AM +0200, pelzflorian (Florian Pelz) wrote:
> On Sat, Oct 27, 2018 at 02:55:10AM +0200, pelzflorian (Florian Pelz) wrote:
> > make doc-pot-update # if desired
> > make po/doc/guix-manual.de.po
> >
Please ignore these two steps.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Let’s translate!
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
1 sibling, 0 replies; 29+ messages in thread
From: Meiyo Peng @ 2019-04-13 9:27 UTC (permalink / raw)
To: Julien Lepiller; +Cc: guix-devel
Hi Julien,
Julien Lepiller writes:
> Le 13 avril 2019 03:56:31 GMT+02:00, Meiyo Peng <meiyo@riseup.net> a écrit :
>>Hi Ludovic,
>>
>>Ludovic Courtès writes:
>>
>>> Hello Guix!
>>>
>>>> A new POT file for textual domain 'guix-manual' has been made
>>available
>>>> to the language teams for translation. It is archived as:
>>>>
>>>>
>>https://translationproject.org/POT-files/guix-manual-1.0.0-pre1.pot
>>>
>>> Now’s the right time to translate Guix and the manual so that 1.0 is
>>> available in your native language!
>>>
>>> https://translationproject.org/domain/guix.html
>>> https://translationproject.org/domain/guix-packages.html
>>> https://translationproject.org/domain/guix-manual.html
>>
>>I can translate the Guix manual into Chinese if no one else is willing
>>to do so. But I don't have much time and will probably miss the
>>deadline for Guix 1.0.
>>
>>I have no previous experience with i18n. What should I know in order
>>to
>>translate the Guix manual? How do I edit the ".pot" file? Is there an
>>emacs package for the job?
>>
>>--
>>Meiyo Peng
>>https://www.pengmeiyu.com/
>
> Hi!
>
> I'm glal you're willing to translate to your native language! So get started, you need to register with the translation project for your language. You do not need to sign the waiver form for guix, so it should be rather quick.
>
> To start working on translations, you'll have to download the pot file from the TP. Do not use the one in our repository. Then I know there is an emacs mode for gettext, but I don't know how to use it. You can also use poedit which is easy to use and can import pot files. In any case you'll have to produce a po file, which is very similar to the pot file, except for some headers. I also started developping offlate (https://framagit.org/tyreunom/offlate) that can automate fetching from the TP and sending to them, but it's not as good as I'd want.
>
> Once you have translated, you'll have to send your work to the TP robot. You can do that even if your work is only partial.
>
> I think the priority is to translate the guix domain first, before the manual. Make sure noone is listed as responsible for the translation on the TP and you should be good.
>
> Thank you!
Thank you for your instructions. I will try it no later than next week.
--
Meiyo Peng
https://www.pengmeiyu.com/
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Let’s translate!
2019-04-13 6:45 ` pelzflorian (Florian Pelz)
2019-04-13 7:49 ` pelzflorian (Florian Pelz)
@ 2019-04-13 9:33 ` Meiyo Peng
1 sibling, 0 replies; 29+ messages in thread
From: Meiyo Peng @ 2019-04-13 9:33 UTC (permalink / raw)
To: pelzflorian (Florian Pelz); +Cc: guix-devel
Hi pelzflorian,
pelzflorian (Florian Pelz) writes:
> On Sat, Apr 13, 2019 at 09:56:31AM +0800, Meiyo Peng wrote:
>> I have no previous experience with i18n. What should I know in order to
>> translate the Guix manual? How do I edit the ".pot" file? Is there an
>> emacs package for the job?
>>
>
> emacs’ po-mode is part of gettext.
>
> You will also need to join the Translation Project:
>
> https://translationproject.org/team/index.html
>
>
>
> You need to put your translations in a .po file, not in the .pot file.
> This is what I did back then (once there is a po file it is no longer
> this complicated). I am not sure if there are easier ways to test an
> initial po file.
>
> On Sat, Oct 27, 2018 at 02:55:10AM +0200, pelzflorian (Florian Pelz) wrote:
>> I’m not sure what doc/htmlxref.cnf is for, but I did this to my copy
>> of Guix to get the PO going, now that Julien Lepiller has paved the
>> way by adding PO4A:
>>
>> cd ~/git/guix
>> guix environment guix --ad-hoc po4a
>>
>
> Then I did this but it was not the right command:
>
>> # if you do not have a po file yet:
>> msginit -i po/doc/guix-manual.pot -o po/doc/guix-manual.de.po -l de_DE
>
> You should not need to do this msginit. You should instead use the po
> file at the Translation Project if they have one for your language
> team. If not, then you should not use po/doc/guix-manual.pot as I did
> but use the .pot file at
> https://translationproject.org/domain/guix-manual.html or else the
> Translation Project will not accept the po.
>
> Then:
>
>> # (in the newly created po file, adjust the version.texi to be
>> # version-de.texi, contributing.texi to be contributing-de.texi and translate
>> # the table of contents)
>> # (adjust doc/htmlxref.cnf doc/local.mk po/doc/local.mk to list your
>> # language next to the existing translations, in lexicographic order)
>>
>> # then:
>> po4a-translate -f texinfo -m doc/guix.texi -p po/doc/guix-manual.de.po \
>> -M UTF-8 -k 0 -l doc/guix.de.texi # ignore outdated warning
>> po4a-translate -f texinfo -m doc/contributing.texi -p po/doc/guix-manual.de.po \
>> -M UTF-8 -k 0 -l doc/contributing.de.texi # ignore warning
>> ./bootstrap
>> ./configure
>> make # only needs to run past MAKEINFO; probably some of the GEN doc/os-config…
>> # and po4a steps do the right thing
>> ./bootstrap # only now bootstrap will detect that it needs guix.de.info
>> ./configure
>>
>> make doc-pot-update # if desired
>> make po/doc/guix-manual.de.po
>>
>> rm doc/guix.de.texi
>> rm doc/contributing.de.texi
>> make doc/guix.de.info
>>
>
> You should check if you get a working manual before submitting the po
> file to the Translation Project robot’s e-mail.
>
> Regards,
> Florian
I am still not clear of the procedures. But thank you anyway! I will
start the work as soon as possible.
--
Meiyo Peng
https://www.pengmeiyu.com/
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Let’s translate!
2019-04-13 7:49 ` Let’s translate! znavko
@ 2019-04-13 9:46 ` Meiyo Peng
0 siblings, 0 replies; 29+ messages in thread
From: Meiyo Peng @ 2019-04-13 9:46 UTC (permalink / raw)
To: znavko; +Cc: guix-devel
Hi znavko,
znavko@disroot.org writes:
> I've found this emacs config (~/.emacs) in linux.org.ru, that makes workable emacs commands (such as C-c C-c) when keyboard layout is not English. It works for me in Russian layout, and Chinese too as I tried.
>
> ;;Make emacs commands work when keyboard layout is not English
> (defun reverse-input-method (input-method)
> "Build the reverse mapping of single letters from INPUT-METHOD."
> (interactive
> (list (read-input-method-name "Use input method (default current): ")))
> (if (and input-method (symbolp input-method))
> (setq input-method (symbol-name input-method)))
> (let ((current current-input-method)
> (modifiers '(nil (control) (meta) (control meta))))
> (when input-method
> (activate-input-method input-method))
> (when (and current-input-method quail-keyboard-layout)
> (dolist (map (cdr (quail-map)))
> (let* ((to (car map))
> (from (quail-get-translation
> (cadr map) (char-to-string to) 1)))
> (when (and (characterp from) (characterp to))
> (dolist (mod modifiers)
> (define-key local-function-key-map
> (vector (append mod (list from)))
> (vector (append mod (list to)))))))))
> (when input-method
> (activate-input-method current))))
>
> (defadvice read-passwd (around my-read-passwd act)
> (let ((local-function-key-map nil))
> ad-do-it))
>
> (reverse-input-method 'russian-computer)
>
>
> There are suggestions for emacs config to make po-mode by default and also ispell spellchecker in my blog:
> dev-znavko.pantheonsite.io
>
> Hope it helps!
Thank you for the trick. The default behavior of Emacs is indeed
annoying if a special input method is enabled. But I only enable
Chinese Input Method when I input Chinese characters. That's less than
1% of my time with Emacs. So I am OK with the default behavior.
--
Meiyo Peng
https://www.pengmeiyu.com/
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: Let’s translate!
2019-04-13 1:56 ` Meiyo Peng
` (2 preceding siblings ...)
2019-04-13 7:49 ` Let’s translate! znavko
@ 2019-04-15 12:38 ` Ludovic Courtès
3 siblings, 0 replies; 29+ messages in thread
From: Ludovic Courtès @ 2019-04-15 12:38 UTC (permalink / raw)
To: Meiyo Peng; +Cc: guix-devel
Hi Meiyo,
Meiyo Peng <meiyo@riseup.net> skribis:
> I can translate the Guix manual into Chinese if no one else is willing
> to do so. But I don't have much time and will probably miss the
> deadline for Guix 1.0.
Julien and Florian can provide guidance, as you’ve seen. :-)
As for the deadline: even a partially translated manual can help. When
you have something that you deem useful (for example, you translated the
intro and the installation sections), then you can probably submit them
to the Translation Project so that we can integrate it.
Thank you!
Ludo’.
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 0/2] Removal of generated files (was Re: Let’s translate!)
2019-04-13 7:14 ` Julien Lepiller
2019-04-13 9:27 ` Meiyo Peng
@ 2019-04-23 0:42 ` Miguel
2019-04-23 0:43 ` [PATCH 1/2] bootstrap: Break automake dependency on generated files. " Miguel
[not found] ` <20190423024427.10cd6e87@gmail.com>
1 sibling, 2 replies; 29+ messages in thread
From: Miguel @ 2019-04-23 0:42 UTC (permalink / raw)
To: Julien Lepiller; +Cc: guix-devel
Hello everybody!
I'm currently working on the Spanish translation for the manual,
although I will send the guix domain translation as soon as TP
coordinators change the assignation.
Regarding the translation process, I think we should remove, at least,
the generated files from the repository. AFAIK the only show-stopper is
automake. It reads the translated files before make invocation, so the
manual .texi files are needed for the bootstrap, even though they are
listed in BUILT_SOURCES. guix/self.scm scan their content too in order
to generate version-LL.texi. Stubs could be generated before calling
autoreconf inside bootstrap script.
After that change, adding the spanish (or any new) translation should be
only matter of applying a patch like the second one, but with more
translated content...
WDYT? Any ideas about automated synchronization with
translationproject.org as make update-po does?
Best regards,
Miguel
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: Let’s translate!)
2019-04-23 0:42 ` [PATCH 0/2] Removal of generated files (was Re: Let’s translate!) Miguel
@ 2019-04-23 0:43 ` Miguel
2019-04-23 7:28 ` Julien Lepiller
[not found] ` <20190423024427.10cd6e87@gmail.com>
1 sibling, 1 reply; 29+ messages in thread
From: Miguel @ 2019-04-23 0:43 UTC (permalink / raw)
To: Julien Lepiller; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: 0001-bootstrap-Break-automake-dependency-on-generated-fil.patch --]
[-- Type: text/x-patch, Size: 1029 bytes --]
From c5ed65b04c412a97674dd9129a0cac10500fdf7a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
<rosen644835@gmail.com>
Date: Tue, 23 Apr 2019 00:21:44 +0200
Subject: [PATCH 1/2] bootstrap: Break automake dependency on generated files.
* bootstrap: Generate stub files for the manual translations whose
generated files are not included in the VCS.
---
bootstrap | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/bootstrap b/bootstrap
index cb774bc737..62f6cb0fab 100755
--- a/bootstrap
+++ b/bootstrap
@@ -2,4 +2,16 @@
# Create the build system.
set -e -x
+
+# Generate stubs for translations.
+langs=`find po/doc -type f -name '*.po' \
+ | sed -e 's,guix-manual\.,,' \
+ | xargs -n 1 -I{} basename {} .po`
+for lang in ${langs}; do
+ if [ ! -e "doc/guix.${lang}.texi" ]; then
+ echo "@setfilename guix.${lang}.info" > "doc/guix.${lang}.texi"
+ echo "@include version-${lang}.texi" >> "doc/guix.${lang}.texi"
+ fi
+done
+
exec autoreconf -vfi
--
2.21.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: Let’s translate!)
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-23 14:30 ` Ludovic Courtès
0 siblings, 2 replies; 29+ messages in thread
From: Julien Lepiller @ 2019-04-23 7:28 UTC (permalink / raw)
To: Miguel; +Cc: guix-devel
Le 23 avril 2019 02:43:42 GMT+02:00, Miguel <rosen644835@gmail.com> a écrit :
>
This is a very good idea, but I think it leaves a stub texi that won't get rebuilt because it's younger than po files. What if we add a toucgh invocation to reset the modification time of these stubs, to ensure make will want to rebuild them?
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: Let’s translate!)
2019-04-23 7:28 ` Julien Lepiller
@ 2019-04-23 10:28 ` Miguel
2019-04-26 9:30 ` Julien Lepiller
2019-04-23 14:30 ` Ludovic Courtès
1 sibling, 1 reply; 29+ messages in thread
From: Miguel @ 2019-04-23 10:28 UTC (permalink / raw)
To: Julien Lepiller; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 682 bytes --]
Hi Julien,
First of all, thank you for your work.
El Tue, 23 Apr 2019 09:28:19 +0200
Julien Lepiller <julien@lepiller.eu> escribió:
> This is a very good idea, but I think it leaves a stub texi that
> won't get rebuilt because it's younger than po files.
Yes, you are right indeed. I didn't noticed because I was updating
the .po file manually.
> What if we add a toucgh invocation to reset the modification time
> of these stubs, to ensure make will want to rebuild them?
What about the attached patch? I've just tested it with the other
patch that seems to be missing or blocked by its size, nothing up my
sleeves this time. 0:-)
Best regards,
Miguel
[-- Attachment #2: 0001-bootstrap-Break-automake-dependency-on-generated-fil.patch --]
[-- Type: text/x-patch, Size: 1101 bytes --]
From fe873d65dd5795bdafc9eed66888f7d2e9bf6b4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
<rosen644835@gmail.com>
Date: Tue, 23 Apr 2019 11:30:32 +0200
Subject: [PATCH 1/4] bootstrap: Break automake dependency on generated files.
* bootstrap: Generate stub files for the manual translations whose
generated files are not included in the VCS.
---
bootstrap | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/bootstrap b/bootstrap
index cb774bc737..c0b5af7677 100755
--- a/bootstrap
+++ b/bootstrap
@@ -2,4 +2,18 @@
# Create the build system.
set -e -x
+
+# Generate stubs for translations.
+langs=`find po/doc -type f -name '*.po' \
+ | sed -e 's,guix-manual\.,,' \
+ | xargs -n 1 -I{} basename {} .po`
+for lang in ${langs}; do
+ if [ ! -e "doc/guix.${lang}.texi" ]; then
+ echo "@setfilename guix.${lang}.info" > "doc/guix.${lang}.texi"
+ echo "@include version-${lang}.texi" >> "doc/guix.${lang}.texi"
+ # Ensure .po file is newer.
+ touch "po/doc/guix-manual.${lang}.po"
+ fi
+done
+
exec autoreconf -vfi
--
2.21.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: Let’s translate!)
2019-04-23 7:28 ` Julien Lepiller
2019-04-23 10:28 ` Miguel
@ 2019-04-23 14:30 ` Ludovic Courtès
2019-04-23 22:51 ` Miguel
1 sibling, 1 reply; 29+ messages in thread
From: Ludovic Courtès @ 2019-04-23 14:30 UTC (permalink / raw)
To: Julien Lepiller; +Cc: guix-devel
Hello,
Julien Lepiller <julien@lepiller.eu> skribis:
> This is a very good idea, but I think it leaves a stub texi that won't get rebuilt because it's younger than po files. What if we add a toucgh invocation to reset the modification time of these stubs, to ensure make will want to rebuild them?
Also, I don’t actually use the ./bootstrap script. :-)
Shouldn’t we instead replace the existing %.texi targets in doc/local.mk
with a phony target like ‘update-texi’, and then add:
dist-hook: update-texi
?
This would be similar to the ‘update-po’ rule generated by Gettext in
po/.
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 2/2] doc: Add Spanish translation. (was Re: Let’s translate!)
[not found] ` <20190423024427.10cd6e87@gmail.com>
@ 2019-04-23 22:42 ` Ludovic Courtès
0 siblings, 0 replies; 29+ messages in thread
From: Ludovic Courtès @ 2019-04-23 22:42 UTC (permalink / raw)
To: Miguel; +Cc: guix-devel
¡Hola Miguel!
Miguel <rosen644835@gmail.com> skribis:
> From 1bb5dba99f87e3afefb4133617d71afc134e1ff1 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
> <rosen644835@gmail.com>
> Date: Tue, 23 Apr 2019 00:40:10 +0200
> Subject: [PATCH 2/2] doc: Add Spanish translation.
>
> * doc/local.mk (info_TEXINFOS): Add guix.es.texi.
> (TRANSLATED_INFO): Add guix.es.texi and contributing.es.texi.
> * po/doc/guix-manual.es.po: New file.
> * po/doc/local.mk: Add guix-manual.es.po.
Applied, thanks a lot!
If you ‘guix pull’ now, you should be able to run “info guix.es”. \o/
According to the stats at
<https://translationproject.org/domain/guix-manual.html>, Spanish debuts
at #2. :-)
(Thanks also for the translation note about gender neutrality in
Spanish, which is indeed as tricky as in French.)
Ludo’.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: Let’s translate!)
2019-04-23 14:30 ` Ludovic Courtès
@ 2019-04-23 22:51 ` Miguel
2019-04-24 10:37 ` Julien Lepiller
0 siblings, 1 reply; 29+ messages in thread
From: Miguel @ 2019-04-23 22:51 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Hi,
El Tue, 23 Apr 2019 16:30:26 +0200
Ludovic Courtès <ludo@gnu.org> escribió:
> Hello,
>
> Julien Lepiller <julien@lepiller.eu> skribis:
>
> > This is a very good idea, but I think it leaves a stub texi that
> > won't get rebuilt because it's younger than po files. What if we
> > add a toucgh invocation to reset the modification time of these
> > stubs, to ensure make will want to rebuild them?
>
> Also, I don’t actually use the ./bootstrap script. :-)
Currently it is only a call to autoreconf -fvi, but it's there for a
reason, isn't it?
> Shouldn’t we instead replace the existing %.texi targets in
> doc/local.mk with a phony target like ‘update-texi’, and then add:
>
> dist-hook: update-texi
>
> ?
The procedure needed currently to a new translation for the manual is:
1. modify doc/local.mk, po/doc/local.mk and so on.
2. guix.LL.texi must be manually generated somehow even though it is
listed in BUILT_SOURCES.
3. automake can run without errors with the rules in order to generate
the actual translated file.
4. The resulting files are committed.
The problem is that automake parses .texi files for the @setfilename
tag. On the other hand, guix.LL.texi and contributing.LL.texi are
generated files, and they shouldn't be on the VCS, just like neither
configure nor Makefile.in are, though they are distributed. My patch
tries to avoid this issue creating stub files that will be overwritten
with the actual content. This has the advantage of keeping clean git
status from other modifications than .po files changes.
This may sound familiar to this community, it actually is a bootstrap
problem. Running autoreconf -fvi actually tells you that that file is
missing, so that part is easy to fix. On the other hand, as far as I
tested if it does not contain a line with version-LL.texi,
version-LL.texi won't be generated.
Happy hacking,
Miguel
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: Let’s translate!)
2019-04-23 22:51 ` Miguel
@ 2019-04-24 10:37 ` Julien Lepiller
2019-04-25 8:50 ` Ludovic Courtès
0 siblings, 1 reply; 29+ messages in thread
From: Julien Lepiller @ 2019-04-24 10:37 UTC (permalink / raw)
To: Miguel; +Cc: guix-devel
Le Wed, 24 Apr 2019 00:51:37 +0200,
Miguel <rosen644835@gmail.com> a écrit :
> Hi,
>
> El Tue, 23 Apr 2019 16:30:26 +0200
> Ludovic Courtès <ludo@gnu.org> escribió:
> > Hello,
> >
> > Julien Lepiller <julien@lepiller.eu> skribis:
> >
> > > This is a very good idea, but I think it leaves a stub texi that
> > > won't get rebuilt because it's younger than po files. What if we
> > > add a toucgh invocation to reset the modification time of these
> > > stubs, to ensure make will want to rebuild them?
> >
> > Also, I don’t actually use the ./bootstrap script. :-)
>
> Currently it is only a call to autoreconf -fvi, but it's there for a
> reason, isn't it?
>
> > Shouldn’t we instead replace the existing %.texi targets in
> > doc/local.mk with a phony target like ‘update-texi’, and then add:
> >
> > dist-hook: update-texi
> >
> > ?
>
> The procedure needed currently to a new translation for the manual is:
> 1. modify doc/local.mk, po/doc/local.mk and so on.
> 2. guix.LL.texi must be manually generated somehow even though it is
> listed in BUILT_SOURCES.
> 3. automake can run without errors with the rules in order to
> generate the actual translated file.
> 4. The resulting files are committed.
>
> The problem is that automake parses .texi files for the @setfilename
> tag. On the other hand, guix.LL.texi and contributing.LL.texi are
> generated files, and they shouldn't be on the VCS, just like neither
> configure nor Makefile.in are, though they are distributed. My patch
> tries to avoid this issue creating stub files that will be overwritten
> with the actual content. This has the advantage of keeping clean git
> status from other modifications than .po files changes.
>
> This may sound familiar to this community, it actually is a bootstrap
> problem. Running autoreconf -fvi actually tells you that that file is
> missing, so that part is easy to fix. On the other hand, as far as I
> tested if it does not contain a line with version-LL.texi,
> version-LL.texi won't be generated.
>
> Happy hacking,
> Miguel
I actually agree with Miguel here. The phony target would not allow us
to update the manual. It's probably a matter of preferences, but I
prefer an up to date manual with some English sentences than a fully
translated but outdated manual. I wouldn't use a manual that could
refer to an older version.
Also Miguel's solution looks a lot more clean in the bootstrapping
point of view, and I think this is a strong argument in this
community :)
You will only be bothered when new translations appear, in which case
you'll have to run ./bootstrap again, but on the other hand, you will
never be bothered by *.texi files being changed all the time.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: Let’s translate!)
2019-04-24 10:37 ` Julien Lepiller
@ 2019-04-25 8:50 ` Ludovic Courtès
2019-04-25 9:54 ` Julien Lepiller
0 siblings, 1 reply; 29+ messages in thread
From: Ludovic Courtès @ 2019-04-25 8:50 UTC (permalink / raw)
To: Julien Lepiller; +Cc: guix-devel
Hello,
Julien Lepiller <julien@lepiller.eu> skribis:
> Le Wed, 24 Apr 2019 00:51:37 +0200,
> Miguel <rosen644835@gmail.com> a écrit :
[...]
>> El Tue, 23 Apr 2019 16:30:26 +0200
>> Ludovic Courtès <ludo@gnu.org> escribió:
>> > Also, I don’t actually use the ./bootstrap script. :-)
>>
>> Currently it is only a call to autoreconf -fvi, but it's there for a
>> reason, isn't it?
It’s there mostly because people are used to having such a file, but I
like the fact that it does nothing magical.
> I actually agree with Miguel here. The phony target would not allow us
> to update the manual. It's probably a matter of preferences, but I
> prefer an up to date manual with some English sentences than a fully
> translated but outdated manual. I wouldn't use a manual that could
> refer to an older version.
I agree that up-to-date is preferable.
> You will only be bothered when new translations appear, in which case
> you'll have to run ./bootstrap again, but on the other hand, you will
> never be bothered by *.texi files being changed all the time.
So what would one have to do when preparing a new release? Presumably
nothing because the up-to-date texi files would be checked in?
IOW, running ./bootstrap is something what would matter primarily to
translators, is that correct?
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: Let’s translate!)
2019-04-25 8:50 ` Ludovic Courtès
@ 2019-04-25 9:54 ` Julien Lepiller
2019-04-26 8:39 ` Ludovic Courtès
0 siblings, 1 reply; 29+ messages in thread
From: Julien Lepiller @ 2019-04-25 9:54 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Le 25 avril 2019 10:50:16 GMT+02:00, "Ludovic Courtès" <ludo@gnu.org> a écrit :
>Hello,
>
>Julien Lepiller <julien@lepiller.eu> skribis:
>
>> Le Wed, 24 Apr 2019 00:51:37 +0200,
>> Miguel <rosen644835@gmail.com> a écrit :
>
>[...]
>
>>> El Tue, 23 Apr 2019 16:30:26 +0200
>>> Ludovic Courtès <ludo@gnu.org> escribió:
>
>>> > Also, I don’t actually use the ./bootstrap script. :-)
>>>
>>> Currently it is only a call to autoreconf -fvi, but it's there for a
>>> reason, isn't it?
>
>It’s there mostly because people are used to having such a file, but I
>like the fact that it does nothing magical.
>
>> I actually agree with Miguel here. The phony target would not allow
>us
>> to update the manual. It's probably a matter of preferences, but I
>> prefer an up to date manual with some English sentences than a fully
>> translated but outdated manual. I wouldn't use a manual that could
>> refer to an older version.
>
>I agree that up-to-date is preferable.
>
>> You will only be bothered when new translations appear, in which case
>> you'll have to run ./bootstrap again, but on the other hand, you will
>> never be bothered by *.texi files being changed all the time.
>
>So what would one have to do when preparing a new release? Presumably
>nothing because the up-to-date texi files would be checked in?
>
>IOW, running ./bootstrap is something what would matter primarily to
>translators, is that correct?
It would be needed to build the translated manuals, so I think it would be needed to successfuly run make from the git checkout. Translators should not even care about the source. Or maybe running only autoreconf will simply not build the translated manuals, I'm not sure.
But once you run ./bootstrap once, you should not have to run it again until a new language is available for the manual.
>
>Thanks,
>Ludo’.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: Let’s translate!)
2019-04-25 9:54 ` Julien Lepiller
@ 2019-04-26 8:39 ` Ludovic Courtès
0 siblings, 0 replies; 29+ messages in thread
From: Ludovic Courtès @ 2019-04-26 8:39 UTC (permalink / raw)
To: Julien Lepiller; +Cc: guix-devel
Salut Julien,
Julien Lepiller <julien@lepiller.eu> skribis:
> Le 25 avril 2019 10:50:16 GMT+02:00, "Ludovic Courtès" <ludo@gnu.org> a écrit :
[...]
>>> You will only be bothered when new translations appear, in which case
>>> you'll have to run ./bootstrap again, but on the other hand, you will
>>> never be bothered by *.texi files being changed all the time.
>>
>>So what would one have to do when preparing a new release? Presumably
>>nothing because the up-to-date texi files would be checked in?
>>
>>IOW, running ./bootstrap is something what would matter primarily to
>>translators, is that correct?
>
> It would be needed to build the translated manuals, so I think it would be needed to successfuly run make from the git checkout. Translators should not even care about the source. Or maybe running only autoreconf will simply not build the translated manuals, I'm not sure.
>
> But once you run ./bootstrap once, you should not have to run it again until a new language is available for the manual.
I see, sounds good to me.
I think you can go ahead and push!
Thanks for explaining,
Ludo’.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: Let’s translate!)
2019-04-23 10:28 ` Miguel
@ 2019-04-26 9:30 ` Julien Lepiller
2019-04-26 11:05 ` Miguel
0 siblings, 1 reply; 29+ messages in thread
From: Julien Lepiller @ 2019-04-26 9:30 UTC (permalink / raw)
To: Miguel; +Cc: guix-devel
Le Tue, 23 Apr 2019 12:28:10 +0200,
Miguel <rosen644835@gmail.com> a écrit :
> Hi Julien,
>
> First of all, thank you for your work.
>
> El Tue, 23 Apr 2019 09:28:19 +0200
> Julien Lepiller <julien@lepiller.eu> escribió:
> > This is a very good idea, but I think it leaves a stub texi that
> > won't get rebuilt because it's younger than po files.
>
> Yes, you are right indeed. I didn't noticed because I was updating
> the .po file manually.
>
> > What if we add a toucgh invocation to reset the modification time
> > of these stubs, to ensure make will want to rebuild them?
>
> What about the attached patch? I've just tested it with the other
> patch that seems to be missing or blocked by its size, nothing up my
> sleeves this time. 0:-)
>
> Best regards,
> Miguel
Thank you! I've just pushed it and removed doc/guix.*.texi and
doc/contributing.*.texi from the repository, added them to .gitignore
too.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: Let’s translate!)
2019-04-26 9:30 ` Julien Lepiller
@ 2019-04-26 11:05 ` Miguel
2019-04-26 18:55 ` Julien Lepiller
0 siblings, 1 reply; 29+ messages in thread
From: Miguel @ 2019-04-26 11:05 UTC (permalink / raw)
To: Julien Lepiller; +Cc: guix-devel
Hi,
El Fri, 26 Apr 2019 11:30:04 +0200
Julien Lepiller <julien@lepiller.eu> escribió:
> Thank you! I've just pushed it and removed doc/guix.*.texi and
> doc/contributing.*.texi from the repository, added them to .gitignore
> too.
Thank you very much, my emacs and magit will thank you too, as each
change in the manual was taking awfully long to refresh. :)
Best regards,
Miguel
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: Let’s translate!)
2019-04-26 11:05 ` Miguel
@ 2019-04-26 18:55 ` Julien Lepiller
2019-04-26 22:10 ` Ludovic Courtès
0 siblings, 1 reply; 29+ messages in thread
From: Julien Lepiller @ 2019-04-26 18:55 UTC (permalink / raw)
To: Miguel; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 643 bytes --]
Le Fri, 26 Apr 2019 13:05:14 +0200,
Miguel <rosen644835@gmail.com> a écrit :
> Hi,
>
> El Fri, 26 Apr 2019 11:30:04 +0200
> Julien Lepiller <julien@lepiller.eu> escribió:
> > Thank you! I've just pushed it and removed doc/guix.*.texi and
> > doc/contributing.*.texi from the repository, added them
> > to .gitignore too.
>
> Thank you very much, my emacs and magit will thank you too, as each
> change in the manual was taking awfully long to refresh. :)
>
> Best regards,
> Miguel
There was an issue introduced by that patch: the manual was not
generated by guix pull anymore. The attached patch fixes that. WDYT?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-self-Rebuild-translated-manuals.patch --]
[-- Type: text/x-patch, Size: 8405 bytes --]
From d93644846ff954c221c2510755766da3f0e27b5c 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/self.scm | 116 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 115 insertions(+), 1 deletion(-)
diff --git a/guix/self.scm b/guix/self.scm
index 2a10d1d25f..89d3212f52 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -60,6 +60,8 @@
("gzip" (ref '(gnu packages compression) 'gzip))
("bzip2" (ref '(gnu packages compression) 'bzip2))
("xz" (ref '(gnu packages compression) 'xz))
+ ("po4a" (ref '(gnu packages gettext) 'po4a))
+ ("gettext" (ref '(gnu packages gettext) 'gettext-minimal))
(_ #f)))) ;no such package
\f
@@ -255,6 +257,12 @@ DOMAIN, a gettext domain."
(define (info-manual source)
"Return the Info manual built from SOURCE."
+ (define po4a
+ (specification->package "po4a"))
+
+ (define gettext
+ (specification->package "gettext"))
+
(define texinfo
(module-ref (resolve-interface '(gnu packages texinfo))
'texinfo))
@@ -270,6 +278,9 @@ DOMAIN, a gettext domain."
(define documentation
(file-append* source "doc"))
+ (define documentation-po
+ (file-append* source "po/doc"))
+
(define examples
(file-append* source "gnu/system/examples"))
@@ -277,6 +288,49 @@ DOMAIN, a gettext domain."
(with-imported-modules '((guix build utils))
#~(begin
(use-modules (guix build utils))
+ (use-modules (ice-9 match))
+ (use-modules (ice-9 peg))
+ (use-modules (ice-9 regex))
+ (use-modules (ice-9 textual-ports))
+ (use-modules (srfi srfi-1))
+
+ ;; A small parser for po files
+ (define-peg-pattern po-file body (* (or comment entry whitespace)))
+ (define-peg-pattern whitespace body (or " " "\t" "\n"))
+ (define-peg-pattern comment-chr body (range #\space #\頋))
+ (define-peg-pattern comment none (and "#" (* comment-chr) "\n"))
+ (define-peg-pattern entry all
+ (and (ignore (* whitespace)) (ignore "msgid ") msgid
+ (ignore (* whitespace)) (ignore "msgstr ") msgstr))
+ (define-peg-pattern escape body (or "\\\\" "\\\"" "\\n"))
+ (define-peg-pattern str-chr body (or " " "!" (and (ignore "\\") "\"")
+ "\\n" (and (ignore "\\") "\\")
+ (range #\# #\頋)))
+ (define-peg-pattern msgid all content)
+ (define-peg-pattern msgstr all content)
+ (define-peg-pattern content body
+ (and (ignore "\"") (* str-chr) (ignore "\"")
+ (? (and (ignore (* whitespace)) content))))
+
+ (define (parse-tree->assoc parse-tree)
+ "Converts a po PARSE-TREE to an association list."
+ (define regex (make-regexp "\\\\n"))
+ (match parse-tree
+ ('() '())
+ ((entry parse-tree ...)
+ (match entry
+ ((? string? entry)
+ (parse-tree->assoc parse-tree))
+ ;; empty msgid
+ (('entry ('msgid ('msgstr msgstr)))
+ (parse-tree->assoc parse-tree))
+ ;; empty msgstr
+ (('entry ('msgid msgid) 'msgstr)
+ (parse-tree->assoc parse-tree))
+ (('entry ('msgid msgid) ('msgstr msgstr))
+ (acons (regexp-substitute/global #f regex msgid 'pre "\n" 'post)
+ (regexp-substitute/global #f regex msgstr 'pre "\n" 'post)
+ (parse-tree->assoc parse-tree)))))))
(mkdir #$output)
@@ -322,11 +376,15 @@ DOMAIN, a gettext domain."
(find-files (string-append #$documentation "/images")
"\\.png$"))
- ;; Finally build the manual. Copy it the Texinfo files to $PWD and
+ ;; Finally build the manual. Copy it the Texinfo and po files to $PWD and
;; add a symlink to the 'images' directory so that 'makeinfo' can
;; see those images and produce image references in the Info output.
(copy-recursively #$documentation "."
#:log (%make-void-port "w"))
+ (for-each
+ (lambda (file)
+ (copy-file file (basename file)))
+ (find-files #$documentation-po ".*.po$"))
(delete-file-recursively "images")
(symlink (string-append #$output "/images") "images")
@@ -334,6 +392,62 @@ DOMAIN, a gettext domain."
(setenv "GUIX_LOCPATH"
#+(file-append glibc-utf8-locales "/lib/locale"))
+ (setenv "LC_ALL" "en_US.UTF-8")
+ (setlocale LC_ALL "en_US.UTF-8")
+
+ (define (create-texi po source texi-name)
+ (let* ((parse-tree
+ (peg:tree (match-pattern
+ po-file
+ (call-with-input-file po get-string-all))))
+ (translations (parse-tree->assoc parse-tree))
+ (tmp-name (string-append texi-name ".tmp")))
+ (setenv "PATH" #+(file-append gettext "/bin"))
+ (invoke #+(file-append po4a "/bin/po4a-translate")
+ "-M" "UTF-8" "-L" "UTF-8" "-k" "0" "-f" "texinfo"
+ "-m" source "-p" po "-l" tmp-name)
+ (with-output-to-file texi-name
+ (lambda _
+ (format #t "~a"
+ (fold
+ (lambda (elem content)
+ (let* ((msgid (car elem))
+ (msgstr (cdr elem)))
+ (if (or (equal? msgstr "")
+ (string-any (lambda (chr)
+ (member chr '(#\{ #\} #\( #\)
+ #\newline #\,)))
+ msgid))
+ content
+ (let ((regexp1
+ (make-regexp
+ (string-append
+ "ref\\{"
+ (string-join
+ (string-split msgid #\ ) "[ \n]+")
+ ","))))
+ (let ((regexp2
+ (make-regexp
+ (string-append
+ "ref\\{"
+ (string-join
+ (string-split msgid #\ ) "[ \n]+")
+ "\\}"))))
+ (regexp-substitute/global
+ #f regexp2
+ (regexp-substitute/global
+ #f regexp1 content 'pre "ref{" msgstr "," 'post)
+ 'pre "ref{" msgstr "}" 'post))))))
+ (call-with-input-file tmp-name get-string-all)
+ translations))))))
+ (for-each (lambda (po)
+ (let ((lang (cadr (reverse (string-split po #\.)))))
+ (create-texi po "guix.texi"
+ (string-append "guix." lang ".texi"))
+ (create-texi po "contributing.texi"
+ (string-append "contributing." lang ".texi"))))
+ (find-files "." "^guix-manual\\.[a-z]{2}(_[A-Z]{2})?\\.po$"))
+
(for-each (lambda (texi)
(unless (string=? "guix.texi" texi)
;; Create 'version-LL.texi'.
--
2.21.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: Let’s translate!)
2019-04-26 18:55 ` Julien Lepiller
@ 2019-04-26 22:10 ` Ludovic Courtès
2019-04-27 12:32 ` Julien Lepiller
0 siblings, 1 reply; 29+ messages in thread
From: Ludovic Courtès @ 2019-04-26 22:10 UTC (permalink / raw)
To: Julien Lepiller; +Cc: guix-devel
Hi Julien!
Julien Lepiller <julien@lepiller.eu> skribis:
> There was an issue introduced by that patch: the manual was not
> generated by guix pull anymore. The attached patch fixes that. WDYT?
Neat!
> From d93644846ff954c221c2510755766da3f0e27b5c 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.
[...]
> (define (info-manual source)
> "Return the Info manual built from SOURCE."
We should probably make a separate derivation (and a separate procedure)
to build the translated Texi files. Maybe we can think about it later,
though.
> (with-imported-modules '((guix build utils))
> #~(begin
> (use-modules (guix build utils))
> + (use-modules (ice-9 match))
> + (use-modules (ice-9 peg))
> + (use-modules (ice-9 regex))
> + (use-modules (ice-9 textual-ports))
> + (use-modules (srfi srfi-1))
Please make it a single \x18use-modules\x19:
(use-modules (a b c) (x y z) &)
> + ;; A small parser for po files
> + (define-peg-pattern po-file body (* (or comment entry whitespace)))
> + (define-peg-pattern whitespace body (or " " "\t" "\n"))
> + (define-peg-pattern comment-chr body (range #\space #\.¿))
> + (define-peg-pattern comment none (and "#" (* comment-chr) "\n"))
> + (define-peg-pattern entry all
> + (and (ignore (* whitespace)) (ignore "msgid ") msgid
> + (ignore (* whitespace)) (ignore "msgstr ") msgstr))
> + (define-peg-pattern escape body (or "\\\\" "\\\"" "\\n"))
> + (define-peg-pattern str-chr body (or " " "!" (and (ignore "\\") "\"")
> + "\\n" (and (ignore "\\") "\\")
> + (range #\# #\.¿)))
> + (define-peg-pattern msgid all content)
> + (define-peg-pattern msgstr all content)
> + (define-peg-pattern content body
> + (and (ignore "\"") (* str-chr) (ignore "\"")
> + (? (and (ignore (* whitespace)) content))))
> +
> + (define (parse-tree->assoc parse-tree)
> + "Converts a po PARSE-TREE to an association list."
> + (define regex (make-regexp "\\\\n"))
> + (match parse-tree
> + ('() '())
> + ((entry parse-tree ...)
> + (match entry
> + ((? string? entry)
> + (parse-tree->assoc parse-tree))
> + ;; empty msgid
> + (('entry ('msgid ('msgstr msgstr)))
> + (parse-tree->assoc parse-tree))
> + ;; empty msgstr
> + (('entry ('msgid msgid) 'msgstr)
> + (parse-tree->assoc parse-tree))
> + (('entry ('msgid msgid) ('msgstr msgstr))
> + (acons (regexp-substitute/global #f regex msgid 'pre "\n" 'post)
> + (regexp-substitute/global #f regex msgstr 'pre "\n" 'post)
> + (parse-tree->assoc parse-tree)))))))
What about moving all this to (guix build po) or similar? It would
export \x18read-po-file\x19, which takes an input port and returns an alist of
message ID/translations. I don\x19t want to think about parse trees as a
user of the API. :-)
> + (define (create-texi po source texi-name)
This function is too long, could you split it?
Maybe it should be called \x18translate-texi\x19?
> + (let* ((parse-tree
> + (peg:tree (match-pattern
> + po-file
> + (call-with-input-file po get-string-all))))
> + (translations (parse-tree->assoc parse-tree))
> + (tmp-name (string-append texi-name ".tmp")))
> + (setenv "PATH" #+(file-append gettext "/bin"))
> + (invoke #+(file-append po4a "/bin/po4a-translate")
> + "-M" "UTF-8" "-L" "UTF-8" "-k" "0" "-f" "texinfo"
> + "-m" source "-p" po "-l" tmp-name)
> + (with-output-to-file texi-name
> + (lambda _
> + (format #t "~a"
> + (fold
> + (lambda (elem content)
> + (let* ((msgid (car elem))
> + (msgstr (cdr elem)))
Please use \x18match\x19.
> + (if (or (equal? msgstr "")
> + (string-any (lambda (chr)
> + (member chr '(#\{ #\} #\( #\)
> + #\newline #\,)))
> + msgid))
> + content
> + (let ((regexp1
> + (make-regexp
> + (string-append
> + "ref\\{"
> + (string-join
> + (string-split msgid #\ ) "[ \n]+")
> + ","))))
> + (let ((regexp2
> + (make-regexp
> + (string-append
> + "ref\\{"
> + (string-join
> + (string-split msgid #\ ) "[ \n]+")
> + "\\}"))))
> + (regexp-substitute/global
> + #f regexp2
> + (regexp-substitute/global
> + #f regexp1 content 'pre "ref{" msgstr "," 'post)
> + 'pre "ref{" msgstr "}" 'post))))))
I guess this could become the body of a \x18translate-cross-reference\x19
procedure or similar?
> + (for-each (lambda (po)
> + (let ((lang (cadr (reverse (string-split po #\.)))))
Use \x18match\x19.
Could you send an updated patch?
Thank you!
Ludo\x19.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: Let’s translate!)
2019-04-26 22:10 ` Ludovic Courtès
@ 2019-04-27 12:32 ` Julien Lepiller
2019-04-27 13:52 ` Ludovic Courtès
0 siblings, 1 reply; 29+ messages in thread
From: Julien Lepiller @ 2019-04-27 12:32 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 206 bytes --]
Le Sat, 27 Apr 2019 00:10:04 +0200,
Ludovic Courtès <ludo@gnu.org> a écrit :
> Hi Julien!
>
>
> Could you send an updated patch?
>
> Thank you!
>
> Ludo\x19.
Attached is an updated patch.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-self-Rebuild-translated-manuals.patch --]
[-- Type: text/x-patch, Size: 11147 bytes --]
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.
---
Makefile.am | 1 +
guix/build/po.scm | 69 +++++++++++++++++++++++++
guix/self.scm | 128 +++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 197 insertions(+), 1 deletion(-)
create mode 100644 guix/build/po.scm
diff --git a/Makefile.am b/Makefile.am
index 99d6ed64b6..272330c3a9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -156,6 +156,7 @@ MODULES = \
guix/build/meson-build-system.scm \
guix/build/minify-build-system.scm \
guix/build/font-build-system.scm \
+ guix/build/po.scm \
guix/build/go-build-system.scm \
guix/build/asdf-build-system.scm \
guix/build/git.scm \
diff --git a/guix/build/po.scm b/guix/build/po.scm
new file mode 100644
index 0000000000..3fbe9b2373
--- /dev/null
+++ b/guix/build/po.scm
@@ -0,0 +1,69 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Julien Lepiller <julien@lepiller.eu>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (guix build po)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 peg)
+ #:use-module (ice-9 regex)
+ #:use-module (ice-9 textual-ports)
+ #:export (read-po-file))
+
+;; A small parser for po files
+(define-peg-pattern po-file body (* (or comment entry whitespace)))
+(define-peg-pattern whitespace body (or " " "\t" "\n"))
+(define-peg-pattern comment-chr body (range #\space #\頋))
+(define-peg-pattern comment none (and "#" (* comment-chr) "\n"))
+(define-peg-pattern entry all
+ (and (ignore (* whitespace)) (ignore "msgid ") msgid
+ (ignore (* whitespace)) (ignore "msgstr ") msgstr))
+(define-peg-pattern escape body (or "\\\\" "\\\"" "\\n"))
+(define-peg-pattern str-chr body (or " " "!" (and (ignore "\\") "\"")
+ "\\n" (and (ignore "\\") "\\")
+ (range #\# #\頋)))
+(define-peg-pattern msgid all content)
+(define-peg-pattern msgstr all content)
+(define-peg-pattern content body
+ (and (ignore "\"") (* str-chr) (ignore "\"")
+ (? (and (ignore (* whitespace)) content))))
+
+(define (parse-tree->assoc parse-tree)
+ "Converts a po PARSE-TREE to an association list."
+ (define regex (make-regexp "\\\\n"))
+ (match parse-tree
+ ('() '())
+ ((entry parse-tree ...)
+ (match entry
+ ((? string? entry)
+ (parse-tree->assoc parse-tree))
+ ;; empty msgid
+ (('entry ('msgid ('msgstr msgstr)))
+ (parse-tree->assoc parse-tree))
+ ;; empty msgstr
+ (('entry ('msgid msgid) 'msgstr)
+ (parse-tree->assoc parse-tree))
+ (('entry ('msgid msgid) ('msgstr msgstr))
+ (acons (regexp-substitute/global #f regex msgid 'pre "\n" 'post)
+ (regexp-substitute/global #f regex msgstr 'pre "\n" 'post)
+ (parse-tree->assoc parse-tree)))))))
+
+(define (read-po-file port)
+ "Read a .po file from PORT and returns an alist of msgid and msgstr."
+ (let ((tree (peg:tree (match-pattern
+ po-file
+ (get-string-all port)))))
+ (parse-tree->assoc tree)))
diff --git a/guix/self.scm b/guix/self.scm
index 2a10d1d25f..3c60da6308 100644
--- a/guix/self.scm
+++ b/guix/self.scm
@@ -60,6 +60,8 @@
("gzip" (ref '(gnu packages compression) 'gzip))
("bzip2" (ref '(gnu packages compression) 'bzip2))
("xz" (ref '(gnu packages compression) 'xz))
+ ("po4a" (ref '(gnu packages gettext) 'po4a))
+ ("gettext" (ref '(gnu packages gettext) 'gettext-minimal))
(_ #f)))) ;no such package
\f
@@ -253,8 +255,130 @@ DOMAIN, a gettext domain."
(computed-file (string-append "guix-locale-" domain)
build))
+(define (translate-texi-manuals source)
+ "Retrun the translated texinfo manuals built from SOURCE"
+ (define po4a
+ (specification->package "po4a"))
+
+ (define gettext
+ (specification->package "gettext"))
+
+ (define glibc-utf8-locales
+ (module-ref (resolve-interface '(gnu packages base))
+ 'glibc-utf8-locales))
+
+ (define documentation
+ (file-append* source "doc"))
+
+ (define documentation-po
+ (file-append* source "po/doc"))
+
+ (define build
+ (with-imported-modules '((guix build utils) (guix build po))
+ #~(begin
+ (use-modules (guix build utils) (guix build po)
+ (ice-9 match) (ice-9 regex) (ice-9 textual-ports)
+ (srfi srfi-1))
+
+ (mkdir #$output)
+
+ (copy-recursively #$documentation "."
+ #:log (%make-void-port "w"))
+
+ (for-each
+ (lambda (file)
+ (copy-file file (basename file)))
+ (find-files #$documentation-po ".*.po$"))
+
+ (setenv "GUIX_LOCPATH"
+ #+(file-append glibc-utf8-locales "/lib/locale"))
+ (setenv "PATH" #+(file-append gettext "/bin"))
+ (setenv "LC_ALL" "en_US.UTF-8")
+ (setlocale LC_ALL "en_US.UTF-8")
+
+ (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))
+
+ (define (make-ref-regex msgid end)
+ (make-regexp (string-append
+ "ref\\{" (string-join (string-split msgid #\ ) "[ \n]+")
+ end)))
+
+ (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
+TRANSLATIONS, an alist of msgid and msgstr."
+ (fold
+ (lambda (elem content)
+ (match elem
+ ((msgid . msgstr)
+ ;; Empty translations and strings containing some special characters
+ ;; cannot be the name of a section.
+ (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))
+
+ (define (translate-texi po lang)
+ "Translate the manual for one language LANG using the PO file."
+ (let ((translations (call-with-input-file po read-po-file)))
+ (translate-tmp-texi po "guix.texi"
+ (string-append "guix." lang ".texi.tmp"))
+ (translate-tmp-texi po "contributing.texi"
+ (string-append "contributing." lang ".texi.tmp"))
+ (let* ((texi-name (string-append "guix." lang ".texi"))
+ (tmp-name (string-append texi-name ".tmp")))
+ (with-output-to-file texi-name
+ (lambda _
+ (format #t "~a"
+ (translate-cross-reference
+ (call-with-input-file tmp-name get-string-all)
+ translations)))))
+ (let* ((texi-name (string-append "contributing." lang ".texi"))
+ (tmp-name (string-append texi-name ".tmp")))
+ (with-output-to-file texi-name
+ (lambda _
+ (format #t "~a"
+ (translate-cross-reference
+ (call-with-input-file tmp-name get-string-all)
+ translations)))))))
+
+ (for-each (lambda (po)
+ (match (reverse (string-split po #\.))
+ ((_ lang _ ...)
+ (translate-texi po lang))))
+ (find-files "." "^guix-manual\\.[a-z]{2}(_[A-Z]{2})?\\.po$"))
+
+ (for-each
+ (lambda (file)
+ (copy-file file (string-append #$output "/" file)))
+ (append
+ (find-files "." "contributing\\..*\\.texi$")
+ (find-files "." "guix\\..*\\.texi$"))))))
+
+ (computed-file "guix-translated-texinfo" build))
+
(define (info-manual source)
"Return the Info manual built from SOURCE."
+ (define po4a
+ (specification->package "po4a"))
+
+ (define gettext
+ (specification->package "gettext"))
+
(define texinfo
(module-ref (resolve-interface '(gnu packages texinfo))
'texinfo))
@@ -277,7 +401,7 @@ DOMAIN, a gettext domain."
(with-imported-modules '((guix build utils))
#~(begin
(use-modules (guix build utils))
-
+
(mkdir #$output)
;; Create 'version.texi'.
@@ -327,6 +451,8 @@ DOMAIN, a gettext domain."
;; see those images and produce image references in the Info output.
(copy-recursively #$documentation "."
#:log (%make-void-port "w"))
+ (copy-recursively #+(translate-texi-manuals source) "."
+ #:log (%make-void-port "w"))
(delete-file-recursively "images")
(symlink (string-append #$output "/images") "images")
--
2.21.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH 1/2] bootstrap: Break automake dependency on generated files. (was Re: Let’s translate!)
2019-04-27 12:32 ` Julien Lepiller
@ 2019-04-27 13:52 ` Ludovic Courtès
0 siblings, 0 replies; 29+ messages in thread
From: Ludovic Courtès @ 2019-04-27 13:52 UTC (permalink / raw)
To: Julien Lepiller; +Cc: guix-devel
[-- 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’.
^ permalink raw reply related [flat|nested] 29+ messages in thread
end of thread, other threads:[~2019-04-27 13:53 UTC | newest]
Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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).