unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Nala Ginrut <nalaginrut@gmail.com>
To: Christopher Allan Webber <cwebber@dustycloud.org>
Cc: guile-user <guile-user@gnu.org>
Subject: Re: Named parameters to format?
Date: Tue, 15 Dec 2015 14:01:06 +0800	[thread overview]
Message-ID: <1450159266.18629.37.camel@Renee-desktop.suse> (raw)
In-Reply-To: <87egeo5mzl.fsf@dustycloud.org>

I don't know if someone wrote this one for format string. But there's
Python3-like string template in Artanis, say:
((make-string-template "foo ${bar} ${baz}") #:bar "bleh" #:baz "wonk")
I think it does the similar thing.

If you're interested in it, you may easily port it from Artanis. But you
need irregex as well.
https://github.com/NalaGinrut/artanis/blob/master/artanis/utils.scm#L411



On Mon, 2015-12-14 at 22:52 -0600, Christopher Allan Webber wrote:
> Hello all,
> 
> I've been thinking about what I'm going to do once I hit the need for
> gettext support.  I'm not really sure for things that have multiple
> variables in their string.  In python land, I'd do something like:
> 
>   gettext("foo %(bar) %(baz)") % {"bar": "bleh",
>                                   "baz": "wonk"}
> 
> This would give translators an opportunity to move the right parameters
> to the right place in the string.  However, this appears to not be
> possible in our current format system, because there's no place to put
> keyword based substitutable arguments.  Syntactic word ordering varies
> from natural language to natural language, so...
> 
> Surely someone's run into this before?  What's the right solution?
> 
>  - Chris
> 





  reply	other threads:[~2015-12-15  6:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-15  4:52 Named parameters to format? Christopher Allan Webber
2015-12-15  6:01 ` Nala Ginrut [this message]
2015-12-15 15:43   ` Christopher Allan Webber
2015-12-15  6:30 ` Mark H Weaver
2015-12-15  9:14   ` Ludovic Courtès
2015-12-15 15:20     ` Mark H Weaver
2015-12-15 15:42     ` Christopher Allan Webber
2015-12-15 16:16       ` Ludovic Courtès
2015-12-15 15:43   ` Christopher Allan Webber

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=1450159266.18629.37.camel@Renee-desktop.suse \
    --to=nalaginrut@gmail.com \
    --cc=cwebber@dustycloud.org \
    --cc=guile-user@gnu.org \
    /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).