Allow translation of the style plugin names in molecule viewer
AbandonedPublic

Authored by yurchor on Dec 10 2018, 6:24 PM.

Details

Reviewers
pino
Group Reviewers
KDE Edu
Summary

Regretfully, up-to-now the plugin names were used directly and cannot be translated.

Test Plan

Use some locale with translations (e.g. "uk"). Switch the translated styles in the Molecule viewer (Tools -> Molecule Editor...).

Screenshot (Ukrainian locale with translated style in the red frame):

Diff Detail

Repository
R326 Kalzium
Lint
Lint Skipped
Unit
Unit Tests Skipped
yurchor created this revision.Dec 10 2018, 6:24 PM
Restricted Application added a project: KDE Edu. · View Herald TranscriptDec 10 2018, 6:24 PM
Restricted Application added a subscriber: kde-edu. · View Herald Transcript
yurchor requested review of this revision.Dec 10 2018, 6:24 PM
pino added a subscriber: pino.Dec 10 2018, 6:47 PM

IMHO it's better if you use the addItem(name, data) API, storing the name of each plugin in the combobox. Then it's easy to fetch the data of the selected item.
Also, the use of QOverload does not belong to this i18n fix, so it needs to be a separate patch.

yurchor updated this revision to Diff 47313.Dec 10 2018, 7:10 PM

Use addItem.

yurchor updated this revision to Diff 47508.Dec 13 2018, 12:42 PM

Make the connection between ui.styleCombo::currentIndexChanged and MoleculeDialog::slotUpdateScenePlugin ligical (first sends the number of index to the second).

Remove extra space at the end of the line.

yurchor updated this revision to Diff 47633.Dec 15 2018, 6:23 PM

Add two missing styles.

pino requested changes to this revision.Dec 15 2018, 6:45 PM
pino added inline comments.
src/tools/moleculeview.cpp
173

this now uses an UserRole...

176

... but this comparison is still with a DisplayRole, so it will never match

This revision now requires changes to proceed.Dec 15 2018, 6:45 PM
yurchor marked 2 inline comments as done.Dec 15 2018, 6:56 PM
yurchor added inline comments.
src/tools/moleculeview.cpp
173

Sure. Does not work when changed to Qt::DisplayRole

176

But it does (tested). Does not work when changed to Qt::UserRole.

yurchor updated this revision to Diff 47654.Dec 16 2018, 7:44 AM
yurchor marked 2 inline comments as done.

Sync the docs.

Restricted Application added a project: Documentation. · View Herald TranscriptDec 16 2018, 7:44 AM
Restricted Application added a subscriber: kde-doc-english. · View Herald Transcript
pino requested changes to this revision.Dec 16 2018, 8:49 AM

The approach here should be changed: instead of hardcoding the names of plugins in the styleCombo, they ought to be read directly from the sceneModel() of the GL widget. This way:

  1. the strings come directly from avogadro itself, no more need to translate them in kalzium
  2. the list of styles reflects what avogadro provides, so no more mismatch between what is hardcoded in kalzium vs the plugins avogadro has
  3. the documentation of kalzium ought to better not list all the plugins/styles available, since they depend on what avogadro has (mentioning a couple is more than enough, IMHO)

This also means that more i18n work is needed in avogadro itself.

doc/index.docbook
494

This change is fine, just commit it directly outside of this review request.

498–502

This change is fine, so just commit it outside of this review request.

src/tools/moleculeview.cpp
176

It "works" mostly because there is no i18n system in avogadrolibs, even though the strings are supposed to be translatable (marked with tr(), mentioned "shown in the gui" in the API docs, etc).

This revision now requires changes to proceed.Dec 16 2018, 8:49 AM
In D17494#377816, @pino wrote:

The approach here should be changed: instead of hardcoding the names of plugins in the styleCombo, they ought to be read directly from the sceneModel() of the GL widget. This way:

  1. the strings come directly from avogadro itself, no more need to translate them in kalzium
  2. the list of styles reflects what avogadro provides, so no more mismatch between what is hardcoded in kalzium vs the plugins avogadro has
  3. the documentation of kalzium ought to better not list all the plugins/styles available, since they depend on what avogadro has (mentioning a couple is more than enough, IMHO)

    This also means that more i18n work is needed in avogadro itself.

What is the way to proceed?

It seems I have a good friction with the current Avogadro maintainers. What should be changed? The translations are in the repo and on Launchpad, just not packed by the distributions.

Should I abandon this revision for some better times?

Could someone shake some salt of knowledge on my life about how to fix this "in model"?

Why it was good to use such an approach for other parts of Kalzium (can be easily proven by searching "->addItem")?

Thanks in advance for your answers.

yurchor updated this revision to Diff 47657.Dec 16 2018, 9:43 AM
yurchor marked 2 inline comments as done.

Commit the Avogadro page new URL and removal of the old instructions separately.

pino added a comment.Dec 16 2018, 10:18 AM
In D17494#377816, @pino wrote:

The approach here should be changed: instead of hardcoding the names of plugins in the styleCombo, they ought to be read directly from the sceneModel() of the GL widget. This way:

  1. the strings come directly from avogadro itself, no more need to translate them in kalzium
  2. the list of styles reflects what avogadro provides, so no more mismatch between what is hardcoded in kalzium vs the plugins avogadro has
  3. the documentation of kalzium ought to better not list all the plugins/styles available, since they depend on what avogadro has (mentioning a couple is more than enough, IMHO)

    This also means that more i18n work is needed in avogadro itself.

What is the way to proceed?

The one I explained above.

It seems I have a good friction with the current Avogadro maintainers. What should be changed? The translations are in the repo and on Launchpad, just not packed by the distributions.

Looking at avogadro 1.2.0 (Qt4 version), it seems they ship them, and at least the Debian packaging bundles them in the "avogadro" package.
The other thing is making sure that avogadro actually uses them (which seems to be done in 1.2.0).

Should I abandon this revision for some better times?

Following my suggestions would be a better way forward.

Could someone shake some salt of knowledge on my life about how to fix this "in model"?

ui.glWidget->sceneModel() returns a QAbstractItemModel, which can be iterated using its API.

Why it was good to use such an approach for other parts of Kalzium (can be easily proven by searching "->addItem")?

git log and find out who/why did that.

pino requested changes to this revision.Dec 16 2018, 10:18 AM
This revision now requires changes to proceed.Dec 16 2018, 10:18 AM
yurchor abandoned this revision.Dec 16 2018, 10:21 AM

Abandoned because the lack of needed knowledge from the author to satisfy the reviewer requirements.