From: "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de>
To: julien lepiller <julien@lepiller.eu>
Cc: guix-devel@gnu.org
Subject: Re: Translating to Chinese, Spanish and Japanese (and more)
Date: Tue, 6 Feb 2018 11:17:50 +0100 [thread overview]
Message-ID: <20180206101750.nanwvypco7tvq3ci@floriannotebook> (raw)
In-Reply-To: <20180205144429.rza5xovsei6arfeg@floriannotebook>
[-- Attachment #1: Type: text/plain, Size: 2872 bytes --]
On Mon, Feb 05, 2018 at 03:44:30PM +0100, pelzflorian (Florian Pelz) wrote:
> On Mon, Feb 05, 2018 at 10:41:29AM +0100, pelzflorian (Florian Pelz) wrote:
> > I thought about making page translations possible by allowing page
> > bodies to be lambdas taking a page variant as an argument, e.g. a
> > string containing an ietf language code, and returning the body
> > S-expression.
> >
> > Then the page variants could be specified per site and each page would
> > be generated once per variant.
> >
> > A site’s post-template and collection-template could then also
> > optionally be lambdas returning SHTML instead of SHTML.
> >
> > It should also be possible to specify a procedure to transform a base
> > page name and a language variant to a new page name.
> >
> > I still did not have time to send a patch though…
>
> Basically what I mean is to generate multiple variants of each Haunt
> page, e.g. one for each locale. See the attached patches. I did not
> try them yet neither document nor test them. Will do so later.
I am currently in the process of reworking my website to use page
variants. It is not done and not public yet. This change in Haunt
would mean:
Sites now have two more keys: VARIANTS and VARIANT-NAMER.
VARIANTS may be a list of page variants. For me, it is a list of
languages (“linguas”), i.e. '("de" "en"), but variants could be
anything and also used for web pages that differ not in language but
something else. If VARIANTS is not a list but the empty list '() or
#f, everything works as before without page variants. By default it
is '().
VARIANT-NAMER is a lambda that given a variant from VARIANTS and a
page’s file name returns the “real” file name for the variant. The
default puts the page’s variant before the extension separated by a
period, i.e. jabberwocky.html becomes jabberwocky.en.html.
Each page’s contents may be a procedure that given a variant from
VARIANTS returns the “real” contents. The variant can be used in a
gettext macro _ (or __ for inserting code into the translation) in the
body to look up translations, but to do so is up to the Haunt user and
is not part of Haunt. If the procedure returns #f this variant is not
generated. If the page body is not a procedure the page is generated
once as if there were no page variants.
Blog builder layouts return page contents and thus may return a
procedure that given a variant from VARIANTS return the “real” SHTML.
It is up to the Haunt user how to interpret e.g. post titles in the
layout. I plan to consider titles a procedure and call them with the
variant of the page to get the translated title.
I hope all of this works. When I’ve tried it on my website, I will
send a patch to David Thompson. What I currently have is attached.
Regards,
Florian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-02-06 10:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-05 9:07 Translating to Chinese, Spanish and Japanese (and more) Pjotr Prins
2018-02-05 9:28 ` julien lepiller
2018-02-05 9:41 ` pelzflorian (Florian Pelz)
2018-02-05 12:26 ` Ricardo Wurmus
2018-02-05 14:47 ` pelzflorian (Florian Pelz)
2018-02-05 17:21 ` Ricardo Wurmus
2018-02-05 14:44 ` pelzflorian (Florian Pelz)
2018-02-06 10:17 ` pelzflorian (Florian Pelz) [this message]
2018-02-06 10:19 ` pelzflorian (Florian Pelz)
2018-03-29 10:22 ` julien lepiller
2018-04-21 15:41 ` pelzflorian (Florian Pelz)
2018-02-05 10:19 ` Ludovic Courtès
2018-02-05 10:49 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180206101750.nanwvypco7tvq3ci@floriannotebook \
--to=pelzflorian@pelzflorian.de \
--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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.