[bt-devel] retranslateUi

Jaak Ristioja Ristioja at gmail.com
Thu Jan 28 06:39:20 MST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 28.01.2010 14:18, Eeli Kaikkonen wrote:
> On Wed, 27 Jan 2010, Eeli Kaikkonen wrote:
>>> However, heres an extreme example of the theoretical opposite which we might likely
>>> reach in the future, on how this might be a problem: imagine a method initializing ten
>>> widgets in the following manner:
>>>
>>>    m_widget = new QSomeWidget(tr("Hello world!"), this);
>>>    m_widget->setSomeAttribute(someValue, someOtherValue);
>>>    m_widget->setWhatsThis(tr("Hello whatsthis readers!"));
>>
>> OK, that's a valid point. Please, all, comment on this. Does the
>> retranslateUi in every class make the code easier to read and write?
> 
> This is the question which the developers haven't yet answered, and yet
> it's more important to us than the translation UI issue. We need
> comments and opinions.

This is probably something Eeli and I disagree on. I think it is somewhat also a matter of
personal preference. For example for me all of the tr() strings in the middle of widget
initialization are a bit counterproductive. When I look at the code which creates new
widgets and puts them into place, and there is of lot of tr() going on, then "my vision
gets blurry and I see small ants instead of letters and code on the screen" :P

I don't know how much headache it will cause all of You if we had most of tr() calls (e.g.
with setText(), setWindowTitle(), setWhatsThis() etc) in retranslateUi() instead. But if
we were to archive that (retranslateUi() for all widgets), it would be relatively easy to
add dynamic translations.

To sum up: I think that retranslateUi() methods DO keep the code cleaner and easier to manage.

Jaak

PS: Since I've been doing a lot of refactoring, and will continue to do so, further issues
like this might emerge in the future. If I'm not mistaken, then the retranslateUi() issue
was brought up because of some refactoring I did on the BibleTime class (main window)
lately. The previous code just didn't look good (the QAction initialization method also
did everything else like initializing the toolbar and the main menu), therefore I needed
to break it up, hence I also implemented retranslateUi().
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)

iQgcBAEBAgAGBQJLYZMVAAoJEFqwhAoGc/hvELBAALK9+EVUY307+tozDCtBRe0v
TeWutAOxb+6q0ZfX+MNfDzBk/NcJnMS3N8brF5ceVRgenHEvP24K8/fvhh3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