[Python-ideas] Gettext syntax (was Re: Allow "assigning" to ...)

Masklinn masklinn at masklinn.net
Thu Feb 12 17:03:33 CET 2015


On 2015-02-12, at 12:41 , Wichert Akkerman <wichert at wiggy.net> wrote:
>> On 12 Feb 2015, at 10:00, M.-A. Lemburg <mal at egenix.com> wrote:
>> 
>> On 12.02.2015 04:33, Terry Reedy wrote:
>>> A possible solution would be to give 3.x str a __pos__ or __neg__ method, so +'python' or -'python'
>>> would mean the translation of 'python' (the snake).  This would be even *less* intrusive and easier
>>> to write than _('python').
>> 
>> Doesn't read well:
>> 
>> label = +'I like' + +'Python'
>> 
>> and this is even worse, IMO:
>> 
>> label = -'I like' + -'Python'
>> 
>> 
>> I think the proper way of doing this would be to add a string
>> literal modifier like we have with r'' for raw strings,
>> e.g. i'Internationalized String’.
> 
> As far as I know every other language as well as all i18n-related tools use _(..) to mark translatable strings.

In many functional languages `_` is a universal value-less matcher (that
is it pattern-matches everything, but is nonsensical as a value).


More information about the Python-ideas mailing list