On Jul 12, 2010, at 12:51 PM, mdipierro wrote:
> suggestions? :-)
Ideally (from a usability pov), a variant="something" argument to T(), I
suppose. But I can't think of a non-messy way to do it.
How about something like this:
T('string to translate [[VARIANT something]]')
T('string to translate [[VARIANT something else]]')
If there's no translation in effect, then [[VARIANT .*?]] *$ gets stripped from
the string. Otherwise it's part of the lookup. It could just be
[[something]]
[[something else]]
...keeping in mind that if you really wanted that at the end of a T() string,
you could write:
T('blah blah [[blah]][[]]')
...and only the trailing [[]] would be stripped.
BTW, there's a typo in languages.py:
# patter for a valid accept_language
(and the pattern could use a comment or three)
>
> On 12 Lug, 14:49, Jonathan Lundell <[email protected]> wrote:
>> On Jul 12, 2010, at 12:38 PM, mdipierro wrote:
>>
>>>> If the developer knows that some string should be stripped, he can do:
>>>> T(my_string.strip())
>>>> Not all strings should be stripped (really, I think in general cases
>>>> strings must not be stripped).
>>>> In some cases when I need to translate only one word or expression and
>>>> I have the same word/expression with other meaning, I use spaces to
>>>> get this working.
>>
>>> Perhaps should we provide a better mechanism for this.
>>
>> Yes.