[Interest] cross-language matching of QStrings: partial success only?

Allan Sandfeld Jensen kde at carewolf.com
Mon May 11 20:37:16 CEST 2015


On Monday 11 May 2015, Thiago Macieira wrote:
> On Monday 11 May 2015 19:07:31 René J.V. Bertin wrote:
> > So apparently the string comparison does not do translation (which isn't
> > really a surprise except when you look at the context in which I'm
> > working here...).
> 
> How would the context change anything? String comparisons do a
> character-by- character comparison. If any character is different, the
> string won't match. They have nothing to do with translations.
> 
> > It seems the best option would be to ensure that cstyle and istyle are
> > both in the same language. For that, I think I'd need to know the
> > language in which the elements of "styles" are stored, and then
> > translate "style" (cstyle) into that language.
> > 
> > How does one do that?
> 
> I have neither understood your objective nor your solution. I read your
> email three times and I can't get either.
> 
> But my suggestion is that you restrict yourself to exact string matches.
> Don't do partials. Either you have the complete translation to be matched
> or you don't.
> 
> Better yet, don't compare translations. Compare originals only.

I think the problem is that fonts not always named in English and often uses 
strings instead of defined enums. This means they can have their style names 
in the language of the font origin or the language of the operating system. So 
if you load a French font, and want it in semi-bold, you may need to look for 
the demibold or demi-gras style. This is a big mess. Look for how we find the 
weight of a font in qfontdatabase.cpp getFontWeight.

`Allan



More information about the Interest mailing list