Cannot translate "Palettes", "Select workspace", "Add new workspace" nor the texts from Piano- and Drumroll

• Oct 31, 2014 - 23:51
Type
Wording/Translation
Severity
S4 - Minor
Status
closed
Project
Tags

I'm working on spanish translation. The strings are translated, but the changes are not shown


Comments

The issue is with the latest nightly, check the Palettes windows, the title "Palettes" and the toolTips for the workspace selection popup and the 'add workspace' button are not getting translated

Title Cannot translate "Select workspace" and "Add new workspace" Cannot translate "Palettes", "Select workspace", "Add new workspace"

I still do not know why the function tr() defined through the Q_OBJECT macro does not work in this case (while it works in other cases), but I think we have a possible work-around if we use the function:
QCoreApplication::translate("context", "sourceText")
I tried with QCoreApplication::translate("Ms::PaletteBox", "Palettes") instead of tr("Palettes") and lupdate (this command took more than 2 hours to complete!) and the output .ts files do contain the proper context and therefore the translation is properly read from the qm files (after compilation).

As a side note, lupdate gave some warnings/errors:

  1. /home/antonio/MuseScore_official/mscore/scoretab.h:84: Excess closing brace in C++ code (or abuse of the C++ preprocessor)
  2. /home/antonio/MuseScore_official/libmscore/chordline.cpp:23: Class 'Ms' lacks Q_OBJECT macro
  3. /home/antonio/MuseScore_official/libmscore/dsp.h:68: Excess closing parenthesis in C++ code (or abuse of the C++ preprocessor)
  4. /home/antonio/MuseScore_official/libmscore/dsp.cpp:108: Excess closing brace in C++ code (or abuse of the C++ preprocessor)
  5. /home/antonio/MuseScore_official/mscore/drumroll.cpp:61: Qualifying with unknown namespace/class ::DrumrollEditor
  6. /home/antonio/MuseScore_official/mscore/drumroll.cpp:195: Qualifying with unknown namespace/class ::DrumrollEditor
  7. /home/antonio/MuseScore_official/mscore/palettebox.cpp:29: Qualifying with unknown namespace/class ::PaletteBox
  8. /home/antonio/MuseScore_official/mscore/palettebox.cpp:216: Qualifying with unknown namespace/class ::PaletteBox
  9. /home/antonio/MuseScore_official/mscore/pianoroll.cpp:53: Qualifying with unknown namespace/class ::PianorollEditor
  10. /home/antonio/MuseScore_official/mscore/pianoroll.cpp:251: Qualifying with unknown namespace/class ::PianorollEditor
  11. /home/antonio/MuseScore_official/mscore/scoreaccessibility.cpp:36: Class 'Ms::AccessibleScoreView' lacks Q_OBJECT macro

I can't understand the first one (I think the number of braces is correct in scoretab.h).
The second one does not probably originate problems (but I didn't check).
The third and fourth are true errors: there is a missing opening brace in dsp.h and an extra closing brace in dsp.cpp.
The fifth up to the tenth are the cause of the missing translations: indeed, also the drumroll and pianoroll do not show the translated strings. For all of these we could use QCoreApplication::translate("Ms::nameoftheclass", string-to-be-translated)
I don't know if the last warning is an actual problem or something we can safely ignore.

Excellent analysis!

I though about such or a simular a workaround myself too, but I think we should rather find and fix the root cause?

on the 1st error: maybe lupdate is thrown off by the lacking space between #include and "musescore.h"? Or by something inside musescore.h?
2nd
3rd and 4th probably don't matter, they don't seem to be used at all, or do they? Fixing them won't harm though
11th should be an easy fix, whether needed or not. And/or might be caused by the #include not being separated by a space from the <...> (see above)

I think that the root cause could be the fact that the .h files are not including GUI .h files, but I am not 100% sure.

> on the 1st error: maybe lupdate is thrown off by the lacking space between #include and "musescore.h"?
It seems to be exactly this. Good catch!

> 3rd and 4th probably don't matter, they don't seem to be used at all, or do they? Fixing them won't harm though
Indeed, if I understood correctly, dsp.h is not called by other files (other than dsp.cpp). Should these two files be deleted from git?

Title Cannot translate "Palettes", "Select workspace", "Add new workspace" Cannot translate "Palettes", "Select workspace", "Add new workspace" nor the texts from Piano- and Drumroll