From 859212df2523e8b15076d968018dbf98618fd60f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 15 Jun 2010 10:44:51 +0000 Subject: Implement translation support for ScummVM GUI. Based on patch #2903830: "Updated Translation Prototype" by alexbevi which in turn is based on patch #1739965 by jvprat. Currently it builds all translations right into ScummVM. Once the feature will be accepted more widely, i.e. more translations will pop up, it will be trivial to move translation strings to external file. Finished translation: Russian Unfinished translation: Hungarian Things which are nice to do: - Language code -> language mapping for more user friendness - Specifying fonts to be used with language - Updating of interface language without restart. It will require moving of much code to reflowLayout() methods for each dialog The .po files must be in single byte encodings. I.e. no support for Unicode. svn-id: r49759 --- base/main.cpp | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'base') diff --git a/base/main.cpp b/base/main.cpp index bfb6611a91..ad6118c905 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -47,6 +47,7 @@ #include "common/fs.h" #include "common/system.h" #include "common/tokenizer.h" +#include "common/translation.h" #include "gui/GuiManager.h" #include "gui/message.h" @@ -101,20 +102,20 @@ static const EnginePlugin *detectPlugin() { ConfMan.set("gameid", gameid); // Query the plugins and find one that will handle the specified gameid - printf("User picked target '%s' (gameid '%s')...\n", ConfMan.getActiveDomainName().c_str(), gameid.c_str()); - printf(" Looking for a plugin supporting this gameid... "); + printf(_t("User picked target '%s' (gameid '%s')...\n"), ConfMan.getActiveDomainName().c_str(), gameid.c_str()); + printf(_t(" Looking for a plugin supporting this gameid... ")); GameDescriptor game = EngineMan.findGame(gameid, &plugin); if (plugin == 0) { - printf("failed\n"); - warning("%s is an invalid gameid. Use the --list-games option to list supported gameid", gameid.c_str()); + printf(_t("failed\n")); + warning(_t("%s is an invalid gameid. Use the --list-games option to list supported gameid"), gameid.c_str()); return 0; } else { printf("%s\n", plugin->getName()); } // FIXME: Do we really need this one? - printf(" Starting '%s'\n", game.description().c_str()); + printf(_t(" Starting '%s'\n"), game.description().c_str()); return plugin; } @@ -141,9 +142,9 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const // Is a separate dialog here still required? //GUI::displayErrorDialog("ScummVM could not find any game in the specified directory!"); - const char *errMsg = Common::errorToString(err); + const char *errMsg = _(Common::errorToString(err)); - warning("%s failed to instantiate engine: %s (target '%s', path '%s')", + warning(_t("%s failed to instantiate engine: %s (target '%s', path '%s')"), plugin->getName(), errMsg, ConfMan.getActiveDomainName().c_str(), @@ -200,7 +201,7 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const while (!tokenizer.empty()) { Common::String token = tokenizer.nextToken(); if (!DebugMan.enableDebugChannel(token)) - warning("Engine does not support debug level '%s'", token.c_str()); + warning(_("Engine does not support debug level '%s'"), token.c_str()); } // Inform backend that the engine is about to be run @@ -268,22 +269,22 @@ static void setupKeymapper(OSystem &system) { mapper->registerHardwareKeySet(keySet); // Now create the global keymap - act = new Action(globalMap, "MENU", "Menu", kGenericActionType, kSelectKeyType); + act = new Action(globalMap, "MENU", _("Menu"), kGenericActionType, kSelectKeyType); act->addKeyEvent(KeyState(KEYCODE_F5, ASCII_F5, 0)); - act = new Action(globalMap, "SKCT", "Skip", kGenericActionType, kActionKeyType); + act = new Action(globalMap, "SKCT", _("Skip"), kGenericActionType, kActionKeyType); act->addKeyEvent(KeyState(KEYCODE_ESCAPE, ASCII_ESCAPE, 0)); - act = new Action(globalMap, "PAUS", "Pause", kGenericActionType, kStartKeyType); + act = new Action(globalMap, "PAUS", _("Pause"), kGenericActionType, kStartKeyType); act->addKeyEvent(KeyState(KEYCODE_SPACE, ' ', 0)); - act = new Action(globalMap, "SKLI", "Skip line", kGenericActionType, kActionKeyType); + act = new Action(globalMap, "SKLI", _("Skip line"), kGenericActionType, kActionKeyType); act->addKeyEvent(KeyState(KEYCODE_PERIOD, '.', 0)); - act = new Action(globalMap, "VIRT", "Display keyboard", kVirtualKeyboardActionType); + act = new Action(globalMap, "VIRT", _("Display keyboard"), kVirtualKeyboardActionType); act->addKeyEvent(KeyState(KEYCODE_F7, ASCII_F7, 0)); - act = new Action(globalMap, "REMP", "Remap keys", kKeyRemapActionType); + act = new Action(globalMap, "REMP", _("Remap keys"), kKeyRemapActionType); act->addKeyEvent(KeyState(KEYCODE_F8, ASCII_F8, 0)); mapper->addGlobalKeymap(globalMap); @@ -319,6 +320,8 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { // Update the config file ConfMan.set("versioninfo", gScummVMVersion, Common::ConfigManager::kApplicationDomain); + // Enable translation + TransMan.setLanguage(ConfMan.get("gui_language").c_str()); // Load and setup the debuglevel and the debug flags. We do this at the // soonest possible moment to ensure debug output starts early on, if @@ -387,7 +390,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { // Did an error occur ? if (result != Common::kNoError) { // Shows an informative error dialog if starting the selected game failed. - GUI::displayErrorDialog(result, "Error running game:"); + GUI::displayErrorDialog(result, _("Error running game:")); } // Quit unless an error occurred, or Return to launcher was requested @@ -413,8 +416,8 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { } else { // A dialog would be nicer, but we don't have any // screen to draw on yet. - warning("Could not find any engine capable of running the selected game"); - GUI::displayErrorDialog("Could not find any engine capable of running the selected game"); + warning(_("Could not find any engine capable of running the selected game")); + GUI::displayErrorDialog(_("Could not find any engine capable of running the selected game")); } // We will destroy the AudioCDManager singleton here to save some memory. -- cgit v1.2.3 From 82b66ffdf8439eff0043256bff9daf4f0c3d84ed Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 15 Jun 2010 12:34:55 +0000 Subject: Fix some warnings about 'format not a string literal'. svn-id: r49847 --- base/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'base') diff --git a/base/main.cpp b/base/main.cpp index ad6118c905..0360c89502 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -103,11 +103,11 @@ static const EnginePlugin *detectPlugin() { // Query the plugins and find one that will handle the specified gameid printf(_t("User picked target '%s' (gameid '%s')...\n"), ConfMan.getActiveDomainName().c_str(), gameid.c_str()); - printf(_t(" Looking for a plugin supporting this gameid... ")); + printf("%s", _t(" Looking for a plugin supporting this gameid... ")); GameDescriptor game = EngineMan.findGame(gameid, &plugin); if (plugin == 0) { - printf(_t("failed\n")); + printf("%s", _t("failed\n")); warning(_t("%s is an invalid gameid. Use the --list-games option to list supported gameid"), gameid.c_str()); return 0; } else { @@ -416,7 +416,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { } else { // A dialog would be nicer, but we don't have any // screen to draw on yet. - warning(_("Could not find any engine capable of running the selected game")); + warning("%s", _("Could not find any engine capable of running the selected game")); GUI::displayErrorDialog(_("Could not find any engine capable of running the selected game")); } -- cgit v1.2.3 From bbad3f333a9227ccb1de633a0fe92d9e01ad7bb3 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 21 Jun 2010 21:36:36 +0000 Subject: Patch #1956501: "GUI/LAUNCHER: Midi device selection" svn-id: r50128 --- base/commandLine.cpp | 2 +- base/plugins.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'base') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 1c548d3f50..8b0decf695 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -364,7 +364,7 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha END_OPTION DO_OPTION('e', "music-driver") - if (MidiDriver::findMusicDriver(option) == 0) + if (MidiDriver::getMusicType(MidiDriver::getDeviceHandle(option)) == MT_NULL) usage("Unrecognized music driver '%s'", option); END_OPTION diff --git a/base/plugins.cpp b/base/plugins.cpp index 6c80da65d4..199344087c 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -167,6 +167,7 @@ public: // Music plugins // TODO: Use defines to disable or enable each MIDI driver as a // static/dynamic plugin, like it's done for the engines + LINK_PLUGIN(AUTO) LINK_PLUGIN(NULL) #if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) LINK_PLUGIN(WINDOWS) -- cgit v1.2.3 From 46ec88f74d9b7596cee2e6a167b1ccf361771601 Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Tue, 22 Jun 2010 15:30:41 +0000 Subject: GUI/LAUNCHER: This should fix the regression concerning pc speaker / pcjr support caused by patch #1956501 svn-id: r50145 --- base/plugins.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'base') diff --git a/base/plugins.cpp b/base/plugins.cpp index 199344087c..39ee10c2cb 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -205,6 +205,8 @@ public: LINK_PLUGIN(MT32) #endif LINK_PLUGIN(ADLIB) + LINK_PLUGIN(PCSPK) + LINK_PLUGIN(PCJR) LINK_PLUGIN(TOWNS) #if defined (UNIX) LINK_PLUGIN(TIMIDITY) -- cgit v1.2.3 From 78fb62bcdf8c54a4c6024aa160641f6a196ebcf4 Mon Sep 17 00:00:00 2001 From: Florian Kagerer Date: Tue, 22 Jun 2010 18:27:00 +0000 Subject: LAUNCHER: hopefully fixed music driver selection via command line svn-id: r50158 --- base/commandLine.cpp | 4 ---- base/main.cpp | 11 +++++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'base') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 8b0decf695..ee35bcf4c3 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -32,8 +32,6 @@ #include "common/system.h" #include "common/fs.h" -#include "sound/mididrv.h" - #include "gui/ThemeEngine.h" #define DETECTOR_TESTING_HACK @@ -364,8 +362,6 @@ Common::String parseCommandLine(Common::StringMap &settings, int argc, const cha END_OPTION DO_OPTION('e', "music-driver") - if (MidiDriver::getMusicType(MidiDriver::getDeviceHandle(option)) == MT_NULL) - usage("Unrecognized music driver '%s'", option); END_OPTION DO_LONG_OPTION_INT("output-rate") diff --git a/base/main.cpp b/base/main.cpp index 0360c89502..1e3edb1534 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -54,6 +54,7 @@ #include "gui/error.h" #include "sound/audiocd.h" +#include "sound/mididrv.h" #include "backends/keymapper/keymapper.h" @@ -341,6 +342,16 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { // Load the plugins. PluginManager::instance().loadPlugins(); + // If we received an invalid music parameter via command line we check this here. + // We can't check this before loading the music plugins. + // On the other hand we cannot load the plugins before we know the file paths (in case of external plugins). + if (!settings["music-driver"].empty()) { + if (MidiDriver::getMusicType(MidiDriver::getDeviceHandle(settings["music-driver"])) == MT_NULL) { + warning("Unrecognized music driver '%s'\nSwitching to default device.", settings["music-driver"].c_str()); + settings["music-driver"] = "auto"; + } + } + // Process the remaining command line settings. Must be done after the // config file and the plugins have been loaded. Common::Error res; -- cgit v1.2.3 From d783ca972abee9702e6abf31f13188fc59d7d32d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 24 Jun 2010 22:33:49 +0000 Subject: Disable addition of "SCUMMVM_SVN_REVISION" to the version string, in case --enable-release was specified on configure run. svn-id: r50246 --- base/internal_version.h | 4 ++++ base/internal_version.h.in | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'base') diff --git a/base/internal_version.h b/base/internal_version.h index bdd0474c2b..533348ace4 100644 --- a/base/internal_version.h +++ b/base/internal_version.h @@ -2,4 +2,8 @@ #define SCUMMVM_SVN_REVISION #endif +#ifdef RELEASE_BUILD +#undef SCUMMVM_SVN_REVISION +#endif + #define SCUMMVM_VERSION "1.2.0svn" SCUMMVM_SVN_REVISION diff --git a/base/internal_version.h.in b/base/internal_version.h.in index 1b7e5ed147..0199b67d5c 100644 --- a/base/internal_version.h.in +++ b/base/internal_version.h.in @@ -2,4 +2,8 @@ #define SCUMMVM_SVN_REVISION #endif +#ifdef RELEASE_BUILD +#undef SCUMMVM_SVN_REVISION +#endif + #define SCUMMVM_VERSION "@VERSION@" SCUMMVM_SVN_REVISION -- cgit v1.2.3 From ff33acb132c3d7f15060e528c7ac4bf34321807e Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Thu, 24 Jun 2010 22:55:24 +0000 Subject: Fix build with --enable-release. svn-id: r50249 --- base/internal_version.h | 1 + base/internal_version.h.in | 1 + 2 files changed, 2 insertions(+) (limited to 'base') diff --git a/base/internal_version.h b/base/internal_version.h index 533348ace4..2e6b7a24ad 100644 --- a/base/internal_version.h +++ b/base/internal_version.h @@ -4,6 +4,7 @@ #ifdef RELEASE_BUILD #undef SCUMMVM_SVN_REVISION +#define SCUMMVM_SVN_REVISION #endif #define SCUMMVM_VERSION "1.2.0svn" SCUMMVM_SVN_REVISION diff --git a/base/internal_version.h.in b/base/internal_version.h.in index 0199b67d5c..4eecf90d87 100644 --- a/base/internal_version.h.in +++ b/base/internal_version.h.in @@ -4,6 +4,7 @@ #ifdef RELEASE_BUILD #undef SCUMMVM_SVN_REVISION +#define SCUMMVM_SVN_REVISION #endif #define SCUMMVM_VERSION "@VERSION@" SCUMMVM_SVN_REVISION -- cgit v1.2.3 From 58fcda82f33e3ba8f813eeac412612ae09a34c9f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 26 Jun 2010 18:07:41 +0000 Subject: Remove support for translation of console messages. In recent discussions on -devel it turned out, that this feature is rather superfluous and instead we should rather implement a proper error reporting in our GUI. I also removed the dependency on iconv along with this. svn-id: r50335 --- base/main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'base') diff --git a/base/main.cpp b/base/main.cpp index 1e3edb1534..7ea5344ba2 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -103,20 +103,20 @@ static const EnginePlugin *detectPlugin() { ConfMan.set("gameid", gameid); // Query the plugins and find one that will handle the specified gameid - printf(_t("User picked target '%s' (gameid '%s')...\n"), ConfMan.getActiveDomainName().c_str(), gameid.c_str()); - printf("%s", _t(" Looking for a plugin supporting this gameid... ")); + printf("User picked target '%s' (gameid '%s')...\n", ConfMan.getActiveDomainName().c_str(), gameid.c_str()); + printf("%s", " Looking for a plugin supporting this gameid... "); GameDescriptor game = EngineMan.findGame(gameid, &plugin); if (plugin == 0) { - printf("%s", _t("failed\n")); - warning(_t("%s is an invalid gameid. Use the --list-games option to list supported gameid"), gameid.c_str()); + printf("failed\n"); + warning("%s is an invalid gameid. Use the --list-games option to list supported gameid", gameid.c_str()); return 0; } else { printf("%s\n", plugin->getName()); } // FIXME: Do we really need this one? - printf(_t(" Starting '%s'\n"), game.description().c_str()); + printf(" Starting '%s'\n", game.description().c_str()); return plugin; } @@ -145,7 +145,7 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const //GUI::displayErrorDialog("ScummVM could not find any game in the specified directory!"); const char *errMsg = _(Common::errorToString(err)); - warning(_t("%s failed to instantiate engine: %s (target '%s', path '%s')"), + warning("%s failed to instantiate engine: %s (target '%s', path '%s')", plugin->getName(), errMsg, ConfMan.getActiveDomainName().c_str(), -- cgit v1.2.3 From 876b6a50060bee23b4b05205a729014a8e5455b1 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 28 Jun 2010 23:59:43 +0000 Subject: Prevent "music-driver" to be set to "" on startup. This is a regression from r50158: "LAUNCHER: hopefully fixed music driver selection via command line". The problem here was that the code used operator[] of HashMap to check whether "music-driver" was specified on command line, but that on the other hand inserted a (key, value) pair with a default constructed Common::String as value. svn-id: r50469 --- base/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'base') diff --git a/base/main.cpp b/base/main.cpp index 7ea5344ba2..a668c453d4 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -345,7 +345,7 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { // If we received an invalid music parameter via command line we check this here. // We can't check this before loading the music plugins. // On the other hand we cannot load the plugins before we know the file paths (in case of external plugins). - if (!settings["music-driver"].empty()) { + if (settings.contains("music-driver")) { if (MidiDriver::getMusicType(MidiDriver::getDeviceHandle(settings["music-driver"])) == MT_NULL) { warning("Unrecognized music driver '%s'\nSwitching to default device.", settings["music-driver"].c_str()); settings["music-driver"] = "auto"; -- cgit v1.2.3 From 5c424cfb41d439db5a0b3c00b7081473aa384ca6 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 29 Jun 2010 00:29:35 +0000 Subject: Fix detection of invalid music drivers specified via command line. Along with it documented that "0" is a special device handle for the invalid device. Now getDeviceHandle returns 0, when the identified device could not be found. Also getMusicType now returns MT_INVALID (newly introduced), when a non existing device was specified. svn-id: r50470 --- base/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'base') diff --git a/base/main.cpp b/base/main.cpp index a668c453d4..d40c912bf8 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -346,9 +346,9 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) { // We can't check this before loading the music plugins. // On the other hand we cannot load the plugins before we know the file paths (in case of external plugins). if (settings.contains("music-driver")) { - if (MidiDriver::getMusicType(MidiDriver::getDeviceHandle(settings["music-driver"])) == MT_NULL) { - warning("Unrecognized music driver '%s'\nSwitching to default device.", settings["music-driver"].c_str()); - settings["music-driver"] = "auto"; + if (MidiDriver::getMusicType(MidiDriver::getDeviceHandle(settings["music-driver"])) == MT_INVALID) { + warning("Unrecognized music driver '%s'. Switching to default device.", settings["music-driver"].c_str()); + settings["music-driver"] = "auto"; } } -- cgit v1.2.3 From bb300ec671cfcd6fe7461dfd90615acfede2f1b9 Mon Sep 17 00:00:00 2001 From: Angus Lees Date: Mon, 5 Jul 2010 00:09:41 +0000 Subject: Skip /dev/sequencer MIDI on Android. svn-id: r50664 --- base/plugins.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'base') diff --git a/base/plugins.cpp b/base/plugins.cpp index 39ee10c2cb..a6acd7e449 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -175,7 +175,7 @@ public: #if defined(UNIX) && defined(USE_ALSA) LINK_PLUGIN(ALSA) #endif - #if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__) && !defined(__MINT__) + #if defined(UNIX) && !defined(__BEOS__) && !defined(__MAEMO__) && !defined(__MINT__) && !defined(__ANDROID__) LINK_PLUGIN(SEQ) #endif #if defined(__MINT__) -- cgit v1.2.3 From d4bc0f9f10c597cd57de1c1f275cb227dd83eb0c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 5 Jul 2010 19:45:48 +0000 Subject: Replace a tab by whitespaces in the help string. svn-id: r50704 --- base/commandLine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'base') diff --git a/base/commandLine.cpp b/base/commandLine.cpp index ee35bcf4c3..e795b82d0a 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -59,7 +59,7 @@ static const char HELP_STRING[] = " -h, --help Display a brief help text and exit\n" " -z, --list-games Display list of supported games and exit\n" " -t, --list-targets Display list of configured targets and exit\n" - " --list-saves=TARGET Display a list of savegames for the game (TARGET) specified\n" + " --list-saves=TARGET Display a list of savegames for the game (TARGET) specified\n" "\n" " -c, --config=CONFIG Use alternate configuration file\n" " -p, --path=PATH Path to where the game is installed\n" -- cgit v1.2.3