From mboxrd@z Thu Jan 1 00:00:00 1970 From: "pelzflorian (Florian Pelz)" Subject: Re: Translating to Chinese, Spanish and Japanese (and more) Date: Tue, 6 Feb 2018 11:17:50 +0100 Message-ID: <20180206101750.nanwvypco7tvq3ci@floriannotebook> References: <20180205090716.GB10165@thebird.nl> <30df6bb24a385c945d261feb5f2f99d2@lepiller.eu> <20180205094129.efgxn7nucoj3kwsf@floriannotebook> <20180205144429.rza5xovsei6arfeg@floriannotebook> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="kp6f7nxmf3hxi2kf" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ej0K6-00050X-Cj for guix-devel@gnu.org; Tue, 06 Feb 2018 05:17:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ej0K1-0004zT-FB for guix-devel@gnu.org; Tue, 06 Feb 2018 05:17:58 -0500 Received: from pelzflorian.de ([5.45.111.108]:49946 helo=mail.pelzflorian.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ej0K1-0004z1-0X for guix-devel@gnu.org; Tue, 06 Feb 2018 05:17:53 -0500 Content-Disposition: inline In-Reply-To: <20180205144429.rza5xovsei6arfeg@floriannotebook> 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 --kp6f7nxmf3hxi2kf Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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) wrot= e: > > 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. > >=20 > > Then the page variants could be specified per site and each page would > > be generated once per variant. > >=20 > > A site=E2=80=99s post-template and collection-template could then also > > optionally be lambdas returning SHTML instead of SHTML. > >=20 > > It should also be possible to specify a procedure to transform a base > > page name and a language variant to a new page name. > >=20 > > I still did not have time to send a patch though=E2=80=A6 >=20 > 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 (=E2=80=9Clinguas=E2=80=9D), i.e. '("de" "en"), but variants coul= d 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=E2=80=99s file name returns the =E2=80=9Creal=E2=80=9D file name for t= he variant. The default puts the page=E2=80=99s variant before the extension separated by a period, i.e. jabberwocky.html becomes jabberwocky.en.html. Each page=E2=80=99s contents may be a procedure that given a variant from VARIANTS returns the =E2=80=9Creal=E2=80=9D contents. The variant can be u= sed 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 =E2=80=9Creal=E2=80= =9D 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=E2=80=99ve tried it on my website, I will send a patch to David Thompson. What I currently have is attached. Regards, Florian --kp6f7nxmf3hxi2kf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEwRjGsqAMqXB4uw3y3T6EbElHBVsFAlp5gMkACgkQ3T6EbElH BVsE9Q//YZME1ogZqUF2PcHQNurGfzcKXNahTH3YtjffoTUQ+6Ju0u527YiIWzeB VJxsTMNQGNX+Nx2U5HY3EtgGaldzZhDM8w8xgEZQlrIrhyxyH4l4FOJZ/krBbSpE 7pprE31oozaYAu0eQ8G0n8aGXUmIOx/MJb+FdC3ji+u7Q4YKS4YFloKf99z/uNUp 92Fpx9avaUH1urGCI3o7VFU2u52wGcCF/zajWYlu4LFOu0odkpewk0/d+GmsB5CY Y2gPyLwZ9iu+8h1RTfns3MVhM9wptlI+Azwm2n2BLIeA0rQ+zE6E86x3EsLVug+c 6eaqwC7SXhjWI4yD48ViYlbnT9kBCiW6lZqQATYUav36VMUbhBf5wkn6bCz1FZfG /VmZhZfp/aNen82mhrxFlH8QcXRPv87p1Tewlmv2ChjWq+GyQExiCi9Q/thFOh0F Qc2HMGHmZMWNpzHJ4JfvvekFbgU6Xsot44mhY9ahBJ/ZcoUgnoTlGYblVZCs/DDR /2wPnF1h6hJVwCB60c6xHy32PqggONMDpZTdNhdh8JCRyJ6G+ARko/Ck++kAE2Nu KGASB3+bX8i8+K3GF7cZgX3VhfLgP8e5YRJrKOYpPMhQgztbxGIXBS29VzfWDB4B AgumIBWSamo/hbbb6lHZW+rT8GV0xSnoo/24snLwauu94i0Wc18= =Lj40 -----END PGP SIGNATURE----- --kp6f7nxmf3hxi2kf--