guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Website translation


From: pelzflorian (Florian Pelz)
Subject: Re: Website translation
Date: Thu, 8 Aug 2019 00:33:10 +0200
User-agent: NeoMutt/20180716

On Mon, Aug 05, 2019 at 03:08:28PM +0200, pelzflorian (Florian Pelz) wrote:
> 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).
> 

Find attached patches that add internationalization support, mark the
home and about pages for translation and add a sample German
translation.  Feedback welcome.

To use them, generate an MO file and run Haunt by following the
instructions in i18n-howto.txt.  I have *not* written a Makefile to
automate these steps.

Sending these patches took longer because new bugs kept appearing.
Probably new bugs will show up when marking more files for
translation.  I will add more markings in the coming days if the
patches are OK.

I am unsure but I believe the URLs in href links should be marked with
G_ as well so translators can change them to the URL of the respective
translation of gnu.org, for example.  I will make these changes later
if you agree.

If this internationalization is to be deployed, the NGINX server
offering guix.gnu.org would need to redirect according to
Accept-Language headers.  I do not know if nginx alone can do this
properly by now, otherwise there are Lua programs for nginx to handle
Accept-Language or a custom Guile webserver could be written.

Regards,
Florian

Attachment: 0001-website-Use-needed-modules-in-posts.patch
Description: Text document

Attachment: 0002-website-Add-custom-xgettext-implementation-that-extr.patch
Description: Text document

Attachment: 0003-website-Use-custom-xgettext-implementation.patch
Description: Text document

Attachment: 0004-website-Mark-some-files-in-apps-base-for-translation.patch
Description: Text document

Attachment: 0005-website-Generate-localizeable-POT-file.patch
Description: Text document

Attachment: 0006-website-Add-German-translation.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]