Fix use of translation functions (#5629)

This commit is contained in:
Dominic Clark
2020-08-30 19:27:17 +01:00
committed by GitHub
parent 9ed41c4927
commit 5efb3a19cb
71 changed files with 132 additions and 135 deletions

View File

@@ -43,16 +43,14 @@ const float RES_PRECISION = 1000.0f;
// names for env- and lfo-targets - first is name being displayed to user
// and second one is used internally, e.g. for saving/restoring settings
const QString InstrumentSoundShaping::targetNames[InstrumentSoundShaping::NumTargets][3] =
const char *const InstrumentSoundShaping::targetNames[InstrumentSoundShaping::NumTargets][3] =
{
{ InstrumentSoundShaping::tr( "VOLUME" ), "vol",
InstrumentSoundShaping::tr( "Volume" ) },
/* InstrumentSoundShaping::tr( "Pan" ),
InstrumentSoundShaping::tr( "Pitch" ),*/
{ InstrumentSoundShaping::tr( "CUTOFF" ), "cut",
InstrumentSoundShaping::tr( "Cutoff frequency" ) },
{ InstrumentSoundShaping::tr( "RESO" ), "res",
InstrumentSoundShaping::tr( "Resonance" ) }
{ QT_TRANSLATE_NOOP("InstrumentSoundShaping", "VOLUME"), "vol",
QT_TRANSLATE_NOOP("InstrumentSoundShaping", "Volume") },
{ QT_TRANSLATE_NOOP("InstrumentSoundShaping", "CUTOFF"), "cut",
QT_TRANSLATE_NOOP("InstrumentSoundShaping", "Cutoff frequency") },
{ QT_TRANSLATE_NOOP("InstrumentSoundShaping", "RESO"), "res",
QT_TRANSLATE_NOOP("InstrumentSoundShaping", "Resonance") }
} ;
@@ -77,7 +75,7 @@ InstrumentSoundShaping::InstrumentSoundShaping(
value_for_zero_amount,
this );
m_envLfoParameters[i]->setDisplayName(
tr( targetNames[i][2].toUtf8().constData() ) );
tr( targetNames[i][2] ) );
}
m_filterModel.addItem( tr( "Low-pass" ), make_unique<PixmapLoader>( "filter_lp" ) );

View File

@@ -44,7 +44,7 @@ static Plugin::Descriptor dummyPluginDescriptor =
{
"dummy",
"dummy",
QT_TRANSLATE_NOOP( "pluginBrowser", "no description" ),
QT_TRANSLATE_NOOP( "PluginBrowser", "no description" ),
"Tobias Doerffel <tobydox/at/users.sf.net>",
0x0100,
Plugin::Undefined,

View File

@@ -1138,26 +1138,26 @@ void TrackContentObjectView::contextMenuEvent( QContextMenuEvent * cme )
{
contextMenu.addAction(
embed::getIconPixmap( "cancel" ),
tr( individualTCO
? "Delete (middle mousebutton)"
: "Delete selection (middle mousebutton)" ),
individualTCO
? tr("Delete (middle mousebutton)")
: tr("Delete selection (middle mousebutton)"),
[this](){ contextMenuAction( Remove ); } );
contextMenu.addSeparator();
contextMenu.addAction(
embed::getIconPixmap( "edit_cut" ),
tr( individualTCO
? "Cut"
: "Cut selection" ),
individualTCO
? tr("Cut")
: tr("Cut selection"),
[this](){ contextMenuAction( Cut ); } );
}
contextMenu.addAction(
embed::getIconPixmap( "edit_copy" ),
tr( individualTCO
? "Copy"
: "Copy selection" ),
individualTCO
? tr("Copy")
: tr("Copy selection"),
[this](){ contextMenuAction( Copy ); } );
contextMenu.addAction(
@@ -1169,9 +1169,9 @@ void TrackContentObjectView::contextMenuEvent( QContextMenuEvent * cme )
contextMenu.addAction(
embed::getIconPixmap( "muted" ),
tr( individualTCO
? "Mute/unmute (<%1> + middle click)"
: "Mute/unmute selection (<%1> + middle click)" ).arg(UI_CTRL_KEY),
(individualTCO
? tr("Mute/unmute (<%1> + middle click)")
: tr("Mute/unmute selection (<%1> + middle click)")).arg(UI_CTRL_KEY),
[this](){ contextMenuAction( Mute ); } );
constructContextMenu( &contextMenu );

View File

@@ -26,7 +26,7 @@
AudioDeviceSetupWidget::AudioDeviceSetupWidget(const QString & caption, QWidget * parent) :
TabWidget(TabWidget::tr("Settings for %1").arg(TabWidget::tr(caption.toLatin1())), parent)
TabWidget(TabWidget::tr("Settings for %1").arg(tr(caption.toUtf8())), parent)
{
}

View File

@@ -234,7 +234,7 @@ void EffectSelectDialog::rowChanged( const QModelIndex & _idx,
{
QLabel *label = new QLabel(m_descriptionWidget);
QString labelText = "<p><b>" + tr("Name") + ":</b> " + QString::fromUtf8(descriptor.displayName) + "</p>";
labelText += "<p><b>" + tr("Description") + ":</b> " + qApp->translate( "pluginBrowser", descriptor.description ) + "</p>";
labelText += "<p><b>" + tr("Description") + ":</b> " + qApp->translate( "PluginBrowser", descriptor.description ) + "</p>";
labelText += "<p><b>" + tr("Author") + ":</b> " + QString::fromUtf8(descriptor.author) + "</p>";
label->setText(labelText);

View File

@@ -31,7 +31,7 @@
MidiSetupWidget::MidiSetupWidget(const QString & caption, const QString & configSection,
const QString & devName, QWidget * parent) :
TabWidget(TabWidget::tr("Settings for %1").arg(tr(caption.toLatin1())), parent),
TabWidget(TabWidget::tr("Settings for %1").arg(tr(caption.toUtf8())), parent),
m_configSection(configSection),
m_device(nullptr)
{

View File

@@ -205,7 +205,9 @@ PluginDescWidget::PluginDescWidget(const PluginKey &_pk,
setFixedHeight( DEFAULT_HEIGHT );
setMouseTracking( true );
setCursor( Qt::PointingHandCursor );
setToolTip(_pk.description());
setToolTip(_pk.desc->subPluginFeatures
? _pk.description()
: tr(_pk.desc->description));
}

View File

@@ -31,12 +31,14 @@
#include <QMessageBox>
#include <QScrollArea>
#include "AudioDeviceSetupWidget.h"
#include "debug.h"
#include "embed.h"
#include "Engine.h"
#include "FileDialog.h"
#include "gui_templates.h"
#include "MainWindow.h"
#include "MidiSetupWidget.h"
#include "Mixer.h"
#include "ProjectJournal.h"
#include "SetupDialog.h"
@@ -195,14 +197,14 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
auto addLedCheckBox = [&XDelta, &YDelta, this](
const char* ledText,
const QString &ledText,
TabWidget* tw,
int& counter,
bool initialState,
const char* toggledSlot,
bool showRestartWarning
){
LedCheckBox * checkBox = new LedCheckBox(tr(ledText), tw);
LedCheckBox * checkBox = new LedCheckBox(ledText, tw);
counter++;
checkBox->move(XDelta, YDelta * counter);
checkBox->setChecked(initialState);
@@ -221,21 +223,21 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
tr("Graphical user interface (GUI)"), general_w);
addLedCheckBox("Display volume as dBFS ", gui_tw, counter,
addLedCheckBox(tr("Display volume as dBFS "), gui_tw, counter,
m_displaydBFS, SLOT(toggleDisplaydBFS(bool)), true);
addLedCheckBox("Enable tooltips", gui_tw, counter,
addLedCheckBox(tr("Enable tooltips"), gui_tw, counter,
m_tooltips, SLOT(toggleTooltips(bool)), true);
addLedCheckBox("Enable master oscilloscope by default", gui_tw, counter,
addLedCheckBox(tr("Enable master oscilloscope by default"), gui_tw, counter,
m_displayWaveform, SLOT(toggleDisplayWaveform(bool)), true);
addLedCheckBox("Enable all note labels in piano roll", gui_tw, counter,
addLedCheckBox(tr("Enable all note labels in piano roll"), gui_tw, counter,
m_printNoteLabels, SLOT(toggleNoteLabels(bool)), false);
addLedCheckBox("Enable compact track buttons", gui_tw, counter,
addLedCheckBox(tr("Enable compact track buttons"), gui_tw, counter,
m_compactTrackButtons, SLOT(toggleCompactTrackButtons(bool)), true);
addLedCheckBox("Enable one instrument-track-window mode", gui_tw, counter,
addLedCheckBox(tr("Enable one instrument-track-window mode"), gui_tw, counter,
m_oneInstrumentTrackWindow, SLOT(toggleOneInstrumentTrackWindow(bool)), true);
addLedCheckBox("Show sidebar on the right-hand side", gui_tw, counter,
addLedCheckBox(tr("Show sidebar on the right-hand side"), gui_tw, counter,
m_sideBarOnRight, SLOT(toggleSideBarOnRight(bool)), true);
addLedCheckBox("Mute automation tracks during solo", gui_tw, counter,
addLedCheckBox(tr("Mute automation tracks during solo"), gui_tw, counter,
m_soloLegacyBehavior, SLOT(toggleSoloLegacyBehavior(bool)), false);
gui_tw->setFixedHeight(YDelta + YDelta * counter);
@@ -248,11 +250,11 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
tr("Projects"), general_w);
addLedCheckBox("Compress project files by default", projects_tw, counter,
addLedCheckBox(tr("Compress project files by default"), projects_tw, counter,
m_MMPZ, SLOT(toggleMMPZ(bool)), true);
addLedCheckBox("Create a backup file when saving a project", projects_tw, counter,
addLedCheckBox(tr("Create a backup file when saving a project"), projects_tw, counter,
m_disableBackup, SLOT(toggleDisableBackup(bool)), false);
addLedCheckBox("Reopen last project on startup", projects_tw, counter,
addLedCheckBox(tr("Reopen last project on startup"), projects_tw, counter,
m_openLastProject, SLOT(toggleOpenLastProject(bool)), false);
projects_tw->setFixedHeight(YDelta + YDelta * counter);
@@ -372,9 +374,9 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
TabWidget * ui_fx_tw = new TabWidget(
tr("User interface (UI) effects vs. performance"), performance_w);
addLedCheckBox("Smooth scroll in song editor", ui_fx_tw, counter,
addLedCheckBox(tr("Smooth scroll in song editor"), ui_fx_tw, counter,
m_smoothScroll, SLOT(toggleSmoothScroll(bool)), false);
addLedCheckBox("Display playback cursor in AudioFileProcessor", ui_fx_tw, counter,
addLedCheckBox(tr("Display playback cursor in AudioFileProcessor"), ui_fx_tw, counter,
m_animateAFP, SLOT(toggleAnimateAFP(bool)), false);
ui_fx_tw->setFixedHeight(YDelta + YDelta * counter);
@@ -421,10 +423,10 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
connect(m_vstAlwaysOnTopCheckBox, SIGNAL(toggled(bool)),
this, SLOT(toggleVSTAlwaysOnTop(bool)));
addLedCheckBox("Sync VST plugins to host playback", plugins_tw, counter,
addLedCheckBox(tr("Sync VST plugins to host playback"), plugins_tw, counter,
m_syncVSTPlugins, SLOT(toggleSyncVSTPlugins(bool)), false);
addLedCheckBox("Keep effects running even without input", plugins_tw, counter,
addLedCheckBox(tr("Keep effects running even without input"), plugins_tw, counter,
m_disableAutoQuit, SLOT(toggleDisableAutoQuit(bool)), false);
plugins_tw->setFixedHeight(YDelta + YDelta * counter);
@@ -511,7 +513,7 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
it != m_audioIfaceSetupWidgets.end(); ++it)
{
m_audioIfaceNames[
tr(it.key().toLatin1())] = it.key();
AudioDeviceSetupWidget::tr(it.key().toUtf8())] = it.key();
}
for(trMap::iterator it = m_audioIfaceNames.begin();
it != m_audioIfaceNames.end(); ++it)
@@ -657,7 +659,7 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
it != m_midiIfaceSetupWidgets.end(); ++it)
{
m_midiIfaceNames[
tr(it.key().toLatin1())] = it.key();
MidiSetupWidget::tr(it.key().toUtf8())] = it.key();
}
for(trMap::iterator it = m_midiIfaceNames.begin();
it != m_midiIfaceNames.end(); ++it)
@@ -736,14 +738,14 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
QVBoxLayout * pathSelectorsLayout = new QVBoxLayout;
pathSelectorsLayout->setSpacing(10);
auto addPathEntry = [&](const char* caption,
auto addPathEntry = [&](const QString &caption,
const QString& content,
const char* setSlot,
const char* openSlot,
QLineEdit*& lineEdit,
const char* pixmap = "project_open")
{
TabWidget * newTw = new TabWidget(tr(caption),
TabWidget * newTw = new TabWidget(caption,
pathSelectors);
newTw->setFixedHeight(48);
@@ -763,37 +765,37 @@ SetupDialog::SetupDialog(ConfigTabs tab_to_open) :
pathSelectorsLayout->addSpacing(10);
};
addPathEntry("LMMS working directory", m_workingDir,
addPathEntry(tr("LMMS working directory"), m_workingDir,
SLOT(setWorkingDir(const QString &)),
SLOT(openWorkingDir()),
m_workingDirLineEdit);
addPathEntry("VST plugins directory", m_vstDir,
addPathEntry(tr("VST plugins directory"), m_vstDir,
SLOT(setVSTDir(const QString &)),
SLOT(openVSTDir()),
m_vstDirLineEdit);
addPathEntry("LADSPA plugins directories", m_ladspaDir,
addPathEntry(tr("LADSPA plugins directories"), m_ladspaDir,
SLOT(setLADSPADir(const QString &)),
SLOT(openLADSPADir()),
m_ladspaDirLineEdit, "add_folder");
addPathEntry("SF2 directory", m_sf2Dir,
addPathEntry(tr("SF2 directory"), m_sf2Dir,
SLOT(setSF2Dir(const QString &)),
SLOT(openSF2Dir()),
m_sf2DirLineEdit);
#ifdef LMMS_HAVE_FLUIDSYNTH
addPathEntry("Default SF2", m_sf2File,
addPathEntry(tr("Default SF2"), m_sf2File,
SLOT(setSF2File(const QString &)),
SLOT(openSF2File()),
m_sf2FileLineEdit);
#endif
addPathEntry("GIG directory", m_gigDir,
addPathEntry(tr("GIG directory"), m_gigDir,
SLOT(setGIGDir(const QString &)),
SLOT(openGIGDir()),
m_gigDirLineEdit);
addPathEntry("Theme directory", m_themeDir,
addPathEntry(tr("Theme directory"), m_themeDir,
SLOT(setThemeDir(const QString &)),
SLOT(openThemeDir()),
m_themeDirLineEdit);
addPathEntry("Background artwork", m_backgroundPicFile,
addPathEntry(tr("Background artwork"), m_backgroundPicFile,
SLOT(setBackgroundPicFile(const QString &)),
SLOT(openBackgroundPicFile()),
m_backgroundPicFileLineEdit);

View File

@@ -62,7 +62,7 @@ InstrumentSoundShapingView::InstrumentSoundShapingView( QWidget * _parent ) :
{
m_envLfoViews[i] = new EnvelopeAndLfoView( m_targetsTabWidget );
m_targetsTabWidget->addTab( m_envLfoViews[i],
tr( InstrumentSoundShaping::targetNames[i][0].toUtf8().constData() ),
tr( InstrumentSoundShaping::targetNames[i][0] ),
NULL );
}

View File

@@ -76,11 +76,6 @@
#include "TrackLabelButton.h"
const char * volume_help = QT_TRANSLATE_NOOP( "InstrumentTrack",
"With this knob you can set "
"the volume of the opened "
"channel.");
const int INSTRUMENT_WIDTH = 254;
const int INSTRUMENT_HEIGHT = INSTRUMENT_WIDTH;
const int PIANO_HEIGHT = 80;

View File

@@ -358,26 +358,26 @@ void SampleTCOView::contextMenuEvent( QContextMenuEvent * _cme )
{
contextMenu.addAction(
embed::getIconPixmap( "cancel" ),
tr( individualTCO
? "Delete (middle mousebutton)"
: "Delete selection (middle mousebutton)" ),
individualTCO
? tr("Delete (middle mousebutton)")
: tr("Delete selection (middle mousebutton)"),
[this](){ contextMenuAction( Remove ); } );
contextMenu.addSeparator();
contextMenu.addAction(
embed::getIconPixmap( "edit_cut" ),
tr( individualTCO
? "Cut"
: "Cut selection" ),
individualTCO
? tr("Cut")
: tr("Cut selection"),
[this](){ contextMenuAction( Cut ); } );
}
contextMenu.addAction(
embed::getIconPixmap( "edit_copy" ),
tr( individualTCO
? "Copy"
: "Copy selection" ),
individualTCO
? tr("Copy")
: tr("Copy selection"),
[this](){ contextMenuAction( Copy ); } );
contextMenu.addAction(
@@ -389,9 +389,9 @@ void SampleTCOView::contextMenuEvent( QContextMenuEvent * _cme )
contextMenu.addAction(
embed::getIconPixmap( "muted" ),
tr( individualTCO
? "Mute/unmute (<%1> + middle click)"
: "Mute/unmute selection (<%1> + middle click)" ).arg(UI_CTRL_KEY),
(individualTCO
? tr("Mute/unmute (<%1> + middle click)")
: tr("Mute/unmute selection (<%1> + middle click)")).arg(UI_CTRL_KEY),
[this](){ contextMenuAction( Mute ); } );
/*contextMenu.addAction( embed::getIconPixmap( "record" ),