[Development] Introducing discussion about QStringFormatter

Thiago Macieira thiago.macieira at intel.com
Mon Aug 14 18:20:14 CEST 2017


On Monday, 14 August 2017 07:12:30 PDT Mårten Nordheim wrote:
> > Has this ever been validated with people using RTL languages? The < and >
> > 
> > symbols switch directions when used in RTL. For example:
> >      const char *fmt =
> >      
> >              "א {<10} ב"
> >              ;
> > 
> 
> When I first read this email the email-reader displayed the '{', '}' and
> '>' as flipped. So I would guess it's left. I was going to try it in
> python but I couldn't get it working without removing '<10'. I guess
> this is one of the situations where out-of-string formatting options are
> useful/needed. I'm not sure how to solve this otherwise.
> 
> And I see what you mean - navigating using the cursor in Qt Creator and
> VsCode and trying to guess where a character will appear if I press a
> button is quite the challenge.

I had the same problem, but I guess we can safely assume that anyone writing 
RTL text in their source code knows what they're doing and are used to the 
text direction changing (or they'll report bugs if the behaviour is wrong).

My question is whether people reading the code would be confused. There's two 
kind of people here:
 1) the people who wrote RTL
 2) a reviewer who doesn't read RTL (and isn't aware that < flips)

A - or + sign is clearly the same in RTL. So even if I don't know RTL, I know 
that "א {-10} ב" is left-justified (though I'll most likely ask the reviewer 
why the - is on the right of 10).

But like I said, maybe the < and > are beneficial, since in "א {<10} ב", the 
alignment is towards the Aleph, regardless of whether that's left or right. 
The sign that is visibly ">" is right alignment regardless of text direction, 
whereas the U+003C "less than" sign indicates alignment towards the beginning 
of the text.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list