unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de>
To: Ricardo Wurmus <rekado@elephly.net>
Cc: guix-devel@gnu.org, sirgazil <sirgazil@zoho.com>,
	matias_jose_seco@autoproduzioni.net
Subject: Re: Website translation
Date: Mon, 5 Aug 2019 15:08:28 +0200	[thread overview]
Message-ID: <20190805130827.thp3zzw5ljo6g3h2@pelzflorian.localdomain> (raw)
In-Reply-To: <20190726111155.qospxvrw7rnuwtok@pelzflorian.localdomain>

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

On Fri, Jul 19, 2019 at 02:29:52PM +0200, pelzflorian (Florian Pelz) wrote:
> I will try writing a custom xgettext that combines
> nested·s-expressions·that are marked for translation with G_
> to·a·single·msgstr that gets written to the·PO·file.  This combined
> string will not be part of the source code but will be generated from
> a nested sexp.  The PO file containing the combined strings can then
> be translated as usual.  For reading the translation, the combined
> msgstr will be constructed again by the marking procedure G_ and
> looked up by reading from an MO file.
> 

I have implemented a working translation tool.  Sexp-xgettext
generates from an SHTML or other Scheme file with marked s-expressions
a POT file which can be translated and turned into an MO file from
which the code generates a localized HTML builder.  The advantage is
that existing SHTML will just have to be marked with G_ and no format
string has to be written, although sometimes the SHTML should be
adapted to produce a less complicated message in the POT file.  Find
attached an example of a marked Scheme file home.scm generating
guix-website.pot, which after manual translation generates the
attached guix.de_DE.html.

Marking a string for translation behaves like normal gettext.  Marking
a parenthesized expression (i.e. a list or procedure call) extracts
each string from the parenthesized expression.  If a symbol, keyword
or other parenthesized expression occurs between the strings, it is
extracted as an XML element.  Expressions before or after all strings
are not extracted.  If strings from a parenthesized sub-expression
shall be extracted too, the sub-expression must again be marked with
G_ unless it is the only sub-expression or it follows a quote,
unquote, quasiquote or unquote-splicing.  The order of XML elements
can be changed in the translation to produce a different ordering
inside a parenthesized expression.  If a string shall not be extracted
from a marked expression, it must be wrapped, for example by a call to
the identity procedure.

But there are still some bugs like missing line numbers and
non-working pgettext and the code is not clear enough yet.  I will
send a patch series tomorrow after I fixed these issues (even though
the documentation won’t be near as good as sirgazil’s format strings).

Regards,
Florian

[-- Attachment #2: home.scm --]
[-- Type: application/vnd.lotus-screencam, Size: 8067 bytes --]

[-- Attachment #3: guix-website.pot --]
[-- Type: application/vnd.ms-powerpoint, Size: 4474 bytes --]

[-- Attachment #4: guix.de_DE.html --]
[-- Type: text/html, Size: 10913 bytes --]

  parent reply	other threads:[~2019-08-05 13:08 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-06 12:50 Guix beyond 1.0: let’s have a roadmap! matias_jose_seco
2019-07-07 14:20 ` Ludovic Courtès
2019-07-07 16:57   ` Website translation (was: Re: Guix beyond 1.0: let’s have a roadmap!) pelzflorian (Florian Pelz)
2019-07-07 18:00     ` pelzflorian (Florian Pelz)
2019-07-07 22:28     ` Christopher Lemmer Webber
2019-07-11 15:15       ` Website translation Ludovic Courtès
2019-07-12  5:35         ` pelzflorian (Florian Pelz)
2019-07-14 14:12           ` Ludovic Courtès
2019-07-14 14:26             ` pelzflorian (Florian Pelz)
2019-07-15 12:33               ` Ludovic Courtès
2019-07-15 14:57                 ` Julien Lepiller
2019-07-15 15:54                 ` pelzflorian (Florian Pelz)
2019-07-17 21:16                   ` Ludovic Courtès
2019-07-18 15:08                     ` pelzflorian (Florian Pelz)
2019-07-18 16:59                       ` Ricardo Wurmus
2019-07-18 20:28                         ` pelzflorian (Florian Pelz)
2019-07-18 20:57                           ` pelzflorian (Florian Pelz)
2019-07-19 12:29                           ` pelzflorian (Florian Pelz)
2019-07-26 11:11                             ` pelzflorian (Florian Pelz)
2019-07-26 11:23                               ` pelzflorian (Florian Pelz)
2019-08-05 13:08                               ` pelzflorian (Florian Pelz) [this message]
2019-08-07 22:33                                 ` pelzflorian (Florian Pelz)
2019-08-22 21:13                                   ` Ludovic Courtès
2019-08-23  6:03                                     ` pelzflorian (Florian Pelz)
2019-08-23 12:18                                       ` Ludovic Courtès
2019-08-23 13:54                                         ` pelzflorian (Florian Pelz)
2019-08-23 14:08                                           ` Jelle Licht
2019-08-23 20:47                                             ` pelzflorian (Florian Pelz)
2019-08-25 18:58                                     ` pelzflorian (Florian Pelz)
2019-08-26  3:08                                       ` pelzflorian (Florian Pelz)
2019-09-06 14:27                                         ` pelzflorian (Florian Pelz)
2019-07-18 17:06                       ` sirgazil
2019-07-15 12:59             ` Ricardo Wurmus
2019-07-18  5:06         ` pelzflorian (Florian Pelz)

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=20190805130827.thp3zzw5ljo6g3h2@pelzflorian.localdomain \
    --to=pelzflorian@pelzflorian.de \
    --cc=guix-devel@gnu.org \
    --cc=matias_jose_seco@autoproduzioni.net \
    --cc=rekado@elephly.net \
    --cc=sirgazil@zoho.com \
    /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).