KDE4 proposal: Paths in i18n strings
Chusslove Illich
caslav.ilic at gmx.net
Fri Jul 7 14:49:56 BST 2006
>> [: Chusslove Illich :]
>> - with tag-functions: i18n("Path %1", argPath(pathstr))
>
> [: Krzysztof Lichota :]
> The problem is to remember to put argPath(). In most cases developer
> ill forget to put it [...]
But programmer may also forget to output path using QSomething argument,
and send an ordinary QString. Just quick eye-balling some sources, I see
that ordinary strings are quite used to output paths (though my sample
might be skewed -- I browsed through KStars code :) Or even, he could
forget about overload and use QSomething's own conversion to QString.
Thus, adding overloads for special types is just a partial-shortcut (in
case proper object is available) for the semantic markup, which would end
up being markup in disguise when someone does QFile(filestr) just for
output.
And there may be other markup we should consider, as Frans points out.
> I thought we are talking about passing something like QPath, for the
> purpose of transforming it to platform-dependent representation :)
> Using strings as paths makes it harder and error-prone.
Well, QFile itself has to get a path string, isn't it so? So our argPath()
(or i18nPath() by Frans, a better name I guess) could inside also cast to
QFile, and then proceed...
>> [: Chusslove Illich :]
>> ki18n("Error in %1 at %2:")
>> .subsPath(file).subs(lineno).toString(KLocalizedStringFormat...);
>>
>> pi18n("Error in %1 at %2:", argPath(file), lineno);
>
> [: Krzysztof Lichota :]
> I don't understand this example.
> My point is that if there are 2 prefixes and developer will have to
> choose which, in some cases he chooses wrong.
In the first example, he'd also have to choose one of
KLocalizedStringFormat:: thingies. But I think you ment that prefix is bad
in comparison to:
> I'd prefer to see Qt adopting this kind of translatable strings
> for Qt :)
I agree this would be nice, however I have a feeling that we are already
pushing the envelope here, and that even if perfectly reasonable, Qt folks
won't jump to overhaul their localization infrastructure in the start of
4.x series.
--
Chusslove Illich (Часлав Илић)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060707/265b64b4/attachment.sig>
More information about the kde-core-devel
mailing list