diff --git a/PianoBooster/src/GlView.cpp b/PianoBooster/src/GlView.cpp index bd656d5..420c316 100644 --- a/PianoBooster/src/GlView.cpp +++ b/PianoBooster/src/GlView.cpp @@ -227,14 +227,14 @@ void CGLView::drawDisplayText() glColor3f(1.0,1.0,1.0); if (m_song->getPlayMode() != PB_PLAY_MODE_listen) - renderText(30, y-4,0 ,"Accuracy:", m_timeRatingFont); + renderText(30, y-4,0 ,tr("Accuracy:"), m_timeRatingFont); if (m_titleHeight < 45 ) return; y = Cfg::getAppHeight() - m_titleHeight; - renderText(30, y+6, 0,"Song: " + m_song->getSongTitle(), m_timeRatingFont); + renderText(30, y+6, 0,tr("Song: ") + m_song->getSongTitle(), m_timeRatingFont); /* char buffer[100]; sprintf(buffer, "Notes %d wrong %d Late %d Score %4.1f%%", @@ -257,7 +257,7 @@ void CGLView::drawBarNumber() //CDraw::drColour (Cfg::noteColourDim()); //glRectf(x+30+10, y-2, x + 80, y + 16); glColor3f(1.0,1.0,1.0); - renderText(x, y, 0,"Bar: " + QString::number(m_song->getBarNumber()), m_timeRatingFont); + renderText(x, y, 0, tr("Bar: ") + QString::number(m_song->getBarNumber()), m_timeRatingFont); } void CGLView::resizeGL(int width, int height) diff --git a/PianoBooster/src/MidiFile.cpp b/PianoBooster/src/MidiFile.cpp index ccf9985..00f378d 100644 --- a/PianoBooster/src/MidiFile.cpp +++ b/PianoBooster/src/MidiFile.cpp @@ -89,15 +89,15 @@ void CMidiFile::openMidiFile(string filename) m_file.open(filename.c_str(), ios_base::in | ios_base::binary); if (m_file.fail() == true) { - QMessageBox::warning(0, "Midi File Error", - "Cannot open \"" + QString(filename.c_str()) + "\""); + QMessageBox::warning(0, tr("Midi File Error"), + tr("Cannot open \"" + QString(filename.c_str()) + "\"")); midiError(SMF_CANNOT_OPEN_FILE); return; } rewind(); if (getMidiError() != SMF_NO_ERROR) - QMessageBox::warning(0, "Midi File Error", - "Midi file\"" + QString(filename.c_str()) + "\" is corrupted"); + QMessageBox::warning(0, tr("Midi File Error"), + tr("Midi file\"" + QString(filename.c_str()) + "\" is corrupted")); } void CMidiFile::rewind() diff --git a/PianoBooster/src/QtMain.cpp b/PianoBooster/src/QtMain.cpp index 8c6a3f6..1619ebc 100644 --- a/PianoBooster/src/QtMain.cpp +++ b/PianoBooster/src/QtMain.cpp @@ -23,19 +23,31 @@ #include #include "QtWindow.h" - + int main(int argc, char *argv[]) { QApplication app(argc, argv); - + + QString locale = QLocale::system().name(); + printf("locale = %s\n", qPrintable(locale)); + + QTranslator translator; + translator.load(QString("pianobooster_") + locale); + + app.installTranslator(&translator); + + + if (!QGLFormat::hasOpenGL()) { - QMessageBox::information(0, "OpenGL support", - "This system does not support OpenGL which is needed to run Piano Booster."); + QMessageBox::information(0, tr("OpenGL support"), + tr("This system does not support OpenGL which is needed to run Piano Booster.")); return -1; } + + QtWindow window; - + window.show(); return app.exec(); } diff --git a/PianoBooster/src/QtWindow.cpp b/PianoBooster/src/QtWindow.cpp index b4d00b6..9e60e6c 100644 --- a/PianoBooster/src/QtWindow.cpp +++ b/PianoBooster/src/QtWindow.cpp @@ -183,16 +183,16 @@ void QtWindow::decodeMidiFileArg(QString arg) if (!fileInfo.exists() ) { - QMessageBox::warning(0, "PianoBooster Midi File Error", - "Cannot Open\"" + fileInfo.absoluteFilePath() + "\""); + QMessageBox::warning(0, tr("PianoBooster Midi File Error"), + tr("Cannot Open\"" + fileInfo.absoluteFilePath() + "\"")); exit(1); } else if ( !(fileInfo.fileName().endsWith(".mid", Qt::CaseInsensitive ) || fileInfo.fileName().endsWith(".midi", Qt::CaseInsensitive ) || fileInfo.fileName().endsWith(".kar", Qt::CaseInsensitive )) ) { - QMessageBox::warning(0, "PianoBooster Midi File Error", - "Not a Midi File \"" + fileInfo.fileName() + "\""); + QMessageBox::warning(0, tr("PianoBooster Midi File Error"), + tr("Not a Midi File \"" + fileInfo.fileName() + "\"")); exit(1); } else @@ -215,8 +215,8 @@ void QtWindow::decodeMidiFileArg(QString arg) m_settings->setValue("CurrentSong", fileInfo.absoluteFilePath()); else { - QMessageBox::warning(0, "PianoBooster Midi File Error", - "Not a valid MIDI file \"" + fileInfo.absoluteFilePath() + "\""); + QMessageBox::warning(0, tr("PianoBooster Midi File Error", + tr("Not a valid MIDI file \"" + fileInfo.absoluteFilePath() + "\"")); exit(1); } } diff --git a/PianoBooster/src/TrackList.cpp b/PianoBooster/src/TrackList.cpp index 15a0920..a1705ac 100644 --- a/PianoBooster/src/TrackList.cpp +++ b/PianoBooster/src/TrackList.cpp @@ -252,9 +252,9 @@ QStringList CTrackList::getAllChannelProgramNames(bool raw) if (raw == false) { if (CNote::leftHandChan() == chan) - hand += "L"; + hand += tr("L"); if (CNote::rightHandChan() == chan) - hand += "R"; + hand += tr("R"); } text = QString::number(chan+1) + hand + " " + getChannelProgramName(chan); items += text; @@ -327,10 +327,10 @@ QString CTrackList::getChannelProgramName(int chan) int program = m_midiFirstPatchChannels[chan]; if (chan==10-1) - return "Drums"; + return tr("Drums"); QString name = getProgramName(program +1); // Skip if (name.isEmpty()) - name = "Unknown"; + name = tr("Unknown"); return name; } @@ -339,135 +339,135 @@ QString CTrackList::getProgramName(int program) { const char * const gmInstrumentNames[] = { - "(None)", // Don't use - /* 1. */ "Grand Piano", - /* 2. */ "Bright Piano", - /* 3. */ "Electric Grand", - /* 4. */ "Honky-tonk Piano", - /* 5. */ "Electric Piano 1", - /* 6. */ "Electric Piano 2", - /* 7. */ "Harpsichord", - /* 8. */ "Clavi", - /* 9. */ "Celesta", - /* 10. */ "Glockenspiel", - /* 11. */ "Music Box", - /* 12. */ "Vibraphone", - /* 13. */ "Marimba", - /* 14. */ "Xylophone", - /* 15. */ "Tubular Bells", - /* 16. */ "Dulcimer", - /* 17. */ "Drawbar Organ", - /* 18. */ "Percussive Organ", - /* 19. */ "Rock Organ", - /* 20. */ "Church Organ", - /* 21. */ "Reed Organ", - /* 22. */ "Accordion", - /* 23. */ "Harmonica", - /* 24. */ "Tango Accordion", - /* 25. */ "Acoustic Guitar (nylon)", - /* 26. */ "Acoustic Guitar (steel)", - /* 27. */ "Electric Guitar (jazz)", - /* 28. */ "Electric Guitar (clean)", - /* 29. */ "Electric Guitar (muted)", - /* 30. */ "Overdriven Guitar", - /* 31. */ "Distortion Guitar", - /* 32. */ "Guitar harmonics", - /* 33. */ "Acoustic Bass", - /* 34. */ "Electric Bass (finger)", - /* 35. */ "Electric Bass (pick)", - /* 36. */ "Fretless Bass", - /* 37. */ "Slap Bass 1", - /* 38. */ "Slap Bass 2", - /* 39. */ "Synth Bass 1", - /* 40. */ "Synth Bass 2", - /* 41. */ "Violin", - /* 42. */ "Viola", - /* 43. */ "Cello", - /* 44. */ "Contrabass", - /* 45. */ "Tremolo Strings", - /* 46. */ "Pizzicato Strings", - /* 47. */ "Orchestral Harp", - /* 48. */ "Timpani", - /* 49. */ "String Ensemble 1", - /* 50. */ "String Ensemble 2", - /* 51. */ "SynthStrings 1", - /* 52. */ "SynthStrings 2", - /* 53. */ "Choir Aahs", - /* 54. */ "Voice Oohs", - /* 55. */ "Synth Voice", - /* 56. */ "Orchestra Hit", - /* 57. */ "Trumpet", - /* 58. */ "Trombone", - /* 59. */ "Tuba", - /* 60. */ "Muted Trumpet", - /* 61. */ "French Horn", - /* 62. */ "Brass Section", - /* 63. */ "SynthBrass 1", - /* 64. */ "SynthBrass 2", - /* 65. */ "Soprano Sax", - /* 66. */ "Alto Sax", - /* 67. */ "Tenor Sax", - /* 68. */ "Baritone Sax", - /* 69. */ "Oboe", - /* 70. */ "English Horn", - /* 71. */ "Bassoon", - /* 72. */ "Clarinet", - /* 73. */ "Piccolo", - /* 74. */ "Flute", - /* 75. */ "Recorder", - /* 76. */ "Pan Flute", - /* 77. */ "Blown Bottle", - /* 78. */ "Shakuhachi", - /* 79. */ "Whistle", - /* 80. */ "Ocarina", - /* 81. */ "Lead 1 (square)", - /* 82. */ "Lead 2 (sawtooth)", - /* 83. */ "Lead 3 (calliope)", - /* 84. */ "Lead 4 (chiff)", - /* 85. */ "Lead 5 (charang)", - /* 86. */ "Lead 6 (voice)", - /* 87. */ "Lead 7 (fifths)", - /* 88. */ "Lead 8 (bass + lead)", - /* 89. */ "Pad 1 (new age)", - /* 90. */ "Pad 2 (warm)", - /* 91. */ "Pad 3 (polysynth)", - /* 92. */ "Pad 4 (choir)", - /* 93. */ "Pad 5 (bowed)", - /* 94. */ "Pad 6 (metallic)", - /* 95. */ "Pad 7 (halo)", - /* 96. */ "Pad 8 (sweep)", - /* 97. */ "FX 1 (rain)", - /* 98. */ "FX 2 (soundtrack)", - /* 99. */ "FX 3 (crystal)", - /* 100. */ "FX 4 (atmosphere)", - /* 101. */ "FX 5 (brightness)", - /* 102. */ "FX 6 (goblins)", - /* 103. */ "FX 7 (echoes)", - /* 104. */ "FX 8 (sci-fi)", - /* 105. */ "Sitar", - /* 106. */ "Banjo", - /* 107. */ "Shamisen", - /* 108. */ "Koto", - /* 109. */ "Kalimba", - /* 110. */ "Bag pipe", - /* 111. */ "Fiddle", - /* 112. */ "Shanai", - /* 113. */ "Tinkle Bell", - /* 114. */ "Agogo", - /* 115. */ "Steel Drums", - /* 116. */ "Woodblock", - /* 117. */ "Taiko Drum", - /* 118. */ "Melodic Tom", - /* 119. */ "Synth Drum", - /* 120. */ "Reverse Cymbal", - /* 121. */ "Guitar Fret Noise", - /* 122. */ "Breath Noise", - /* 123. */ "Seashore", - /* 124. */ "Bird Tweet", - /* 125. */ "Telephone Ring", - /* 126. */ "Helicopter", - /* 127. */ "Applause", - /* 128. */ "Gunshot", + tr("(None)"), // Don't use + /* 1. */ tr("Grand Piano"), + /* 2. */ tr("Bright Piano"), + /* 3. */ tr("Electric Grand"), + /* 4. */ tr("Honky-tonk Piano"), + /* 5. */ tr("Electric Piano 1"), + /* 6. */ tr("Electric Piano 2"), + /* 7. */ tr("Harpsichord"), + /* 8. */ tr("Clavi"), + /* 9. */ tr("Celesta"), + /* 10. */ tr("Glockenspiel"), + /* 11. */ tr("Music Box"), + /* 12. */ tr("Vibraphone"), + /* 13. */ tr("Marimba"), + /* 14. */ tr("Xylophone"), + /* 15. */ tr("Tubular Bells"), + /* 16. */ tr("Dulcimer"), + /* 17. */ tr("Drawbar Organ"), + /* 18. */ tr("Percussive Organ"), + /* 19. */ tr("Rock Organ"), + /* 20. */ tr("Church Organ"), + /* 21. */ tr("Reed Organ"), + /* 22. */ tr("Accordion"), + /* 23. */ tr("Harmonica"), + /* 24. */ tr("Tango Accordion"), + /* 25. */ tr("Acoustic Guitar (nylon)"), + /* 26. */ tr("Acoustic Guitar (steel)"), + /* 27. */ tr("Electric Guitar (jazz)"), + /* 28. */ tr("Electric Guitar (clean)"), + /* 29. */ tr("Electric Guitar (muted)"), + /* 30. */ tr("Overdriven Guitar"), + /* 31. */ tr("Distortion Guitar"), + /* 32. */ tr("Guitar harmonics"), + /* 33. */ tr("Acoustic Bass"), + /* 34. */ tr("Electric Bass (finger)"), + /* 35. */ tr("Electric Bass (pick)"), + /* 36. */ tr("Fretless Bass"), + /* 37. */ tr("Slap Bass 1"), + /* 38. */ tr("Slap Bass 2"), + /* 39. */ tr("Synth Bass 1"), + /* 40. */ tr("Synth Bass 2"), + /* 41. */ tr("Violin"), + /* 42. */ tr("Viola"), + /* 43. */ tr("Cello"), + /* 44. */ tr("Contrabass"), + /* 45. */ tr("Tremolo Strings"), + /* 46. */ tr("Pizzicato Strings"), + /* 47. */ tr("Orchestral Harp"), + /* 48. */ tr("Timpani"), + /* 49. */ tr("String Ensemble 1"), + /* 50. */ tr("String Ensemble 2"), + /* 51. */ tr("SynthStrings 1"), + /* 52. */ tr("SynthStrings 2"), + /* 53. */ tr("Choir Aahs"), + /* 54. */ tr("Voice Oohs"), + /* 55. */ tr("Synth Voice"), + /* 56. */ tr("Orchestra Hit"), + /* 57. */ tr("Trumpet"), + /* 58. */ tr("Trombone"), + /* 59. */ tr("Tuba"), + /* 60. */ tr("Muted Trumpet"), + /* 61. */ tr("French Horn"), + /* 62. */ tr("Brass Section"), + /* 63. */ tr("SynthBrass 1"), + /* 64. */ tr("SynthBrass 2"), + /* 65. */ tr("Soprano Sax"), + /* 66. */ tr("Alto Sax"), + /* 67. */ tr("Tenor Sax"), + /* 68. */ tr("Baritone Sax"), + /* 69. */ tr("Oboe"), + /* 70. */ tr("English Horn"), + /* 71. */ tr("Bassoon"), + /* 72. */ tr("Clarinet"), + /* 73. */ tr("Piccolo"), + /* 74. */ tr("Flute"), + /* 75. */ tr("Recorder"), + /* 76. */ tr("Pan Flute"), + /* 77. */ tr("Blown Bottle"), + /* 78. */ tr("Shakuhachi"), + /* 79. */ tr("Whistle"), + /* 80. */ tr("Ocarina"), + /* 81. */ tr("Lead 1 (square)"), + /* 82. */ tr("Lead 2 (sawtooth)"), + /* 83. */ tr("Lead 3 (calliope)"), + /* 84. */ tr("Lead 4 (chiff)"), + /* 85. */ tr("Lead 5 (charang)"), + /* 86. */ tr("Lead 6 (voice)"), + /* 87. */ tr("Lead 7 (fifths)"), + /* 88. */ tr("Lead 8 (bass + lead)"), + /* 89. */ tr("Pad 1 (new age)"), + /* 90. */ tr("Pad 2 (warm)"), + /* 91. */ tr("Pad 3 (polysynth)"), + /* 92. */ tr("Pad 4 (choir)"), + /* 93. */ tr("Pad 5 (bowed)"), + /* 94. */ tr("Pad 6 (metallic)"), + /* 95. */ tr("Pad 7 (halo)"), + /* 96. */ tr("Pad 8 (sweep)"), + /* 97. */ tr("FX 1 (rain)"), + /* 98. */ tr("FX 2 (soundtrack)"), + /* 99. */ tr("FX 3 (crystal)"), + /* 100. */ tr("FX 4 (atmosphere)"), + /* 101. */ tr("FX 5 (brightness)"), + /* 102. */ tr("FX 6 (goblins)"), + /* 103. */ tr("FX 7 (echoes)"), + /* 104. */ tr("FX 8 (sci-fi)"), + /* 105. */ tr("Sitar"), + /* 106. */ tr("Banjo"), + /* 107. */ tr("Shamisen"), + /* 108. */ tr("Koto"), + /* 109. */ tr("Kalimba"), + /* 110. */ tr("Bag pipe"), + /* 111. */ tr("Fiddle"), + /* 112. */ tr("Shanai"), + /* 113. */ tr("Tinkle Bell"), + /* 114. */ tr("Agogo"), + /* 115. */ tr("Steel Drums"), + /* 116. */ tr("Woodblock"), + /* 117. */ tr("Taiko Drum"), + /* 118. */ tr("Melodic Tom"), + /* 119. */ tr("Synth Drum"), + /* 120. */ tr("Reverse Cymbal"), + /* 121. */ tr("Guitar Fret Noise"), + /* 122. */ tr("Breath Noise"), + /* 123. */ tr("Seashore"), + /* 124. */ tr("Bird Tweet"), + /* 125. */ tr("Telephone Ring"), + /* 126. */ tr("Helicopter"), + /* 127. */ tr("Applause"), + /* 128. */ tr("Gunshot"), }; if (program >= 0 && program < static_cast(arraySize(gmInstrumentNames))) diff --git a/PianoBooster/src/pianobooster.pro b/PianoBooster/src/pianobooster.pro index 668bc13..20c409c 100755 --- a/PianoBooster/src/pianobooster.pro +++ b/PianoBooster/src/pianobooster.pro @@ -1,9 +1,9 @@ #CONFIG += USE_FLUIDSYNTH CONFIG += release -TRANSLATIONS = translations/pianobooster_jp_JP.ts \ - translations/pianobooster_cn_CN.ts \ - translations/pianobooster_es_ES.ts \ +TRANSLATIONS = ../translations/pianobooster_ja_JP.ts \ + ../translations/pianobooster_cn_CN.ts \ + ../translations/pianobooster_es_ES.ts \ USE_FLUIDSYNTH {