[Python-Dev] PEP 215 redux: toward a simplified consensus? (original) (raw)
Paul Prescod paul@prescod.net
Mon, 25 Feb 2002 13:46:46 -0800
- Previous message: [Python-Dev] PEP 215 redux: toward a simplified consensus?
- Next message: [Python-Dev] PEP 215 redux: toward a simplified consensus?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Jeff Epler wrote:
On Mon, Feb 25, 2002 at 01🔞57PM -0800, Neil Schemenauer wrote: > Jeff Epler wrote: > > But how do you internationalize your program once you use $-subs? > > So don't use them. What's the problem? The problem is when I have to internationalize a program some schmuck wrote using $-subs throughout.
I think you go through and remove the "$" signs (probably at the same time you are removing "_") and use a runtime function to do the translation (probably the same function doing the interpolation). Then you take on the responsibility yourself for making sure that the original string is a constant (not a user-supplied variable) and that the replacement strings come from somewhere secure.
So:
a = "Hellothere"Hello there "Hellotherename"
becomes:
a = _("Hello there $name")
I think Barry's gettext already does that or something, doesn't it?
Paul Prescod
- Previous message: [Python-Dev] PEP 215 redux: toward a simplified consensus?
- Next message: [Python-Dev] PEP 215 redux: toward a simplified consensus?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]