[Python-ideas] Combine f-strings with i18n - How about using PEP 501?

Anders Hovmöller boxed at killingar.net
Tue Sep 18 00:31:42 EDT 2018


>> See also PEP 501, which could be used for i18n.
> 
> I don't see how this immediately helps the OP, who wants a *literal*
> expression that automatically invokes the translation machinery as
> well as the interpolation machinery.  

Another way forward could be a preprocessor. All this can be done with a fairly simple script using parso.

If the op is interested I could whip out a prototype. The cool thing about parso is that it’s a round trip AST so it’s easy to perform refactorings or in this case preprocessing without affecting formatting or comments. 

/ Anders


More information about the Python-ideas mailing list