diff options
Diffstat (limited to 'muse2')
-rwxr-xr-x | muse2/find_manual_plural.sh | 20 | ||||
-rwxr-xr-x | muse2/find_translation_concatenation.sh | 16 | ||||
-rw-r--r-- | muse2/muse/app.cpp | 8 | ||||
-rw-r--r-- | muse2/muse/arranger/pcanvas.cpp | 7 | ||||
-rw-r--r-- | muse2/muse/importmidi.cpp | 5 | ||||
-rw-r--r-- | muse2/muse/instruments/editinstrument.cpp | 14 | ||||
-rw-r--r-- | muse2/muse/song.cpp | 3 | ||||
-rw-r--r-- | muse2/muse/widgets/filedialog.cpp | 8 | ||||
-rw-r--r-- | muse2/muse/widgets/pastedialog.cpp | 4 | ||||
-rw-r--r-- | muse2/muse/widgets/pasteeventsdialog.cpp | 4 | ||||
-rw-r--r-- | muse2/muse/widgets/routepopup.cpp | 2 | ||||
-rw-r--r-- | muse2/muse/widgets/shortcutcapturedialog.cpp | 2 |
12 files changed, 62 insertions, 31 deletions
diff --git a/muse2/find_manual_plural.sh b/muse2/find_manual_plural.sh new file mode 100755 index 00000000..3e77f304 --- /dev/null +++ b/muse2/find_manual_plural.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# this script tries to find all "bad" code like +# (number > 1 ? tr ("tracks") : tr("track")) +# that is, all manual plural diversifications +# you should replace them by: +# tr("processed %n track(s)", "", number) +# the "" is a translator comment. you may write what you want +# +# you have to create appropriate translations for this (even for +# english!). linguist will ask you for the singular, plural, +# and in some language even paucal form then. +# +# this script is not perfect. it misses some "bad" things, and +# finds some "good" things. + +{ +find . -iname '*.cpp' -print0 | xargs -0 grep -E '[^:]: *tr *\("[^"]*".*\)' +find . -iname '*.cpp' -print0 | xargs -0 grep -E '\? *tr *\("[^"]*".*\)' +} | sort | uniq diff --git a/muse2/find_translation_concatenation.sh b/muse2/find_translation_concatenation.sh new file mode 100755 index 00000000..644944f1 --- /dev/null +++ b/muse2/find_translation_concatenation.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# this script tries to find all "bad" code like +# tr("the file ") + your_file + tr(" could not be loaded!") +# you should replace it by: +# tr("the file %1 could not be loaded!").arg(your_file) +# +# this script is not perfect. it misses some "bad" things, and +# finds some "good" things. + +{ +find . -iname '*.cpp' -print0 | xargs -0 grep -E 'tr *\("[^"]*" *\) *\+'; +find . -iname '*.cpp' -print0 | xargs -0 grep -E '\+ *tr *\("[^"]*" *\)'; +} | sort | uniq + + diff --git a/muse2/muse/app.cpp b/muse2/muse/app.cpp index 3d52e4f2..7c716464 100644 --- a/muse2/muse/app.cpp +++ b/muse2/muse/app.cpp @@ -1218,7 +1218,7 @@ void MusE::loadProjectFile1(const QString& name, bool songTemplate, bool loadAll } else { QMessageBox::critical(this, QString("MusE"), - tr("Unknown File Format: ") + ex); + tr("Unknown File Format: %1").arg(ex)); setUntitledProject(); } if (!songTemplate) { @@ -1348,7 +1348,7 @@ void MusE::setUntitledProject() QString name("untitled"); MusEGlobal::museProject = "./"; //QFileInfo(name).absolutePath(); project.setFile(name); - setWindowTitle(tr("MusE: Song: ") + project.completeBaseName()); + setWindowTitle(tr("MusE: Song: %1").arg(project.completeBaseName())); } //--------------------------------------------------------- @@ -1756,7 +1756,7 @@ bool MusE::saveAs() ok = save(name, true); if (ok) { project.setFile(name); - setWindowTitle(tr("MusE: Song: ") + project.completeBaseName()); + setWindowTitle(tr("MusE: Song: %1").arg(project.completeBaseName())); addProject(name); } else @@ -2651,7 +2651,7 @@ MusE::lash_idle_cb () int ok = save (ss.toAscii(), false); if (ok) { project.setFile(ss.toAscii()); - setWindowTitle(tr("MusE: Song: ") + project.completeBaseName()); + setWindowTitle(tr("MusE: Song: %1").arg(project.completeBaseName())); addProject(ss.toAscii()); MusEGlobal::museProject = QFileInfo(ss.toAscii()).absolutePath(); } diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp index 10cd9735..9e27ca41 100644 --- a/muse2/muse/arranger/pcanvas.cpp +++ b/muse2/muse/arranger/pcanvas.cpp @@ -771,7 +771,7 @@ void PartCanvas::itemPopup(MusEWidget::CItem* item, int n, const QPoint& pt) { Part* p = item->part(); EventList* el = p->events(); - QString str = tr("Part name") + ": " + p->name() + "\n" + tr("Files") + ":"; + QString str = tr("Part name: %1\nFiles:").arg(p->name()); for (iEvent e = el->begin(); e != el->end(); ++e) { Event event = e->second; @@ -2861,9 +2861,8 @@ Undo PartCanvas::pasteAt(const QString& pt, Track* track, unsigned int pos, bool { int tot = notDone + done; QMessageBox::critical(this, QString("MusE"), - QString().setNum(notDone) + (tot > 1 ? (tr(" out of ") + QString().setNum(tot)) : QString("")) + - (tot > 1 ? tr(" parts") : tr(" part")) + - tr(" could not be pasted.\nLikely the selected track is the wrong type.")); + (tot > 1 ? tr("%n part(s) out of %1 could not be pasted.\nLikely the selected track is the wrong type.","",notDone).arg(tot) + : tr("%n part(s) could not be pasted.\nLikely the selected track is the wrong type.","",notDone))); } if (finalPosPtr) *finalPosPtr=finalPos; diff --git a/muse2/muse/importmidi.cpp b/muse2/muse/importmidi.cpp index fd690671..558ffb69 100644 --- a/muse2/muse/importmidi.cpp +++ b/muse2/muse/importmidi.cpp @@ -618,9 +618,8 @@ void MusE::importPartToTrack(QString& filename, unsigned tick, Track* track) { int tot = notDone + done; QMessageBox::critical(this, QString("MusE"), - QString().setNum(notDone) + (tot > 1 ? (tr(" out of ") + QString().setNum(tot)) : QString("")) + - (tot > 1 ? tr(" parts") : tr(" part")) + - tr(" could not be imported.\nLikely the track is the wrong type.")); + (tot > 1 ? tr("%n part(s) out of %1 could not be imported.\nLikely the selected track is the wrong type.","",notDone).arg(tot) + : tr("%n part(s) could not be imported.\nLikely the selected track is the wrong type.","",notDone))); } return; diff --git a/muse2/muse/instruments/editinstrument.cpp b/muse2/muse/instruments/editinstrument.cpp index 49bdd6c2..e1639d04 100644 --- a/muse2/muse/instruments/editinstrument.cpp +++ b/muse2/muse/instruments/editinstrument.cpp @@ -408,7 +408,7 @@ void EditInstrument::saveAs() { if(QMessageBox::question(this, tr("MusE:"), - tr("The user instrument directory\n") + MusEGlobal::museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") + + tr("The user instrument directory\n%1\ndoes not exist yet. Create it now?\n").arg(MusEGlobal::museUserInstruments) + tr("(You can change the user instruments directory at Settings->Global Settings->Midi)"), QMessageBox::Ok | QMessageBox::Default, QMessageBox::Cancel | QMessageBox::Escape, @@ -419,7 +419,7 @@ void EditInstrument::saveAs() else { printf("Unable to create user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData()); - QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + MusEGlobal::museUserInstruments); + QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory '%1'").arg(MusEGlobal::museUserInstruments)); //return; path = MusEGlobal::museUser; } @@ -610,7 +610,7 @@ void EditInstrument::fileSaveAs() // Can not have two user files containing the same instrument name. if(QMessageBox::question(this, tr("MusE: Save instrument as"), - tr("The user instrument:\n") + s + tr("\nalready exists. This will overwrite its .idf instrument file.\nAre you sure?"), + tr("The user instrument '%1' already exists. This will overwrite its .idf instrument file.\nAre you sure?").arg(s), QMessageBox::Ok | QMessageBox::Default, QMessageBox::Cancel | QMessageBox::Escape, Qt::NoButton) == QMessageBox::Ok) @@ -700,7 +700,7 @@ void EditInstrument::fileSaveAs() { if(QMessageBox::question(this, tr("MusE:"), - tr("The user instrument directory\n") + MusEGlobal::museUserInstruments + tr("\ndoes not exist yet. Create it now?\n") + + tr("The user instrument directory\n%1\ndoes not exist yet. Create it now?\n").arg(MusEGlobal::museUserInstruments) + tr("(You can change the user instruments directory at Settings->Global Settings->Midi)"), QMessageBox::Ok | QMessageBox::Default, QMessageBox::Cancel | QMessageBox::Escape, @@ -711,7 +711,7 @@ void EditInstrument::fileSaveAs() else { printf("Unable to create user instrument directory: %s\n", MusEGlobal::museUserInstruments.toLatin1().constData()); - QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory\n") + MusEGlobal::museUserInstruments); + QMessageBox::critical(this, tr("MusE:"), tr("Unable to create user instrument directory '%1'").arg(MusEGlobal::museUserInstruments)); //return; path = MusEGlobal::museUser; } @@ -3111,7 +3111,7 @@ void EditInstrument::addControllerClicked() { QMessageBox::critical(this, tr("MusE: Cannot add common controller"), - tr("A controller named ") + name + tr(" already exists."), + tr("A controller named '%1' already exists.").arg(name), QMessageBox::Ok, Qt::NoButton, Qt::NoButton); @@ -3123,7 +3123,7 @@ void EditInstrument::addControllerClicked() { QMessageBox::critical(this, tr("MusE: Cannot add common controller"), - tr("A controller number ") + QString().setNum(num) + tr(" already exists."), + tr("A controller number %1 already exists.").arg(num), QMessageBox::Ok, Qt::NoButton, Qt::NoButton); diff --git a/muse2/muse/song.cpp b/muse2/muse/song.cpp index 7adc37f3..29ed7023 100644 --- a/muse2/muse/song.cpp +++ b/muse2/muse/song.cpp @@ -3804,8 +3804,7 @@ void Song::executeScript(const char* scriptfile, PartList* parts, int quant, boo if (myProcess->exitCode()) { QMessageBox::warning(MusEGlobal::muse, tr("MusE - external script failed"), - tr("MusE was unable to launch the script, error message:\n ")+ QString(errStr) - ); + tr("MusE was unable to launch the script, error message:\n%1").arg(QString(errStr))); endUndo(SC_EVENT_REMOVED); return; } diff --git a/muse2/muse/widgets/filedialog.cpp b/muse2/muse/widgets/filedialog.cpp index 0df0fa7f..4e3c1fb2 100644 --- a/muse2/muse/widgets/filedialog.cpp +++ b/muse2/muse/widgets/filedialog.cpp @@ -78,8 +78,7 @@ static bool testDirCreate(QWidget* parent, const QString& path) { if(QMessageBox::information(parent, QWidget::tr("MusE: get file name"), - QWidget::tr("The directory\n") + path - + QWidget::tr("\ndoes not exist.\nCreate it?"), + QWidget::tr("The directory\n%1\ndoes not exist.\nCreate it?").arg(path), QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok) != QMessageBox::Ok) return true; @@ -483,7 +482,7 @@ FILE* fileOpen(QWidget* parent, QString name, const QString& ext, } if (strcmp(mode,"w") == 0 && overwriteWarning && info.exists()) { - QString s(QWidget::tr("File\n") + name + QWidget::tr("\nexists. Overwrite?")); + QString s(QWidget::tr("File\n%1\nexists. Overwrite?").arg(name)); /* int rv = QMessageBox::warning(parent, QWidget::tr("MusE: write"), @@ -516,8 +515,7 @@ FILE* fileOpen(QWidget* parent, QString name, const QString& ext, fp = fopen(name.toAscii().data(), mode); } if (fp == 0 && !noError) { - QString s(QWidget::tr("Open File\n") + name + QWidget::tr("\nfailed: ") - + QString(strerror(errno))); + QString s(QWidget::tr("Open File\n%1\nfailed: %2").arg(name).arg(strerror(errno))); QMessageBox::critical(parent, QWidget::tr("MusE: Open File"), s); return 0; } diff --git a/muse2/muse/widgets/pastedialog.cpp b/muse2/muse/widgets/pastedialog.cpp index 7c9c2248..bc031b30 100644 --- a/muse2/muse/widgets/pastedialog.cpp +++ b/muse2/muse/widgets/pastedialog.cpp @@ -85,9 +85,9 @@ QString PasteDialog::ticks_to_quarter_string(int ticks) double quarters = (double) ticks/config.division; bool one = ( quarters > 0.995 && quarters < 1.005 ); if (one) - return QString::number(quarters, 'f', 2) + " " + tr("quarter"); + return tr("%1 quarter", "for floating-point arguments like 1.5").arg(quarters, 0, 'f', 2); else - return QString::number(quarters, 'f', 2) + " " + tr("quarters"); + return tr("%1 quarters", "for floating-point arguments like 1.5").arg(quarters, 0, 'f', 2); } } diff --git a/muse2/muse/widgets/pasteeventsdialog.cpp b/muse2/muse/widgets/pasteeventsdialog.cpp index 04b7cbd7..e8436711 100644 --- a/muse2/muse/widgets/pasteeventsdialog.cpp +++ b/muse2/muse/widgets/pasteeventsdialog.cpp @@ -99,9 +99,9 @@ QString PasteEventsDialog::ticks_to_quarter_string(int ticks) double quarters = (double) ticks/config.division; bool one = ( quarters > 0.995 && quarters < 1.005 ); if (one) - return QString::number(quarters, 'f', 2) + " " + tr("quarter"); + return tr("%1 quarter", "for floating-point arguments like 1.5").arg(quarters, 0, 'f', 2); else - return QString::number(quarters, 'f', 2) + " " + tr("quarters"); + return tr("%1 quarters", "for floating-point arguments like 1.5").arg(quarters, 0, 'f', 2); } } diff --git a/muse2/muse/widgets/routepopup.cpp b/muse2/muse/widgets/routepopup.cpp index ec3f3ea0..0336f8ed 100644 --- a/muse2/muse/widgets/routepopup.cpp +++ b/muse2/muse/widgets/routepopup.cpp @@ -1152,7 +1152,7 @@ void RoutePopupMenu::prepare() continue; PopupMenu* subp = new PopupMenu(morep, true); - subp->setTitle(QString("%1:").arg(i) + tr("<none>")); + subp->setTitle(QString("%1:%2").arg(i).arg(tr("<none>"))); // MusE-2: Check this - needed with QMenu? Help says no. No - verified, it actually causes double triggers! //connect(subp, SIGNAL(triggered(QAction*)), pup, SIGNAL(triggered(QAction*))); diff --git a/muse2/muse/widgets/shortcutcapturedialog.cpp b/muse2/muse/widgets/shortcutcapturedialog.cpp index a470d698..26526f1e 100644 --- a/muse2/muse/widgets/shortcutcapturedialog.cpp +++ b/muse2/muse/widgets/shortcutcapturedialog.cpp @@ -105,7 +105,7 @@ void ShortcutCaptureDialog::keyPressEvent(QKeyEvent* e) (( shortcuts[i].type & (shortcuts[shortcutindex].type | INVIS_SHRT)) || shortcuts[i].type & GLOBAL_SHRT || shortcuts[shortcutindex].type & GLOBAL_SHRT)) { // affect the same scope - msgString = tr("Shortcut conflicts with ") + QString(shortcuts[i].descr); + msgString = tr("Shortcut conflicts with %1").arg(shortcuts[i].descr); conflict = true; break; } |