[Python-ideas] Fix the DRY problem (was Re: PEP 501 - i18n with marked strings)

Eric V. Smith eric at trueblade.com
Fri Aug 14 15:04:55 CEST 2015


On 08/13/2015 09:58 PM, Terry Reedy wrote:
> On 8/13/2015 11:39 AM, Barry Warsaw wrote:
>> On Aug 13, 2015, at 10:04 AM, Terry Reedy wrote:
>>
>>> For internationalization, the gettext.gettext translation call could
>>> be added
>>> in one place, where the string is passed to tk, rather than 80 places
>>> in the
>>> structure definition.  An altered version of the menudefs walker
>>> could be
>>> used to collect the menu strings for translation.
>>
>> That would require being able to translate non-literals.
> 
> I don't understand, Idle's menus are built from string literals -- no
> variables, not interpolation -- like 'File', 'Open', 'Open Module', etc.
>  I think this is fairly typical.

It's the "could be added in one place" part that would require working
on non-literals. In that one place, you'd be operating on a variable,
not a literal.

Eric.



More information about the Python-ideas mailing list