[Python-ideas] PEP 501 - i18n with marked strings
Jonathan Slenders
jonathan at slenders.be
Tue Aug 11 15:10:29 CEST 2015
-1 on any approach that uses a translation hook. Many frameworks have their
own way of translating things. So that should definitely not be a global.
2015-08-11 15:05 GMT+02:00 M.-A. Lemburg <mal at egenix.com>:
> On 10.08.2015 22:31, Mike Miller wrote:
> > Hi,
> >
> > I haven't done i18n recently, so bare with me. I'm not sure about
> bolting this on to "format
> > strings", in that it feels like an orthogonal concept.
> >
> > However, what if we had i18n strings as well, not instead of:
> >
> > i'Hello there, $name {age}.'
> >
> > and that they were complimentary to f'', each handling their different
> duties:
> >
> > fi'Hello there, $name {age}.'
> >
> > Different syntax would probably be needed for each, is that correct?
> Since each have different
> > requirements, e.g. Barry's concerns about format strings being too
> powerful for non-developers,
> > while also making a project vulnerable to arbitrary code.
> >
> > Perhaps PEP 498 with non-arbitrary strings (but attribute/keys support)
> would allow the syntax to be
> > unified.
>
> IMO, having just one string literal interpolation standard is better
> than having two and since i"" fits both needs, I'm +1 on i"" and
> -0 on f"".
>
> The only problem I see with i"" is that you may want to use
> formatting only in some cases, without triggering the translation
> machinery which may be active in a module. I guess it's fine to
> fallback to the standard .format() or %-approach for those
> few situations, though.
>
> In all other use cases, having the literal strings already
> prepared for translation in a Python module is a huge win:
> just drop a translation hook into the module and you're
> good to go :-)
>
> --
> Marc-Andre Lemburg
> eGenix.com
>
> Professional Python Services directly from the Source (#1, Aug 11 2015)
> >>> Python Projects, Coaching and Consulting ... http://www.egenix.com/
> >>> mxODBC Plone/Zope Database Adapter ... http://zope.egenix.com/
> >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
> ________________________________________________________________________
>
> ::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::
>
> eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
> D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
> Registered at Amtsgericht Duesseldorf: HRB 46611
> http://www.egenix.com/company/contact/
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150811/8cb18467/attachment.html>
More information about the Python-ideas
mailing list