As a test, I implemented this in trunk

        T(' hello world ') -> ' hello world
'
        T(' hello world # token') -> 'hello
world'
        T('hello # world # token') -> 'hello # world'

I.e. if no # nothing changes. If one '#', everything on its right is
not translated, everything is stripped. More than one '#' is ignored
and this would allow to have '#' in the translated string.

What do you think?

On 12 Lug, 17:30, Jonathan Lundell <[email protected]> wrote:
> On Jul 12, 2010, at 3:26 PM, mdipierro wrote:
>
> > I like ((...)). If I understand you suggest stripping the whitespaces
> > ONLY inside ((..)). Did I understand?
>
> Stripping the main string, too--wasn't that the point of this exercise in the 
> first place? I don't have a strong opinion, though.
>
>
>
> > On 12 Lug, 17:22, Jonathan Lundell <[email protected]> wrote:
> >> On Jul 12, 2010, at 3:15 PM, mdipierro wrote:
>
> >>> Ok but can I propose we use
>
> >>> T('canto /* my room */') instead of [[...]] to avoid confusion with
> >>> markmin syntax? This would b easy to implement.
>
> >> Or ((my room)).
>
> >> Or <<my room>>.
>
> >> Regardless, you'd want to specify what happens to white space. Strip 
> >> everything, I think, so T(' canto /* my room */') is equivalent to 
> >> T('canto/*my room*/').
>
> >> (That's why I don't much like /*...*/, though; it's sort of ugly without 
> >> extra spaces.)
>
> >>> On 12 Lug, 15:39, Jonathan Lundell <[email protected]> wrote:
> >>>> On Jul 12, 2010, at 1:32 PM, Álvaro Justen wrote:
>
> >>>>> On Mon, Jul 12, 2010 at 17:16, Jonathan Lundell <[email protected]> 
> >>>>> wrote:
> >>>>>> 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)
>
> >>>>> I don't like the idea of changing the string to be translated. We can
> >>>>> use a 'context' parameter as I said in other email some time ago,
> >>>>> like:
> >>>>> T('canto', context='my room') #translating from pt-BR to English
> >>>>> should be 'corner'
> >>>>> T('canto', context='music') #translating from pt-BR to English should 
> >>>>> be 'sing'
>
> >>>> That is, btw, my 'variant=' suggestion, above. If it's practical, I'd 
> >>>> prefer it. But embedding the variant/context into the string would be (I 
> >>>> think) less disruptive.
>
> >>>> T('canto [[my room]]')
> >>>> T('canto [[music]]')
>
> >>>> Not as pretty, but almost identical in effect.

Reply via email to