guile-user
[Top][All Lists]
Advanced

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

Re: Named parameters to format?


From: Nala Ginrut
Subject: Re: Named parameters to format?
Date: Tue, 15 Dec 2015 14:01:06 +0800

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 via email to

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