unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: sirgazil <sirgazil@zoho.com>
To: "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de>,
	Guile User <guile-user@gnu.org>,
	guile-devel <guile-devel@gnu.org>
Subject: Re: Website translations with Haunt
Date: Sat, 16 Dec 2017 10:26:12 -0500	[thread overview]
Message-ID: <7e3a3109-25c5-ed60-9a7b-ee1a656de87e@zoho.com> (raw)
In-Reply-To: <20171209180619.GA10254@floriannotebook.localdomain>

Hi :)

On 09/12/17 13:06, pelzflorian (Florian Pelz) wrote:
> Hello,
> 
> First of all, I want to say thank you to the Guile, Haunt, ffi-helper
> and related projects’ developers.
> 
> I built my personal website [1] using David Thompson’s Haunt [2] and
> recently talked my university’s Islamic Students’ Association
> (Islamische Hochschulvereinigung) into using Haunt for their
> not-yet-finished website as well, because I think the concept of Haunt
> and SHTML is superior to alternatives.  However in order to make the
> website multilingual (the user can choose to view it in German or
> English) so far I used an association list with assoc-ref which is not
> very comfortable since all strings have to be added in two places,
> i.e. in the SHTML code and in the association list where the code
> looks for translations.
> 
> I want to ask for your thoughts on my new solution since translations
> are probably important to many Haunt users.  In particular, I believe
> there was some discussion on Website translation on the Guile or Guix
> lists as well.


I'm very interested on this subject because I help with Guile and Guix 
websites, and I usually work with multilingual websites. I have no idea 
of what would be the right way to do i18n of websites written in Scheme, 
though. So I will just join this conversation as a potential user of 
your solutions :)


> I did not want to use the ordinary gettext functions in order to not
> call setlocale very often to switch languages.  It seems the Gettext
> system is not designed for rapidly changing locales, but maybe I am
> wrong about this and very many setlocale calls would not be that bad.


For what is worth, I use ordinary gettext and `setlocale` in my website, 
which is not Haunt-based, but it is Guile Scheme and statically 
generated too. So far, it works ok.

For internationalization, I know the convention is to use _, but I don't 
like that, so I use the alias l10n instead.

For internationalizing complex blocks that should not be translated in 
fragments, like:


`(p "Hi! I play "
     (a (@ (href ,sport-url)) ,(l10n "futsal"))
     " in "
     (a (@ (href ,place-url)) ,(l10n "Tokyo")))


I had to write a procedure I call `interleave` that I use like this:


`(p
   ,@(interleave (l10n "Hi! I play ~SPORT~ in ~PLACE~.")
  	        `(a (@ (href ,sport-url)) ,(l10n "futsal"))
	        `(a (@ (href ,place-url)) ,(l10n "Tokyo"))))


So, in the translation catalogs, translators will see the strings:


"Hi! I play ~SPORT~ in ~PLACE~."
"futsal"
"Tokyo"


Currently, I use xgettext manually and Poedit for working with 
translation catalogs, but I'd like to manage translations in the future 
like this (replace `site` with `haunt`):


# Create new translation catalogs for Finnish and Japanese.
$ site catalog-new fi ja

# Update translation catalogs with new translation strings.
$ site catalog-update

# Compile translation catalogs (generate .mo files)
$ site catalog-compile


To be fully localized, I also have to pass IETF Language Tags around in 
the website code, so that I get the right content when rendering the 
templates in a given language.

My 2¢




  parent reply	other threads:[~2017-12-16 15:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-09 18:06 Website translations with Haunt pelzflorian (Florian Pelz)
2017-12-09 18:15 ` ng0
2017-12-09 21:08   ` pelzflorian (Florian Pelz)
2017-12-09 22:29     ` ng0
2017-12-13 14:53       ` pelzflorian (Florian Pelz)
2017-12-10 15:22 ` Matt Wette
2017-12-10 19:21   ` pelzflorian (Florian Pelz)
2017-12-10 22:35     ` Matt Wette
2017-12-12  7:51       ` pelzflorian (Florian Pelz)
2017-12-12  8:03         ` ng0
2017-12-12  9:30           ` pelzflorian (Florian Pelz)
2017-12-12 13:45             ` Matt Wette
2017-12-12 18:47               ` pelzflorian (Florian Pelz)
2017-12-10 23:00     ` Matt Wette
2017-12-12  8:17       ` pelzflorian (Florian Pelz)
2017-12-14  9:16 ` Ludovic Courtès
2017-12-14 13:23   ` Thompson, David
2017-12-15 11:39     ` pelzflorian (Florian Pelz)
2017-12-15 14:01   ` pelzflorian (Florian Pelz)
2017-12-15  3:48 ` Christopher Lemmer Webber
2017-12-15  8:34   ` pelzflorian (Florian Pelz)
2017-12-15 12:06   ` ng0
2017-12-15 14:25     ` pelzflorian (Florian Pelz)
2017-12-16  9:54     ` Ricardo Wurmus
2017-12-16 12:37       ` pelzflorian (Florian Pelz)
2017-12-16 15:26 ` sirgazil [this message]
2017-12-16 19:30   ` 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://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e3a3109-25c5-ed60-9a7b-ee1a656de87e@zoho.com \
    --to=sirgazil@zoho.com \
    --cc=guile-devel@gnu.org \
    --cc=guile-user@gnu.org \
    --cc=pelzflorian@pelzflorian.de \
    /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.
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).