i18n and QStrings

David Faure dfaure at klaralvdalens-datakonsult.se
Sat Nov 29 19:05:34 GMT 2003


On Saturday 29 November 2003 19:58, Andras Mantia wrote:
> The toolbarname is a QString. But it's also possible to
> rename a toolbar. In this case toolbarname may contain non-English chars, but
> as soon as the same i18n(toolbarname) is called (for example in the place
> where the toolbar name is actually set), it doesn't return toolbarname as
> expected, but a modified string. One would expect that i18n(text) == text if
> text is not translated. Currently i18n(text.utf8()) == text as the above
> addition would help in this case.

Yeah I do this in KWord too, for styles, which are a similar case of something 
that has a default translated name but can also be renamed.

kostyle.cc:    return i18n( "Style name", name().utf8() );
kwframestyle.cc:    return i18n( "Style name", name().utf8() );
kwtablestyle.cc:    return i18n( "Style name", name().utf8() );

However I think it's better that it's explicit, there are too many chances
of people doing things wrong otherwise. This is a rather special case, and
it's easier to say "i18n ALWAYS takes an utf8 encoded input as a char*".
Just my 2 cents.

-- 
David Faure -- faure at kde.org, dfaure at klaralvdalens-datakonsult.se
Qt/KDE/KOffice developer
Klarälvdalens Datakonsult AB, Platform-independent software solutions




More information about the kde-core-devel mailing list