kscd i18n bug, outdated documentation

Aurélien Gâteau agateau at kde.org
Thu Jun 18 11:17:11 BST 2009


Burkhard Lück wrote:
> Am Donnerstag 18 Juni 2009 10:21:31 schrieb Aurélien Gâteau:
>> Burkhard Lück wrote:
>>> Am Montag 16 März 2009 12:20:53 schrieb Burkhard Lück:
>>>> Hello list,
>>>>
>>>> with the new version of kscd written by Mohamed-Amine Bouchikhi,
>>>> there is a i18n bug in kscd, please have a look at
>>>> https://bugs.kde.org/show_bug.cgi?id=186867.
>>>>
>>>> Any idea how to fix this and make the button tooltips translatable?
>>> attached patch fixes the untranslatable tooltips.
>>>
>>> Improvements?
>>> Objections to commit?
>> I have not tried the patch, but I have a question: are the buttons
>> sometimes instantiated with different labels? In this case, are those
>> labels already using i18n? That is, do you have this somewhere:
>>
>>   new CloseButton(parent, i18n("Foo"));
>>
>> or this:
>>
>>   new CloseButton(parent, "Foo");
>>
>> If you have the first one, then your patch is wrong because you will
>> call i18n() on the translated text.
>>
>> If you have the second one, your patch is ok, but this looks fragile
>> since class users have to remember *not to* call i18n().
>>
> None of both:
> $ wcgrep "new CloseButton" kdemultimedia/kscd/
> kdemultimedia/kscd/gui/kscdwindow.cpp:58:       m_closeB = new 
> CloseButton(this);
> 
>> If the code never changes the text, I suggest to get rid of the
>> parameter and hard-code the text inside the constructor.
>>
> I can't do that with my limited C/C++ skills, i am just a poor translator who 
> wants to have a fully translatable GUI.
> And with my patch I get that.

Mmm... I had a look at the actual code... it's quite bad actually :/

Anyway it would be a bit nicer to remove the optional arg from the .h
files. In the .h file, change this:

explicit CloseButton(QWidget * parent=0, const QString& sName="close");

to this:

explicit CloseButton(QWidget * parent=0);

And in the .cpp file, change this:

CloseButton::CloseButton(QWidget * parent,const QString&
sName):KscdWidget(sName,parent)

to this:

CloseButton::CloseButton(QWidget *
parent):KscdWidget(I18N_NOOP("close"),parent)

Same for other button classes. The change in kscdwidget.cpp is fine.

This way you do not have to modify Messages.sh.

Aurélien



More information about the kde-multimedia mailing list