Some Tours strings show up as untranslated

• Dec 23, 2018 - 19:27
Reported version
3.0
Priority
P0 - Critical
Type
Wording/Translation
Frequency
Many
Severity
S3 - Major
Reproducibility
Always
Status
fixed
Regression
No
Workaround
No
Project

Some translated Tours strings show up as untranslated on languages that have the Tours fully translated. I have
a) double-checked that the downloaded .zip file puts the tours_$LANG.qm in the same dir as instruments and mscore, and
b) contains the translated strings (viewed using Qt Linguist)

How to reproduce
1 mscore -f
2 Update the language you want to switch to
3 Switch to a language that is fully translated (e.g., Deutsch, Afrikaans), or has all 27 Tours strings translated.
4 Reset tours, e.g.
Hilfe > Touren > Touren Zurückzetsen
Help > Toere > Stel Toere terug
5 Restart MuseScore # NB; I have seen that some dialogs and some parts of MuseScore do not update dynamically, and due to caching, show the previous language.

I reproduced on the two biggest Tours, between them containing 14 of the 27 Tours strings, e.g. hopefully the below allows whoever looking at this to find the pattern and fix for all strings.

= Deutsch =

== Main tour ==
(will kick off when you start MuseScore)

De: Willkommen bei MuseScore
De: Das ist die “Partituransicht”
De: Dies sind die Werkzeugleisten.
De: Mit der Werkzeugleiste “Dateibefehle”
De: Mit der Werkzeugleiste “Wiedergabe”
De: Die Werkzeugleiste “Noteneingabe”
De: Mithilfe der Paletten
#En: The inspector allows you to control
De: Das Hauptmenü
#En: That’s the end of this tour

== Palettes tour ==
(click on any of the palette items to kick off)

#En: Welcome to the Palettes.
De: Jede Palette enthält
#En: There are different workspaces
De: Um etwas aus einer Palette

= Afrikaans =
== Main tour ==

(will kick off when you start MuseScore)
Af: Welkom by MuseScore
Af: Hierdie is die partituur-aansig
Af: Hierdie is die nutsbalke
Af: Die Leêerbewerkins-nutsbalk
Af: Die Terugspeel-kontroles-nutsbalk
Af: Die noottoevoer-nutsbalk
Af: Die palette laat jou toe
#En: The inspector allows you to control
Af: Die hoofkieslys
#En: That’s the end of our tour

== Palettes tour ==
(click on any of the palette items to kick off)

#En: Welcome to the Palettes.
Af: Elke palet bevat
#En: There are different workspaces
Af: Om ‘n paletitem by jou partituur te voeg


Comments

I would bet on the fact that the untranslated strings all contains HTML special entities &quot etc... but I have no idea how to fix it. The quickest route would be to remove the use of double and simple quotes in the source files...

Not really able to test now, but maybe something like

if (tourXml.name() == "Text") {
      QTextDocument doc;
      QString xmlText = tourXml.readXml().replace("&amp;","&").replace("&gt;",">").replace("&lt;","<").replace("&quot;", "\"").replace("&apos;", "'");
      QString ttext = qApp->translate("TourXML", xmlText.toUtf8().data());
      doc.setHtml(ttext);
      text = doc.toPlainText().replace("\\n", "\n");
      }

I suppose that @lasconic proposes to decode the string returned by XmlReader::readXml() since that function returns HTML-encoded string. I tested the proposed solution and it worked as we need to pass a raw (not HTML-encoded) string to qApp->translate.

However if no XML tags are planned to be used inside <Text> tag for tours then we can simply use readElementText instead. Are there some plans to use non-escaped XML inside <Text> tags or is there some other reason not to use readElementText?

However if no XML tags are planned to be used inside <Text&gt tag for tours

In this case, I guess the XML should use CDATA and readElementText would work too no ?

Yes, CDATA seems to be read correctly by readElementText. So should we switch then to readElementText and use CDATA in case we need some extra text markup?

Fix version
3.0.1