[bt-devel] retranslateUi

Jaak Ristioja Ristioja at gmail.com
Wed Jan 27 03:18:57 MST 2010


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

Hello!

On 27.01.2010 11:24, Eeli Kaikkonen wrote:
> As far as I know it doesn't have any other use than to make possible
> changing the translation on the fly. However, I seriously question the
> need for that feature. Can anyone give any use case where that is
> necessary or especially useful for some users, other than possibly
> BibleTime translators or developers? If we want that user can change
> their UI language without using env variables, it's easy to do it by
> first selecting the language and then restarting the application. How
> many applications you can name which can change the UI language on the
> fly? Who would use that feature for more than couple of times in his
> life?
In multilingual environments one might want to change the translation on-the-fly, e.g. if
there are people speaking different languages using BibleTime. Changing environment
variables is not likely a skill of the average computer user. Personally I've seen quite a
lot of applications that can change the language on-the-fly, e.g. FileZilla or
FreeCommander on Windows are the first to come to mind.

> I feel that adding a new method for translation clutters the API. On the
> other hand it's consistently named, so it shouldn't be hard to
> understand in every place, but adding methods makes class files a bit
> harder to navigate and read. I also find it easier to have UI strings
> with the corresponding code. It's easy to find where a widget is
> created. Also, if I write new code and create a new widget, it's easier
> to put the tr("text") to the same place where the code is.
Its usually just one method. Personally I see another benefit in it: setText(),
setWindowTitle(), setWhatsThis(), setTooltip(), setStatusTip() etc will all be in the
retranslateUi() method. This means such things will not clutter other methods that
initialize these widgets. For me its much easier to read a method which just initializes
the widget and adds it to a container widget, than to read a method which does a gazillion
things at once (initialization, setting UI texts, placing the widget, connecting signals
etc). I agree that creating widget like this:

   m_myWidget = new QSomeWidget(tr("Hello world!"), this);

will save some typing for the developer and might therefore be a bit more comfortable for
us. 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!"));
   m_widget->setToolTip(tr("Hello tooltip readers!"));
   m_widget->setStatusTip(tr("Hello statustip readers!"));
   m_widget2 = new QSomeOtherWidget(tr("Yay more strings!"), m_widget);
   m_widget2->setNewAttributes(more_values, yay);
   m_widget->addWidget(m_widget2);
   m_containerWidget->addWidget(m_widget);
   connect(m_widget2, SIGNAL(someSignal()),
           m_widget,  SIGNAL(otherSignal()));
   connect(m_widget, SIGNAL(otherSignal()),
           this,     SLOT(slotDoSomething()));

Doesn't feel right. I think if we were to break these things up, it would be a lot easier
for us to manage, regardless of the fact that not everything related to one widget will be
in one method.

> In short, I find only drawbacks in retranslateUi method and no good
> sides.
Thanks for starting this much-needed discussion! :)

Jaak
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)

iQgcBAEBAgAGBQJLYBMIAAoJEFqwhAoGc/hvalg/+QEj37bNSyj50xTDRcPOqlMh
VQ19IvVBcYts3v2yOMXNJ7ofzirYWxa6Lp1wnyM2K6JdgzgMen+0gVMclviWboBy
kYZx2MV0SYUCfrBr5mOtlkyV/7LESomtsj51QvM0BnDDK9D3mpbIkYvOJnJkAzMZ
L3qooDzoy13/CQvoFhbrBMTVERM0UX7a13JXP+p6PqnEy1oKfYcjX0RSrMDVYN8T
uy/x4ZAVFSFcslF/hgEyLzyYF57GOvI3jpJ4n9PkSgLK1bdvSf/35uXYsjwjan3M
fj2/fLagaziq7E/VpVKevCii+TkuSe/UDmRR44OYgv5B5Tp6t5bKx6lLsBya6Lpu
V1Pb2SD0zfEBvvrQHMiRiwGNVZbGDLPKnOAgpzOEJ4rMpXjX5UQg/DQCV0smEWQs
h3HBAElsmuZJmIRtxsSvAGAxVilpRdh7ZOlORkXybbtSoeiLfKj2VUkbpp3VJZKp
BwoTvFLwg6kqo+ja/t/U3z45HYn+McCcIm6l6DhcWGePakjAbCiUcMufJhiVh6aD
G2SBZ3VroiHb9z2XoO98qhVyUqe9f/oN4290TSi9wy5rPQSA97b5TuwdycWXd09U
9XlcoP9dgr3BYQG5gkNTsejITuZwzmvIInyVKWbfflKYHvk+0My2jgTkSUtOHi29
Cp+sjEDD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