aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorEugene Sandulenko2010-06-15 10:44:51 +0000
committerEugene Sandulenko2010-06-15 10:44:51 +0000
commit859212df2523e8b15076d968018dbf98618fd60f (patch)
treee3f7ff62c58c9ac8a762791c0a1801b75fe1f14a /gui
parentdb6673c408865b201808e01ab5db796f2e794058 (diff)
downloadscummvm-rg350-859212df2523e8b15076d968018dbf98618fd60f.tar.gz
scummvm-rg350-859212df2523e8b15076d968018dbf98618fd60f.tar.bz2
scummvm-rg350-859212df2523e8b15076d968018dbf98618fd60f.zip
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
Diffstat (limited to 'gui')
-rw-r--r--gui/GuiManager.cpp18
-rw-r--r--gui/GuiManager.h2
-rw-r--r--gui/KeysDialog.cpp26
-rw-r--r--gui/ThemeEngine.cpp7
-rw-r--r--gui/about.cpp7
-rw-r--r--gui/browser.cpp8
-rw-r--r--gui/error.cpp4
-rw-r--r--gui/launcher.cpp115
-rw-r--r--gui/massadd.cpp17
-rw-r--r--gui/options.cpp195
-rw-r--r--gui/options.h2
-rw-r--r--gui/saveload.cpp31
-rw-r--r--gui/themebrowser.cpp8
-rw-r--r--gui/themes/scummclassic.zipbin52242 -> 52484 bytes
-rw-r--r--gui/themes/scummclassic/classic_layout.stx8
-rw-r--r--gui/themes/scummmodern.zipbin158233 -> 158475 bytes
-rw-r--r--gui/themes/scummmodern/scummmodern_layout.stx8
17 files changed, 266 insertions, 190 deletions
diff --git a/gui/GuiManager.cpp b/gui/GuiManager.cpp
index 99fb3be4dc..9f04c382cb 100644
--- a/gui/GuiManager.cpp
+++ b/gui/GuiManager.cpp
@@ -27,6 +27,7 @@
#include "common/util.h"
#include "common/config-manager.h"
#include "common/algorithm.h"
+#include "common/translation.h"
#include "backends/keymapper/keymapper.h"
@@ -71,7 +72,7 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled),
// Loading the theme failed, try to load the built-in theme
if (!loadNewTheme("builtin", gfxMode)) {
// Loading the built-in theme failed as well. Bail out
- error("Failed to load any GUI theme, aborting");
+ error(_t("Failed to load any GUI theme, aborting"));
}
}
}
@@ -94,27 +95,28 @@ void GuiManager::initKeymap() {
Action *act;
Keymap *guiMap = new Keymap("gui");
- act = new Action(guiMap, "CLOS", "Close", kGenericActionType, kStartKeyType);
+ act = new Action(guiMap, "CLOS", _("Close"), kGenericActionType, kStartKeyType);
act->addKeyEvent(KeyState(KEYCODE_ESCAPE, ASCII_ESCAPE, 0));
- act = new Action(guiMap, "CLIK", "Mouse click");
+ act = new Action(guiMap, "CLIK", _("Mouse click"));
act->addLeftClickEvent();
- act = new Action(guiMap, "VIRT", "Display keyboard", kVirtualKeyboardActionType);
+ act = new Action(guiMap, "VIRT", _("Display keyboard"), kVirtualKeyboardActionType);
act->addKeyEvent(KeyState(KEYCODE_F7, ASCII_F7, 0));
- act = new Action(guiMap, "REMP", "Remap keys", kKeyRemapActionType);
+ act = new Action(guiMap, "REMP", _("Remap keys"), kKeyRemapActionType);
act->addKeyEvent(KeyState(KEYCODE_F8, ASCII_F8, 0));
mapper->addGlobalKeymap(guiMap);
}
#endif
-bool GuiManager::loadNewTheme(Common::String id, ThemeEngine::GraphicsMode gfx) {
+bool GuiManager::loadNewTheme(Common::String id, ThemeEngine::GraphicsMode gfx, bool forced) {
// If we are asked to reload the currently active theme, just do nothing
// FIXME: Actually, why? It might be desirable at times to force a theme reload...
- if (_theme && id == _theme->getThemeId() && gfx == _theme->getGraphicsMode())
- return true;
+ if (!forced)
+ if (_theme && id == _theme->getThemeId() && gfx == _theme->getGraphicsMode())
+ return true;
ThemeEngine *newTheme = 0;
diff --git a/gui/GuiManager.h b/gui/GuiManager.h
index 892d1aa3ac..3187a0ba73 100644
--- a/gui/GuiManager.h
+++ b/gui/GuiManager.h
@@ -71,7 +71,7 @@ public:
bool isActive() const { return ! _dialogStack.empty(); }
- bool loadNewTheme(Common::String id, ThemeEngine::GraphicsMode gfx = ThemeEngine::kGfxDisabled);
+ bool loadNewTheme(Common::String id, ThemeEngine::GraphicsMode gfx = ThemeEngine::kGfxDisabled, bool force = false);
ThemeEngine *theme() { return _theme; }
ThemeEval *xmlEval() { return _theme->getEvaluator(); }
diff --git a/gui/KeysDialog.cpp b/gui/KeysDialog.cpp
index b80dd200bb..65b14f9078 100644
--- a/gui/KeysDialog.cpp
+++ b/gui/KeysDialog.cpp
@@ -40,15 +40,15 @@ enum {
KeysDialog::KeysDialog(const Common::String &title)
: GUI::Dialog("KeysDialog") {
- new ButtonWidget(this, "KeysDialog.Map", "Map", kMapCmd, 0);
- new ButtonWidget(this, "KeysDialog.Ok", "OK", kOKCmd, 0);
- new ButtonWidget(this, "KeysDialog.Cancel", "Cancel", kCloseCmd, 0);
+ new ButtonWidget(this, "KeysDialog.Map", _("Map"), kMapCmd, 0);
+ new ButtonWidget(this, "KeysDialog.Ok", _("OK"), kOKCmd, 0);
+ new ButtonWidget(this, "KeysDialog.Cancel", _("Cancel"), kCloseCmd, 0);
_actionsList = new ListWidget(this, "KeysDialog.List");
_actionsList->setNumberingMode(kListNumberingZero);
_actionTitle = new StaticTextWidget(this, "KeysDialog.Action", title);
- _keyMapping = new StaticTextWidget(this, "KeysDialog.Mapping", "Select an action and click 'Map'");
+ _keyMapping = new StaticTextWidget(this, "KeysDialog.Mapping", _("Select an action and click 'Map'"));
_actionTitle->setFlags(WIDGET_CLEARBG);
_keyMapping->setFlags(WIDGET_CLEARBG);
@@ -79,9 +79,9 @@ void KeysDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
key = key - Common::ASCII_F1 + SDLK_F1;
#endif
if (key != 0)
- sprintf(selection, "Associated key : %s", SDL_GetKeyName((SDLKey)key));
+ sprintf(selection, _("Associated key : %s"), SDL_GetKeyName((SDLKey)key));
else
- sprintf(selection, "Associated key : none");
+ sprintf(selection, _("Associated key : none"));
_keyMapping->setLabel(selection);
_keyMapping->draw();
@@ -89,7 +89,7 @@ void KeysDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
break;
case kMapCmd:
if (_actionsList->getSelected() < 0) {
- _actionTitle->setLabel("Please select an action");
+ _actionTitle->setLabel(_("Please select an action"));
} else {
char selection[100];
@@ -101,11 +101,11 @@ void KeysDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
key = key - Common::ASCII_F1 + SDLK_F1;
#endif
if (key != 0)
- sprintf(selection, "Associated key : %s", SDL_GetKeyName((SDLKey)key));
+ sprintf(selection, _("Associated key : %s"), SDL_GetKeyName((SDLKey)key));
else
- sprintf(selection, "Associated key : none");
+ sprintf(selection, _("Associated key : none"));
- _actionTitle->setLabel("Press the key to associate");
+ _actionTitle->setLabel(_("Press the key to associate"));
_keyMapping->setLabel(selection);
_keyMapping->draw();
Actions::Instance()->beginMapping(true);
@@ -140,11 +140,11 @@ void KeysDialog::handleKeyUp(Common::KeyState state) {
Actions::Instance()->setMapping((ActionType)_actionSelected, state.ascii);
if (state.ascii != 0)
- sprintf(selection, "Associated key : %s", SDL_GetKeyName((SDLKey) state.keycode));
+ sprintf(selection, _("Associated key : %s"), SDL_GetKeyName((SDLKey) state.keycode));
else
- sprintf(selection, "Associated key : none");
+ sprintf(selection, _("Associated key : none"));
- _actionTitle->setLabel("Choose an action to map");
+ _actionTitle->setLabel(_("Choose an action to map"));
_keyMapping->setLabel(selection);
_keyMapping->draw();
_actionTitle->draw();
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index b472ad0535..03e21153a5 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -30,6 +30,7 @@
#include "common/fs.h"
#include "common/unzip.h"
#include "common/tokenizer.h"
+#include "common/translation.h"
#include "graphics/colormasks.h"
#include "graphics/cursorman.h"
@@ -329,10 +330,10 @@ ThemeEngine::~ThemeEngine() {
* Rendering mode management
*********************************************************/
const ThemeEngine::Renderer ThemeEngine::_rendererModes[] = {
- { "Disabled GFX", "none", kGfxDisabled },
- { "Standard Renderer (16bpp)", "normal_16bpp", kGfxStandard16bit },
+ { _s("Disabled GFX"), "none", kGfxDisabled },
+ { _s("Standard Renderer (16bpp)"), "normal_16bpp", kGfxStandard16bit },
#ifndef DISABLE_FANCY_THEMES
- { "Antialiased Renderer (16bpp)", "aa_16bpp", kGfxAntialias16bit }
+ { _s("Antialiased Renderer (16bpp)"), "aa_16bpp", kGfxAntialias16bit }
#endif
};
diff --git a/gui/about.cpp b/gui/about.cpp
index 8b2f470bf6..a999674751 100644
--- a/gui/about.cpp
+++ b/gui/about.cpp
@@ -27,6 +27,7 @@
#include "base/version.h"
#include "common/events.h"
#include "common/system.h"
+#include "common/translation.h"
#include "common/util.h"
#include "gui/about.h"
#include "gui/GuiManager.h"
@@ -92,7 +93,7 @@ AboutDialog::AboutDialog()
version += gScummVMVersion;
_lines.push_back(version);
- Common::String date("C2""(built on ");
+ Common::String date(_s("C2""(built on "));
date += gScummVMBuildDate;
date += ')';
_lines.push_back(date);
@@ -100,14 +101,14 @@ AboutDialog::AboutDialog()
for (i = 0; i < ARRAYSIZE(copyright_text); i++)
addLine(copyright_text[i]);
- addLine("C1""Features compiled in:");
+ addLine(_s("C1""Features compiled in:"));
Common::String features("C0");
features += gScummVMFeatures;
addLine(features.c_str());
_lines.push_back("");
- addLine("C1""Available engines:");
+ addLine(_s("C1""Available engines:"));
const EnginePlugin::List &plugins = EngineMan.getPlugins();
EnginePlugin::List::const_iterator iter = plugins.begin();
for (; iter != plugins.end(); ++iter) {
diff --git a/gui/browser.cpp b/gui/browser.cpp
index c090742988..86fadf667e 100644
--- a/gui/browser.cpp
+++ b/gui/browser.cpp
@@ -30,6 +30,8 @@
#include "common/system.h"
#include "common/algorithm.h"
+#include "common/translation.h"
+
namespace GUI {
enum {
@@ -64,9 +66,9 @@ BrowserDialog::BrowserDialog(const char *title, bool dirBrowser)
_backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain;
// Buttons
- new ButtonWidget(this, "Browser.Up", "Go up", kGoUpCmd, 0);
- new ButtonWidget(this, "Browser.Cancel", "Cancel", kCloseCmd, 0);
- new ButtonWidget(this, "Browser.Choose", "Choose", kChooseCmd, 0);
+ new ButtonWidget(this, "Browser.Up", _("Go up"), kGoUpCmd, 0);
+ new ButtonWidget(this, "Browser.Cancel", _("Cancel"), kCloseCmd, 0);
+ new ButtonWidget(this, "Browser.Choose", _("Choose"), kChooseCmd, 0);
}
void BrowserDialog::open() {
diff --git a/gui/error.cpp b/gui/error.cpp
index fbe09c5a02..3332eb533a 100644
--- a/gui/error.cpp
+++ b/gui/error.cpp
@@ -27,6 +27,8 @@
#include "gui/message.h"
#include "gui/error.h"
+#include "common/translation.h"
+
namespace GUI {
void displayErrorDialog(const char *text) {
@@ -37,7 +39,7 @@ void displayErrorDialog(const char *text) {
void displayErrorDialog(Common::Error error, const char *extraText) {
Common::String errorText(extraText);
errorText += " ";
- errorText += Common::errorToString(error);
+ errorText += _(Common::errorToString(error));
GUI::MessageDialog alert(errorText);
alert.runModal();
}
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 0f484c5233..3634ef7e3d 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -30,6 +30,7 @@
#include "common/util.h"
#include "common/savefile.h"
#include "common/system.h"
+#include "common/translation.h"
#include "gui/about.h"
#include "gui/browser.h"
@@ -166,20 +167,20 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
//
// 1) The game tab
//
- tab->addTab("Game");
+ tab->addTab(_("Game"));
// GUI: Label & edit widget for the game ID
- new StaticTextWidget(tab, "GameOptions_Game.Id", "ID:");
+ new StaticTextWidget(tab, "GameOptions_Game.Id", _("ID:"));
_domainWidget = new DomainEditTextWidget(tab, "GameOptions_Game.Domain", _domain);
// GUI: Label & edit widget for the description
- new StaticTextWidget(tab, "GameOptions_Game.Name", "Name:");
+ new StaticTextWidget(tab, "GameOptions_Game.Name", _("Name:"));
_descriptionWidget = new EditTextWidget(tab, "GameOptions_Game.Desc", description);
// Language popup
- _langPopUpDesc = new StaticTextWidget(tab, "GameOptions_Game.LangPopupDesc", "Language:");
+ _langPopUpDesc = new StaticTextWidget(tab, "GameOptions_Game.LangPopupDesc", _("Language:"));
_langPopUp = new PopUpWidget(tab, "GameOptions_Game.LangPopup");
- _langPopUp->appendEntry("<default>");
+ _langPopUp->appendEntry(_("<default>"));
_langPopUp->appendEntry("");
const Common::LanguageDescription *l = Common::g_languages;
for (; l->code; ++l) {
@@ -187,9 +188,9 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
}
// Platform popup
- _platformPopUpDesc = new StaticTextWidget(tab, "GameOptions_Game.PlatformPopupDesc", "Platform:");
+ _platformPopUpDesc = new StaticTextWidget(tab, "GameOptions_Game.PlatformPopupDesc", _("Platform:"));
_platformPopUp = new PopUpWidget(tab, "GameOptions_Game.PlatformPopup");
- _platformPopUp->appendEntry("<default>");
+ _platformPopUp->appendEntry(_("<default>"));
_platformPopUp->appendEntry("");
const Common::PlatformDescription *p = Common::g_platforms;
for (; p->code; ++p) {
@@ -199,18 +200,18 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
//
// 3) The graphics tab
//
- _graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? "Graphics" : "GFX");
+ _graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"));
- _globalGraphicsOverride = new CheckboxWidget(tab, "GameOptions_Graphics.EnableTabCheckbox", "Override global graphic settings", kCmdGlobalGraphicsOverride, 0);
+ _globalGraphicsOverride = new CheckboxWidget(tab, "GameOptions_Graphics.EnableTabCheckbox", _("Override global graphic settings"), kCmdGlobalGraphicsOverride, 0);
addGraphicControls(tab, "GameOptions_Graphics.");
//
// 4) The audio tab
//
- tab->addTab("Audio");
+ tab->addTab(_("Audio"));
- _globalAudioOverride = new CheckboxWidget(tab, "GameOptions_Audio.EnableTabCheckbox", "Override global audio settings", kCmdGlobalAudioOverride, 0);
+ _globalAudioOverride = new CheckboxWidget(tab, "GameOptions_Audio.EnableTabCheckbox", _("Override global audio settings"), kCmdGlobalAudioOverride, 0);
addAudioControls(tab, "GameOptions_Audio.");
addSubtitleControls(tab, "GameOptions_Audio.");
@@ -218,18 +219,18 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
//
// 5) The volume tab
//
- tab->addTab("Volume");
+ tab->addTab(_("Volume"));
- _globalVolumeOverride = new CheckboxWidget(tab, "GameOptions_Volume.EnableTabCheckbox", "Override global volume settings", kCmdGlobalVolumeOverride, 0);
+ _globalVolumeOverride = new CheckboxWidget(tab, "GameOptions_Volume.EnableTabCheckbox", _("Override global volume settings"), kCmdGlobalVolumeOverride, 0);
addVolumeControls(tab, "GameOptions_Volume.");
//
// 6) The MIDI tab
//
- tab->addTab("MIDI");
+ tab->addTab(_("MIDI"));
- _globalMIDIOverride = new CheckboxWidget(tab, "GameOptions_MIDI.EnableTabCheckbox", "Override global MIDI settings", kCmdGlobalMIDIOverride, 0);
+ _globalMIDIOverride = new CheckboxWidget(tab, "GameOptions_MIDI.EnableTabCheckbox", _("Override global MIDI settings"), kCmdGlobalMIDIOverride, 0);
if (_guioptions & Common::GUIO_NOMIDI)
_globalMIDIOverride->setEnabled(false);
@@ -239,21 +240,21 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
//
// 2) The 'Path' tab
//
- tab->addTab("Paths");
+ tab->addTab(_("Paths"));
// These buttons have to be extra wide, or the text will be truncated
// in the small version of the GUI.
// GUI: Button + Label for the game path
- new ButtonWidget(tab, "GameOptions_Paths.Gamepath", "Game Path:", kCmdGameBrowser, 0);
+ new ButtonWidget(tab, "GameOptions_Paths.Gamepath", _("Game Path:"), kCmdGameBrowser, 0);
_gamePathWidget = new StaticTextWidget(tab, "GameOptions_Paths.GamepathText", gamePath);
// GUI: Button + Label for the additional path
- new ButtonWidget(tab, "GameOptions_Paths.Extrapath", "Extra Path:", kCmdExtraBrowser, 0);
+ new ButtonWidget(tab, "GameOptions_Paths.Extrapath", _("Extra Path:"), kCmdExtraBrowser, 0);
_extraPathWidget = new StaticTextWidget(tab, "GameOptions_Paths.ExtrapathText", extraPath);
// GUI: Button + Label for the save path
- new ButtonWidget(tab, "GameOptions_Paths.Savepath", "Save Path:", kCmdSaveBrowser, 0);
+ new ButtonWidget(tab, "GameOptions_Paths.Savepath", _("Save Path:"), kCmdSaveBrowser, 0);
_savePathWidget = new StaticTextWidget(tab, "GameOptions_Paths.SavepathText", savePath);
// Activate the first tab
@@ -261,8 +262,8 @@ EditGameDialog::EditGameDialog(const String &domain, const String &desc)
_tabWidget = tab;
// Add OK & Cancel buttons
- new ButtonWidget(this, "GameOptions.Cancel", "Cancel", kCloseCmd, 0);
- new ButtonWidget(this, "GameOptions.Ok", "OK", kOKCmd, 0);
+ new ButtonWidget(this, "GameOptions.Cancel", _("Cancel"), kCloseCmd, 0);
+ new ButtonWidget(this, "GameOptions.Ok", _("OK"), kOKCmd, 0);
}
void EditGameDialog::open() {
@@ -270,12 +271,12 @@ void EditGameDialog::open() {
String extraPath(ConfMan.get("extrapath", _domain));
if (extraPath.empty() || !ConfMan.hasKey("extrapath", _domain)) {
- _extraPathWidget->setLabel("None");
+ _extraPathWidget->setLabel(_("None"));
}
String savePath(ConfMan.get("savepath", _domain));
if (savePath.empty() || !ConfMan.hasKey("savepath", _domain)) {
- _savePathWidget->setLabel("Default");
+ _savePathWidget->setLabel(_("Default"));
}
int sel, i;
@@ -349,11 +350,11 @@ void EditGameDialog::close() {
ConfMan.set("path", gamePath, _domain);
String extraPath(_extraPathWidget->getLabel());
- if (!extraPath.empty() && (extraPath != "None"))
+ if (!extraPath.empty() && (extraPath != _("None")))
ConfMan.set("extrapath", extraPath, _domain);
String savePath(_savePathWidget->getLabel());
- if (!savePath.empty() && (savePath != "Default"))
+ if (!savePath.empty() && (savePath != _("Default")))
ConfMan.set("savepath", savePath, _domain);
Common::Platform platform = (Common::Platform)_platformPopUp->getSelectedTag();
@@ -387,14 +388,14 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
draw();
break;
case kCmdChooseSoundFontCmd: {
- BrowserDialog browser("Select SoundFont", false);
+ BrowserDialog browser(_("Select SoundFont"), false);
if (browser.runModal() > 0) {
// User made this choice...
Common::FSNode file(browser.getResult());
_soundFont->setLabel(file.getPath());
- if (!file.getPath().empty() && (file.getPath() != "None"))
+ if (!file.getPath().empty() && (file.getPath() != _("None")))
_soundFontClearButton->setEnabled(true);
else
_soundFontClearButton->setEnabled(false);
@@ -406,7 +407,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
// Change path for the game
case kCmdGameBrowser: {
- BrowserDialog browser("Select directory with game data", true);
+ BrowserDialog browser(_("Select directory with game data"), true);
if (browser.runModal() > 0) {
// User made his choice...
Common::FSNode dir(browser.getResult());
@@ -424,7 +425,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
// Change path for extra game data (eg, using sword cutscenes when playing via CD)
case kCmdExtraBrowser: {
- BrowserDialog browser("Select additional game directory", true);
+ BrowserDialog browser(_("Select additional game directory"), true);
if (browser.runModal() > 0) {
// User made his choice...
Common::FSNode dir(browser.getResult());
@@ -436,7 +437,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
}
// Change path for stored save game (perm and temp) data
case kCmdSaveBrowser: {
- BrowserDialog browser("Select directory for saved games", true);
+ BrowserDialog browser(_("Select directory for saved games"), true);
if (browser.runModal() > 0) {
// User made his choice...
Common::FSNode dir(browser.getResult());
@@ -455,7 +456,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat
|| newDomain.hasPrefix("_")
|| newDomain == ConfigManager::kApplicationDomain
|| ConfMan.hasGameDomain(newDomain)) {
- MessageDialog alert("This game ID is already taken. Please choose another one.");
+ MessageDialog alert(_("This game ID is already taken. Please choose another one."));
alert.runModal();
return;
}
@@ -496,22 +497,22 @@ LauncherDialog::LauncherDialog()
new StaticTextWidget(this, "Launcher.Version", gScummVMFullVersion);
#endif
- new ButtonWidget(this, "Launcher.QuitButton", "Quit", kQuitCmd, 'Q');
- new ButtonWidget(this, "Launcher.AboutButton", "About...", kAboutCmd, 'B');
- new ButtonWidget(this, "Launcher.OptionsButton", "Options...", kOptionsCmd, 'O');
+ new ButtonWidget(this, "Launcher.QuitButton", _("Quit"), kQuitCmd, 'Q');
+ new ButtonWidget(this, "Launcher.AboutButton", _("About..."), kAboutCmd, 'B');
+ new ButtonWidget(this, "Launcher.OptionsButton", _("Options..."), kOptionsCmd, 'O');
_startButton =
- new ButtonWidget(this, "Launcher.StartButton", "Start", kStartCmd, 'S');
+ new ButtonWidget(this, "Launcher.StartButton", _("Start"), kStartCmd, 'S');
_loadButton =
- new ButtonWidget(this, "Launcher.LoadGameButton", "Load...", kLoadGameCmd, 'L');
+ new ButtonWidget(this, "Launcher.LoadGameButton", _("Load..."), kLoadGameCmd, 'L');
// Above the lowest button rows: two more buttons (directly below the list box)
_addButton =
- new ButtonWidget(this, "Launcher.AddGameButton", "Add Game...", kAddGameCmd, 'A');
+ new ButtonWidget(this, "Launcher.AddGameButton", _("Add Game..."), kAddGameCmd, 'A');
_editButton =
- new ButtonWidget(this, "Launcher.EditGameButton", "Edit Game...", kEditGameCmd, 'E');
+ new ButtonWidget(this, "Launcher.EditGameButton", _("Edit Game..."), kEditGameCmd, 'E');
_removeButton =
- new ButtonWidget(this, "Launcher.RemoveGameButton", "Remove Game", kRemoveGameCmd, 'R');
+ new ButtonWidget(this, "Launcher.RemoveGameButton", _("Remove Game"), kRemoveGameCmd, 'R');
// Search box
_searchDesc = 0;
@@ -522,7 +523,7 @@ LauncherDialog::LauncherDialog()
_searchPic->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageSearch));
} else
#endif
- _searchDesc = new StaticTextWidget(this, "Launcher.SearchDesc", "Search:");
+ _searchDesc = new StaticTextWidget(this, "Launcher.SearchDesc", _("Search:"));
_searchWidget = new EditTextWidget(this, "Launcher.Search", _search, kSearchCmd);
_searchClearButton = new ButtonWidget(this, "Launcher.SearchClearButton", "C", kSearchClearCmd, 0);
@@ -544,10 +545,10 @@ LauncherDialog::LauncherDialog()
updateButtons();
// Create file browser dialog
- _browser = new BrowserDialog("Select directory with game data", true);
+ _browser = new BrowserDialog(_("Select directory with game data"), true);
// Create Load dialog
- _loadDialog = new SaveLoadChooser("Load game:", "Load");
+ _loadDialog = new SaveLoadChooser(_("Load game:"), _("Load"));
}
void LauncherDialog::selectTarget(const String &target) {
@@ -619,8 +620,12 @@ void LauncherDialog::updateListing() {
description = g.description();
}
- if (description.empty())
- description = "Unknown (target " + iter->_key + ", gameid " + gameid + ")";
+ if (description.empty()) {
+ char tmp[200];
+
+ snprintf(tmp, 200, "Unknown (target %s, gameid %s)", iter->_key.c_str(), gameid.c_str());
+ description = tmp;
+ }
if (!gameid.empty() && !description.empty()) {
// Insert the game into the launcher list
@@ -652,8 +657,8 @@ void LauncherDialog::addGame() {
const bool massAdd = (modifiers & Common::KBD_SHIFT) != 0;
if (massAdd) {
- MessageDialog alert("Do you really want to run the mass game detector? "
- "This could potentially add a huge number of games.", "Yes", "No");
+ MessageDialog alert(_("Do you really want to run the mass game detector? "
+ "This could potentially add a huge number of games."), _("Yes"), _("No"));
if (alert.runModal() == GUI::kMessageOK && _browser->runModal() > 0) {
MassAddDialog massAddDlg(_browser->getResult());
@@ -700,7 +705,7 @@ void LauncherDialog::addGame() {
Common::FSNode dir(_browser->getResult());
Common::FSList files;
if (!dir.getChildren(files, Common::FSNode::kListAll)) {
- MessageDialog alert("ScummVM couldn't open the specified directory!");
+ MessageDialog alert(_("ScummVM couldn't open the specified directory!"));
alert.runModal();
return;
}
@@ -712,7 +717,7 @@ void LauncherDialog::addGame() {
int idx;
if (candidates.empty()) {
// No game was found in the specified directory
- MessageDialog alert("ScummVM could not find any game in the specified directory!");
+ MessageDialog alert(_("ScummVM could not find any game in the specified directory!"));
alert.runModal();
idx = -1;
@@ -726,7 +731,7 @@ void LauncherDialog::addGame() {
for (idx = 0; idx < (int)candidates.size(); idx++)
list.push_back(candidates[idx].description());
- ChooserDialog dialog("Pick the game:");
+ ChooserDialog dialog(_("Pick the game:"));
dialog.setList(list);
idx = dialog.runModal();
}
@@ -802,7 +807,7 @@ Common::String addGameToConf(const GameDescriptor &result) {
}
void LauncherDialog::removeGame(int item) {
- MessageDialog alert("Do you really want to remove this game configuration?", "Yes", "No");
+ MessageDialog alert(_("Do you really want to remove this game configuration?"), _("Yes"), _("No"));
if (alert.runModal() == GUI::kMessageOK) {
// Remove the currently selected game from the list
@@ -865,11 +870,11 @@ void LauncherDialog::loadGame(int item) {
}
} else {
MessageDialog dialog
- ("This game does not support loading games from the launcher.", "OK");
+ (_("This game does not support loading games from the launcher."), _("OK"));
dialog.runModal();
}
} else {
- MessageDialog dialog("ScummVM could not find any engine capable of running the selected game!", "OK");
+ MessageDialog dialog(_("ScummVM could not find any engine capable of running the selected game!"), _("OK"));
dialog.runModal();
}
}
@@ -981,8 +986,8 @@ void LauncherDialog::updateButtons() {
int modifiers = g_system->getEventManager()->getModifierState();
const bool massAdd = (modifiers & Common::KBD_SHIFT) != 0;
const char *newAddButtonLabel = massAdd
- ? "Mass Add..."
- : "Add Game...";
+ ? _("Mass Add...")
+ : _("Add Game...");
if (_addButton->getLabel() != newAddButtonLabel)
_addButton->setLabel(newAddButtonLabel);
@@ -1029,7 +1034,7 @@ void LauncherDialog::reflowLayout() {
}
} else {
if (!_searchDesc)
- _searchDesc = new StaticTextWidget(this, "Launcher.SearchDesc", "Search:");
+ _searchDesc = new StaticTextWidget(this, "Launcher.SearchDesc", _("Search:"));
if (_searchPic) {
removeWidget(_searchPic);
diff --git a/gui/massadd.cpp b/gui/massadd.cpp
index 266226161a..36efdfdd59 100644
--- a/gui/massadd.cpp
+++ b/gui/massadd.cpp
@@ -27,6 +27,7 @@
#include "common/events.h"
#include "common/func.h"
#include "common/config-manager.h"
+#include "common/translation.h"
#include "gui/launcher.h" // For addGameToConf()
#include "gui/massadd.h"
@@ -75,10 +76,10 @@ MassAddDialog::MassAddDialog(const Common::FSNode &startDir)
// new StaticTextWidget(this, "massadddialog_caption", "Mass Add Dialog");
_dirProgressText = new StaticTextWidget(this, "MassAdd.DirProgressText",
- "... progress ...");
+ _("... progress ..."));
_gameProgressText = new StaticTextWidget(this, "MassAdd.GameProgressText",
- "... progress ...");
+ _("... progress ..."));
_dirProgressText->setAlign(Graphics::kTextAlignCenter);
_gameProgressText->setAlign(Graphics::kTextAlignCenter);
@@ -88,10 +89,10 @@ MassAddDialog::MassAddDialog(const Common::FSNode &startDir)
_list->setNumberingMode(kListNumberingOff);
_list->setList(l);
- _okButton = new ButtonWidget(this, "MassAdd.Ok", "OK", kOkCmd, Common::ASCII_RETURN);
+ _okButton = new ButtonWidget(this, "MassAdd.Ok", _("OK"), kOkCmd, Common::ASCII_RETURN);
_okButton->setEnabled(false);
- new ButtonWidget(this, "MassAdd.Cancel", "Cancel", kCancelCmd, Common::ASCII_ESCAPE);
+ new ButtonWidget(this, "MassAdd.Cancel", _("Cancel"), kCancelCmd, Common::ASCII_ESCAPE);
// Build a map from all configured game paths to the targets using them
const Common::ConfigManager::DomainMap &domains = ConfMan.getGameDomains();
@@ -240,17 +241,17 @@ void MassAddDialog::handleTickle() {
// Enable the OK button
_okButton->setEnabled(true);
- snprintf(buf, sizeof(buf), "Scan complete!");
+ snprintf(buf, sizeof(buf), _("Scan complete!"));
_dirProgressText->setLabel(buf);
- snprintf(buf, sizeof(buf), "Discovered %d new games.", _games.size());
+ snprintf(buf, sizeof(buf), _("Discovered %d new games."), _games.size());
_gameProgressText->setLabel(buf);
} else {
- snprintf(buf, sizeof(buf), "Scanned %d directories ...", _dirsScanned);
+ snprintf(buf, sizeof(buf), _("Scanned %d directories ..."), _dirsScanned);
_dirProgressText->setLabel(buf);
- snprintf(buf, sizeof(buf), "Discovered %d new games ...", _games.size());
+ snprintf(buf, sizeof(buf), _("Discovered %d new games ..."), _games.size());
_gameProgressText->setLabel(buf);
}
diff --git a/gui/options.cpp b/gui/options.cpp
index 212e90f9f0..9ea3c7a1e8 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -35,6 +35,7 @@
#include "common/fs.h"
#include "common/config-manager.h"
#include "common/system.h"
+#include "common/translation.h"
#include "graphics/scaler.h"
@@ -67,9 +68,9 @@ enum {
};
#endif
-static const char *savePeriodLabels[] = { "Never", "every 5 mins", "every 10 mins", "every 15 mins", "every 30 mins", 0 };
+static const char *savePeriodLabels[] = { _s("Never"), _s("every 5 mins"), _s("every 10 mins"), _s("every 15 mins"), _s("every 30 mins"), 0 };
static const int savePeriodValues[] = { 0, 5 * 60, 10 * 60, 15 * 60, 30 * 60, -1 };
-static const char *outputRateLabels[] = { "<default>", "8 kHz", "11kHz", "22 kHz", "44 kHz", "48 kHz", 0 };
+static const char *outputRateLabels[] = { _s("<default>"), _s("8 kHz"), _s("11kHz"), _s("22 kHz"), _s("44 kHz"), _s("48 kHz"), 0 };
static const int outputRateValues[] = { 0, 8000, 11025, 22050, 44100, 48000, -1 };
@@ -85,15 +86,15 @@ OptionsDialog::OptionsDialog(const Common::String &domain, const Common::String
}
const char *OptionsDialog::_subModeDesc[] = {
- "Speech Only",
- "Speech and Subtitles",
- "Subtitles Only"
+ _s("Speech Only"),
+ _s("Speech and Subtitles"),
+ _s("Subtitles Only")
};
const char *OptionsDialog::_lowresSubModeDesc[] = {
- "Speech Only",
- "Speech & Subs",
- "Subtitles Only"
+ _s("Speech Only"),
+ _s("Speech & Subs"),
+ _s("Subtitles Only")
};
void OptionsDialog::init() {
@@ -222,7 +223,7 @@ void OptionsDialog::open() {
Common::String soundFont(ConfMan.get("soundfont", _domain));
if (soundFont.empty() || !ConfMan.hasKey("soundfont", _domain)) {
- _soundFont->setLabel("None");
+ _soundFont->setLabel(_("None"));
_soundFontClearButton->setEnabled(false);
} else {
_soundFont->setLabel(soundFont);
@@ -267,7 +268,7 @@ void OptionsDialog::open() {
int speed; int sliderMaxValue = _subSpeedSlider->getMaxValue();
_subMode = getSubtitleMode(ConfMan.getBool("subtitles", _domain), ConfMan.getBool("speech_mute", _domain));
- _subToggleButton->setLabel(_subModeDesc[_subMode]);
+ _subToggleButton->setLabel(_(_subModeDesc[_subMode]));
// Engines that reuse the subtitle speed widget set their own max value.
// Scale the config value accordingly (see addSubtitleControls)
@@ -378,7 +379,7 @@ void OptionsDialog::close() {
ConfMan.setInt("midi_gain", _midiGainSlider->getValue(), _domain);
Common::String soundFont(_soundFont->getLabel());
- if (!soundFont.empty() && (soundFont != "None"))
+ if (!soundFont.empty() && (soundFont != _("None")))
ConfMan.set("soundfont", soundFont, _domain);
else
ConfMan.removeKey("soundfont", _domain);
@@ -465,7 +466,7 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
else
_subMode = 0;
- _subToggleButton->setLabel(g_system->getOverlayWidth() > 320 ? _subModeDesc[_subMode] : _lowresSubModeDesc[_subMode]);
+ _subToggleButton->setLabel(g_system->getOverlayWidth() > 320 ? _(_subModeDesc[_subMode]) : _(_lowresSubModeDesc[_subMode]));
_subToggleButton->draw();
_subSpeedDesc->draw();
_subSpeedSlider->draw();
@@ -476,7 +477,7 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data
_subSpeedLabel->draw();
break;
case kClearSoundFontCmd:
- _soundFont->setLabel("None");
+ _soundFont->setLabel(_("None"));
_soundFontClearButton->setEnabled(false);
draw();
break;
@@ -522,7 +523,7 @@ void OptionsDialog::setMIDISettingsState(bool enabled) {
_soundFontButton->setEnabled(enabled);
_soundFont->setEnabled(enabled);
- if (enabled && !_soundFont->getLabel().empty() && (_soundFont->getLabel() != "None"))
+ if (enabled && !_soundFont->getLabel().empty() && (_soundFont->getLabel() != _("None")))
_soundFontClearButton->setEnabled(enabled);
else
_soundFontClearButton->setEnabled(false);
@@ -591,64 +592,64 @@ void OptionsDialog::addGraphicControls(GuiObject *boss, const Common::String &pr
const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
// The GFX mode popup
- _gfxPopUpDesc = new StaticTextWidget(boss, prefix + "grModePopupDesc", "Graphics mode:");
+ _gfxPopUpDesc = new StaticTextWidget(boss, prefix + "grModePopupDesc", _("Graphics mode:"));
_gfxPopUp = new PopUpWidget(boss, prefix + "grModePopup");
- _gfxPopUp->appendEntry("<default>");
+ _gfxPopUp->appendEntry(_("<default>"));
_gfxPopUp->appendEntry("");
while (gm->name) {
- _gfxPopUp->appendEntry(gm->description, gm->id);
+ _gfxPopUp->appendEntry(_(gm->description), gm->id);
gm++;
}
// RenderMode popup
- _renderModePopUpDesc = new StaticTextWidget(boss, prefix + "grRenderPopupDesc", "Render mode:");
+ _renderModePopUpDesc = new StaticTextWidget(boss, prefix + "grRenderPopupDesc", _("Render mode:"));
_renderModePopUp = new PopUpWidget(boss, prefix + "grRenderPopup");
- _renderModePopUp->appendEntry("<default>", Common::kRenderDefault);
+ _renderModePopUp->appendEntry(_("<default>"), Common::kRenderDefault);
_renderModePopUp->appendEntry("");
const Common::RenderModeDescription *rm = Common::g_renderModes;
for (; rm->code; ++rm) {
- _renderModePopUp->appendEntry(rm->description, rm->id);
+ _renderModePopUp->appendEntry(_(rm->description), rm->id);
}
// Fullscreen checkbox
- _fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", "Fullscreen mode", 0, 0);
+ _fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", _("Fullscreen mode"), 0, 0);
// Aspect ratio checkbox
- _aspectCheckbox = new CheckboxWidget(boss, prefix + "grAspectCheckbox", "Aspect ratio correction", 0, 0);
+ _aspectCheckbox = new CheckboxWidget(boss, prefix + "grAspectCheckbox", _("Aspect ratio correction"), 0, 0);
_enableGraphicSettings = true;
}
void OptionsDialog::addAudioControls(GuiObject *boss, const Common::String &prefix) {
// The MIDI mode popup & a label
- _midiPopUpDesc = new StaticTextWidget(boss, prefix + "auMidiPopupDesc", "Music driver:");
+ _midiPopUpDesc = new StaticTextWidget(boss, prefix + "auMidiPopupDesc", _("Music driver:"));
_midiPopUp = new PopUpWidget(boss, prefix + "auMidiPopup");
// Populate it
const MidiDriverDescription *md = MidiDriver::getAvailableMidiDrivers();
while (md->name) {
- _midiPopUp->appendEntry(md->description, md->id);
+ _midiPopUp->appendEntry(_(md->description), md->id);
md++;
}
// The OPL emulator popup & a label
- _oplPopUpDesc = new StaticTextWidget(boss, prefix + "auOPLPopupDesc", "AdLib emulator:");
+ _oplPopUpDesc = new StaticTextWidget(boss, prefix + "auOPLPopupDesc", _("AdLib emulator:"));
_oplPopUp = new PopUpWidget(boss, prefix + "auOPLPopup");
// Populate it
const OPL::Config::EmulatorDescription *ed = OPL::Config::getAvailable();
while (ed->name) {
- _oplPopUp->appendEntry(ed->description, ed->id);
+ _oplPopUp->appendEntry(_(ed->description), ed->id);
++ed;
}
// Sample rate settings
- _outputRatePopUpDesc = new StaticTextWidget(boss, prefix + "auSampleRatePopupDesc", "Output rate:");
+ _outputRatePopUpDesc = new StaticTextWidget(boss, prefix + "auSampleRatePopupDesc", _("Output rate:"));
_outputRatePopUp = new PopUpWidget(boss, prefix + "auSampleRatePopup");
for (int i = 0; outputRateLabels[i]; i++) {
- _outputRatePopUp->appendEntry(outputRateLabels[i], outputRateValues[i]);
+ _outputRatePopUp->appendEntry(_(outputRateLabels[i]), outputRateValues[i]);
}
_enableAudioSettings = true;
@@ -656,21 +657,21 @@ void OptionsDialog::addAudioControls(GuiObject *boss, const Common::String &pref
void OptionsDialog::addMIDIControls(GuiObject *boss, const Common::String &prefix) {
// SoundFont
- _soundFontButton = new ButtonWidget(boss, prefix + "mcFontButton", "SoundFont:", kChooseSoundFontCmd, 0);
- _soundFont = new StaticTextWidget(boss, prefix + "mcFontPath", "None");
+ _soundFontButton = new ButtonWidget(boss, prefix + "mcFontButton", _("SoundFont:"), kChooseSoundFontCmd, 0);
+ _soundFont = new StaticTextWidget(boss, prefix + "mcFontPath", _("None"));
_soundFontClearButton = new ButtonWidget(boss, prefix + "mcFontClearButton", "C", kClearSoundFontCmd, 0);
// Multi midi setting
- _multiMidiCheckbox = new CheckboxWidget(boss, prefix + "mcMixedCheckbox", "Mixed AdLib/MIDI mode", 0, 0);
+ _multiMidiCheckbox = new CheckboxWidget(boss, prefix + "mcMixedCheckbox", _("Mixed AdLib/MIDI mode"), 0, 0);
// Native mt32 setting
- _mt32Checkbox = new CheckboxWidget(boss, prefix + "mcMt32Checkbox", "True Roland MT-32 (disable GM emulation)", 0, 0);
+ _mt32Checkbox = new CheckboxWidget(boss, prefix + "mcMt32Checkbox", _("True Roland MT-32 (disable GM emulation)"), 0, 0);
// GS Extensions setting
- _enableGSCheckbox = new CheckboxWidget(boss, prefix + "mcGSCheckbox", "Enable Roland GS Mode", 0, 0);
+ _enableGSCheckbox = new CheckboxWidget(boss, prefix + "mcGSCheckbox", _("Enable Roland GS Mode"), 0, 0);
// MIDI gain setting (FluidSynth uses this)
- _midiGainDesc = new StaticTextWidget(boss, prefix + "mcMidiGainText", "MIDI gain:");
+ _midiGainDesc = new StaticTextWidget(boss, prefix + "mcMidiGainText", _("MIDI gain:"));
_midiGainSlider = new SliderWidget(boss, prefix + "mcMidiGainSlider", kMidiGainChanged);
_midiGainSlider->setMinValue(0);
_midiGainSlider->setMaxValue(1000);
@@ -683,11 +684,11 @@ void OptionsDialog::addMIDIControls(GuiObject *boss, const Common::String &prefi
// make use of the widgets. The launcher range is 0-255. SCUMM's 0-9
void OptionsDialog::addSubtitleControls(GuiObject *boss, const Common::String &prefix, int maxSliderVal) {
- _subToggleDesc = new StaticTextWidget(boss, prefix + "subToggleDesc", "Text and Speech:");
+ _subToggleDesc = new StaticTextWidget(boss, prefix + "subToggleDesc", _("Text and Speech:"));
_subToggleButton = new ButtonWidget(boss, prefix + "subToggleButton", "", kSubtitleToggle, 0);
// Subtitle speed
- _subSpeedDesc = new StaticTextWidget(boss, prefix + "subSubtitleSpeedDesc", "Subtitle speed:");
+ _subSpeedDesc = new StaticTextWidget(boss, prefix + "subSubtitleSpeedDesc", _("Subtitle speed:"));
_subSpeedSlider = new SliderWidget(boss, prefix + "subSubtitleSpeedSlider", kSubtitleSpeedChanged);
_subSpeedLabel = new StaticTextWidget(boss, prefix + "subSubtitleSpeedLabel", "100%");
_subSpeedSlider->setMinValue(0); _subSpeedSlider->setMaxValue(maxSliderVal);
@@ -699,24 +700,24 @@ void OptionsDialog::addSubtitleControls(GuiObject *boss, const Common::String &p
void OptionsDialog::addVolumeControls(GuiObject *boss, const Common::String &prefix) {
// Volume controllers
- _musicVolumeDesc = new StaticTextWidget(boss, prefix + "vcMusicText", "Music volume:");
+ _musicVolumeDesc = new StaticTextWidget(boss, prefix + "vcMusicText", _("Music volume:"));
_musicVolumeSlider = new SliderWidget(boss, prefix + "vcMusicSlider", kMusicVolumeChanged);
_musicVolumeLabel = new StaticTextWidget(boss, prefix + "vcMusicLabel", "100%");
_musicVolumeSlider->setMinValue(0);
_musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
_musicVolumeLabel->setFlags(WIDGET_CLEARBG);
- _muteCheckbox = new CheckboxWidget(boss, prefix + "vcMuteCheckbox", "Mute All", kMuteAllChanged, 0);
+ _muteCheckbox = new CheckboxWidget(boss, prefix + "vcMuteCheckbox", _("Mute All"), kMuteAllChanged, 0);
- _sfxVolumeDesc = new StaticTextWidget(boss, prefix + "vcSfxText", "SFX volume:");
+ _sfxVolumeDesc = new StaticTextWidget(boss, prefix + "vcSfxText", _("SFX volume:"));
_sfxVolumeSlider = new SliderWidget(boss, prefix + "vcSfxSlider", kSfxVolumeChanged);
_sfxVolumeLabel = new StaticTextWidget(boss, prefix + "vcSfxLabel", "100%");
_sfxVolumeSlider->setMinValue(0);
_sfxVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
_sfxVolumeLabel->setFlags(WIDGET_CLEARBG);
- _speechVolumeDesc = new StaticTextWidget(boss, prefix + "vcSpeechText" , "Speech volume:");
+ _speechVolumeDesc = new StaticTextWidget(boss, prefix + "vcSpeechText" , _("Speech volume:"));
_speechVolumeSlider = new SliderWidget(boss, prefix + "vcSpeechSlider", kSpeechVolumeChanged);
_speechVolumeLabel = new StaticTextWidget(boss, prefix + "vcSpeechLabel", "100%");
_speechVolumeSlider->setMinValue(0);
@@ -745,7 +746,7 @@ int OptionsDialog::getSubtitleMode(bool subtitles, bool speech_mute) {
void OptionsDialog::reflowLayout() {
if (_graphicsTabId != -1 && _tabWidget)
- _tabWidget->setTabTitle(_graphicsTabId, g_system->getOverlayWidth() > 320 ? "Graphics" : "GFX");
+ _tabWidget->setTabTitle(_graphicsTabId, g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"));
Dialog::reflowLayout();
}
@@ -762,17 +763,17 @@ GlobalOptionsDialog::GlobalOptionsDialog()
//
// 1) The graphics tab
//
- _graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? "Graphics" : "GFX");
+ _graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"));
addGraphicControls(tab, "GlobalOptions_Graphics.");
//
// 2) The audio tab
//
- tab->addTab("Audio");
+ tab->addTab(_("Audio"));
addAudioControls(tab, "GlobalOptions_Audio.");
addSubtitleControls(tab, "GlobalOptions_Audio.");
- tab->addTab("Volume");
+ tab->addTab(_("Volume"));
addVolumeControls(tab, "GlobalOptions_Volume.");
// TODO: cd drive setting
@@ -780,67 +781,85 @@ GlobalOptionsDialog::GlobalOptionsDialog()
//
// 3) The MIDI tab
//
- tab->addTab("MIDI");
+ tab->addTab(_("MIDI"));
addMIDIControls(tab, "GlobalOptions_MIDI.");
//
// 4) The miscellaneous tab
//
- tab->addTab("Paths");
+ tab->addTab(_("Paths"));
#if !( defined(__DC__) || defined(__GP32__) )
// These two buttons have to be extra wide, or the text will be
// truncated in the small version of the GUI.
// Save game path
- new ButtonWidget(tab, "GlobalOptions_Paths.SaveButton", "Save Path: ", kChooseSaveDirCmd, 0);
+ new ButtonWidget(tab, "GlobalOptions_Paths.SaveButton", _("Save Path: "), kChooseSaveDirCmd, 0);
_savePath = new StaticTextWidget(tab, "GlobalOptions_Paths.SavePath", "/foo/bar");
- new ButtonWidget(tab, "GlobalOptions_Paths.ThemeButton", "Theme Path:", kChooseThemeDirCmd, 0);
- _themePath = new StaticTextWidget(tab, "GlobalOptions_Paths.ThemePath", "None");
+ new ButtonWidget(tab, "GlobalOptions_Paths.ThemeButton", _("Theme Path:"), kChooseThemeDirCmd, 0);
+ _themePath = new StaticTextWidget(tab, "GlobalOptions_Paths.ThemePath", _("None"));
- new ButtonWidget(tab, "GlobalOptions_Paths.ExtraButton", "Extra Path:", kChooseExtraDirCmd, 0);
- _extraPath = new StaticTextWidget(tab, "GlobalOptions_Paths.ExtraPath", "None");
+ new ButtonWidget(tab, "GlobalOptions_Paths.ExtraButton", _("Extra Path:"), kChooseExtraDirCmd, 0);
+ _extraPath = new StaticTextWidget(tab, "GlobalOptions_Paths.ExtraPath", _("None"));
#ifdef DYNAMIC_MODULES
- new ButtonWidget(tab, "GlobalOptions_Paths.PluginsButton", "Plugins Path:", kChoosePluginsDirCmd, 0);
- _pluginsPath = new StaticTextWidget(tab, "GlobalOptions_Paths.PluginsPath", "None");
+ new ButtonWidget(tab, "GlobalOptions_Paths.PluginsButton", _("Plugins Path:"), kChoosePluginsDirCmd, 0);
+ _pluginsPath = new StaticTextWidget(tab, "GlobalOptions_Paths.PluginsPath", _("None"));
#endif
#endif
- tab->addTab("Misc");
+ tab->addTab(_("Misc"));
- new ButtonWidget(tab, "GlobalOptions_Misc.ThemeButton", "Theme:", kChooseThemeCmd, 0);
+ new ButtonWidget(tab, "GlobalOptions_Misc.ThemeButton", _("Theme:"), kChooseThemeCmd, 0);
_curTheme = new StaticTextWidget(tab, "GlobalOptions_Misc.CurTheme", g_gui.theme()->getThemeName());
- _rendererPopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Misc.RendererPopupDesc", "GUI Renderer:");
+ _rendererPopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Misc.RendererPopupDesc", _("GUI Renderer:"));
_rendererPopUp = new PopUpWidget(tab, "GlobalOptions_Misc.RendererPopup");
for (uint i = 1; i < GUI::ThemeEngine::_rendererModesSize; ++i)
- _rendererPopUp->appendEntry(GUI::ThemeEngine::_rendererModes[i].name, GUI::ThemeEngine::_rendererModes[i].mode);
+ _rendererPopUp->appendEntry(_(GUI::ThemeEngine::_rendererModes[i].name), GUI::ThemeEngine::_rendererModes[i].mode);
- _autosavePeriodPopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Misc.AutosavePeriodPopupDesc", "Autosave:");
+ _autosavePeriodPopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Misc.AutosavePeriodPopupDesc", _("Autosave:"));
_autosavePeriodPopUp = new PopUpWidget(tab, "GlobalOptions_Misc.AutosavePeriodPopup");
for (int i = 0; savePeriodLabels[i]; i++) {
- _autosavePeriodPopUp->appendEntry(savePeriodLabels[i], savePeriodValues[i]);
+ _autosavePeriodPopUp->appendEntry(_(savePeriodLabels[i]), savePeriodValues[i]);
}
#ifdef SMALL_SCREEN_DEVICE
- new ButtonWidget(tab, "GlobalOptions_Misc.KeysButton", "Keys", kChooseKeyMappingCmd, 0);
+ new ButtonWidget(tab, "GlobalOptions_Misc.KeysButton", _("Keys"), kChooseKeyMappingCmd, 0);
#endif
// TODO: joystick setting
+#ifdef TRANSLATION
+ _guiLanguagePopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Misc.GuiLanguagePopupDesc", _("Language:"));
+ _guiLanguagePopUp = new PopUpWidget(tab, "GlobalOptions_Misc.GuiLanguagePopup");
+#ifdef DETECTLANG
+ _guiLanguagePopUp->appendEntry(_("<default>"), Common::kTranslationAutodetectId);
+#endif // DETECTLANG
+ _guiLanguagePopUp->appendEntry(_("English"), Common::kTranslationBuiltinId);
+ _guiLanguagePopUp->appendEntry("", 0);
+ Common::TLangArray languages = TransMan.getSupportedLanguages();
+ Common::TLangArray::iterator lang = languages.begin();
+ while (lang != languages.end()) {
+ _guiLanguagePopUp->appendEntry(lang->name, lang->id);
+ lang++;
+ }
+ _guiLanguagePopUp->setSelectedTag(TransMan.parseLanguage(ConfMan.get("gui_language").c_str()));
+
+#endif // TRANSLATION
+
// Activate the first tab
tab->setActiveTab(0);
_tabWidget = tab;
// Add OK & Cancel buttons
- new ButtonWidget(this, "GlobalOptions.Cancel", "Cancel", kCloseCmd, 0);
- new ButtonWidget(this, "GlobalOptions.Ok", "OK", kOKCmd, 0);
+ new ButtonWidget(this, "GlobalOptions.Cancel", _("Cancel"), kCloseCmd, 0);
+ new ButtonWidget(this, "GlobalOptions.Ok", _("OK"), kOKCmd, 0);
#ifdef SMALL_SCREEN_DEVICE
_keysDialog = new KeysDialog();
@@ -863,19 +882,19 @@ void GlobalOptionsDialog::open() {
Common::String extraPath(ConfMan.get("extrapath", _domain));
if (savePath.empty() || !ConfMan.hasKey("savepath", _domain)) {
- _savePath->setLabel("None");
+ _savePath->setLabel(_("None"));
} else {
_savePath->setLabel(savePath);
}
if (themePath.empty() || !ConfMan.hasKey("themepath", _domain)) {
- _themePath->setLabel("None");
+ _themePath->setLabel(_("None"));
} else {
_themePath->setLabel(themePath);
}
if (extraPath.empty() || !ConfMan.hasKey("extrapath", _domain)) {
- _extraPath->setLabel("None");
+ _extraPath->setLabel(_("None"));
} else {
_extraPath->setLabel(extraPath);
}
@@ -883,7 +902,7 @@ void GlobalOptionsDialog::open() {
#ifdef DYNAMIC_MODULES
Common::String pluginsPath(ConfMan.get("pluginspath", _domain));
if (pluginsPath.empty() || !ConfMan.hasKey("pluginspath", _domain)) {
- _pluginsPath->setLabel("None");
+ _pluginsPath->setLabel(_("None"));
} else {
_pluginsPath->setLabel(pluginsPath);
}
@@ -907,24 +926,24 @@ void GlobalOptionsDialog::open() {
void GlobalOptionsDialog::close() {
if (getResult()) {
Common::String savePath(_savePath->getLabel());
- if (!savePath.empty() && (savePath != "None"))
+ if (!savePath.empty() && (savePath != _("None")))
ConfMan.set("savepath", savePath, _domain);
Common::String themePath(_themePath->getLabel());
- if (!themePath.empty() && (themePath != "None"))
+ if (!themePath.empty() && (themePath != _("None")))
ConfMan.set("themepath", themePath, _domain);
else
ConfMan.removeKey("themepath", _domain);
Common::String extraPath(_extraPath->getLabel());
- if (!extraPath.empty() && (extraPath != "None"))
+ if (!extraPath.empty() && (extraPath != _("None")))
ConfMan.set("extrapath", extraPath, _domain);
else
ConfMan.removeKey("extrapath", _domain);
#ifdef DYNAMIC_MODULES
Common::String pluginsPath(_pluginsPath->getLabel());
- if (!pluginsPath.empty() && (pluginsPath != "None"))
+ if (!pluginsPath.empty() && (pluginsPath != _("None")))
ConfMan.set("pluginspath", pluginsPath, _domain);
else
ConfMan.removeKey("pluginspath", _domain);
@@ -940,6 +959,28 @@ void GlobalOptionsDialog::close() {
g_gui.loadNewTheme(g_gui.theme()->getThemeId(), selected);
ConfMan.set("gui_renderer", cfg, _domain);
}
+#ifdef TRANSLATION
+ Common::String oldLang = ConfMan.get("gui_language");
+ int selLang = _guiLanguagePopUp->getSelectedTag();
+
+ ConfMan.set("gui_language", TransMan.getLangById(selLang));
+
+ Common::String newLang = ConfMan.get("gui_language").c_str();
+ if (newLang != oldLang) {
+#if 0
+ // Activate the selected language
+ TransMan.setLanguage(selLang);
+
+ // FIXME: Actually, any changes (including the theme change) should
+ // only become active *after* the options dialog has closed.
+ g_gui.loadNewTheme(g_gui.theme()->getThemeId(), ThemeEngine::kGfxDisabled, true);
+#else
+ MessageDialog error(_("You have to restart ScummVM to take the effect."));
+ error.runModal();
+#endif
+ }
+#endif // TRANSLATION
+
}
OptionsDialog::close();
}
@@ -947,14 +988,14 @@ void GlobalOptionsDialog::close() {
void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
switch (cmd) {
case kChooseSaveDirCmd: {
- BrowserDialog browser("Select directory for savegames", true);
+ BrowserDialog browser(_("Select directory for savegames"), true);
if (browser.runModal() > 0) {
// User made his choice...
Common::FSNode dir(browser.getResult());
if (dir.isWritable()) {
_savePath->setLabel(dir.getPath());
} else {
- MessageDialog error("The chosen directory cannot be written to. Please select another one.");
+ MessageDialog error(_("The chosen directory cannot be written to. Please select another one."));
error.runModal();
return;
}
@@ -963,7 +1004,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
break;
}
case kChooseThemeDirCmd: {
- BrowserDialog browser("Select directory for GUI themes", true);
+ BrowserDialog browser(_("Select directory for GUI themes"), true);
if (browser.runModal() > 0) {
// User made his choice...
Common::FSNode dir(browser.getResult());
@@ -973,7 +1014,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
break;
}
case kChooseExtraDirCmd: {
- BrowserDialog browser("Select directory for extra files", true);
+ BrowserDialog browser(_("Select directory for extra files"), true);
if (browser.runModal() > 0) {
// User made his choice...
Common::FSNode dir(browser.getResult());
@@ -984,7 +1025,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
}
#ifdef DYNAMIC_MODULES
case kChoosePluginsDirCmd: {
- BrowserDialog browser("Select directory for plugins", true);
+ BrowserDialog browser(_("Select directory for plugins"), true);
if (browser.runModal() > 0) {
// User made his choice...
Common::FSNode dir(browser.getResult());
@@ -995,13 +1036,13 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
}
#endif
case kChooseSoundFontCmd: {
- BrowserDialog browser("Select SoundFont", false);
+ BrowserDialog browser(_("Select SoundFont"), false);
if (browser.runModal() > 0) {
// User made his choice...
Common::FSNode file(browser.getResult());
_soundFont->setLabel(file.getPath());
- if (!file.getPath().empty() && (file.getPath() != "None"))
+ if (!file.getPath().empty() && (file.getPath() != _("None")))
_soundFontClearButton->setEnabled(true);
else
_soundFontClearButton->setEnabled(false);
diff --git a/gui/options.h b/gui/options.h
index 956f78c18f..de25bfc998 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -184,6 +184,8 @@ protected:
PopUpWidget *_rendererPopUp;
StaticTextWidget *_autosavePeriodPopUpDesc;
PopUpWidget *_autosavePeriodPopUp;
+ StaticTextWidget *_guiLanguagePopUpDesc;
+ PopUpWidget *_guiLanguagePopUp;
};
} // End of namespace GUI
diff --git a/gui/saveload.cpp b/gui/saveload.cpp
index 8ec4dc4133..85bbd252c7 100644
--- a/gui/saveload.cpp
+++ b/gui/saveload.cpp
@@ -23,6 +23,7 @@
*/
#include "common/config-manager.h"
+#include "common/translation.h"
#include "gui/ListWidget.h"
#include "gui/message.h"
@@ -56,16 +57,16 @@ SaveLoadChooser::SaveLoadChooser(const String &title, const String &buttonLabel)
_gfxWidget = new GUI::GraphicsWidget(this, 0, 0, 10, 10);
- _date = new StaticTextWidget(this, 0, 0, 10, 10, "No date saved", Graphics::kTextAlignCenter);
- _time = new StaticTextWidget(this, 0, 0, 10, 10, "No time saved", Graphics::kTextAlignCenter);
- _playtime = new StaticTextWidget(this, 0, 0, 10, 10, "No playtime saved", Graphics::kTextAlignCenter);
+ _date = new StaticTextWidget(this, 0, 0, 10, 10, _("No date saved"), Graphics::kTextAlignCenter);
+ _time = new StaticTextWidget(this, 0, 0, 10, 10, _("No time saved"), Graphics::kTextAlignCenter);
+ _playtime = new StaticTextWidget(this, 0, 0, 10, 10, _("No playtime saved"), Graphics::kTextAlignCenter);
// Buttons
- new GUI::ButtonWidget(this, "SaveLoadChooser.Cancel", "Cancel", kCloseCmd, 0);
+ new GUI::ButtonWidget(this, "SaveLoadChooser.Cancel", _("Cancel"), kCloseCmd, 0);
_chooseButton = new GUI::ButtonWidget(this, "SaveLoadChooser.Choose", buttonLabel, kChooseCmd, 0);
_chooseButton->setEnabled(false);
- _deleteButton = new GUI::ButtonWidget(this, "SaveLoadChooser.Delete", "Delete", kDelCmd, 0);
+ _deleteButton = new GUI::ButtonWidget(this, "SaveLoadChooser.Delete", _("Delete"), kDelCmd, 0);
_deleteButton->setEnabled(false);
_delSupport = _metaInfoSupport = _thumbnailSupport = false;
@@ -152,8 +153,8 @@ void SaveLoadChooser::handleCommand(CommandSender *sender, uint32 cmd, uint32 da
break;
case kDelCmd:
if (selItem >= 0 && _delSupport) {
- MessageDialog alert("Do you really want to delete this savegame?",
- "Delete", "Cancel");
+ MessageDialog alert(_("Do you really want to delete this savegame?"),
+ _("Delete"), _("Cancel"));
if (alert.runModal() == GUI::kMessageOK) {
(*_plugin)->removeSaveState(_target.c_str(), atoi(_saveList[selItem].save_slot().c_str()));
@@ -237,9 +238,9 @@ void SaveLoadChooser::updateSelection(bool redraw) {
bool startEditMode = _list->isEditable();
_gfxWidget->setGfx(-1, -1, _fillR, _fillG, _fillB);
- _date->setLabel("No date saved");
- _time->setLabel("No time saved");
- _playtime->setLabel("No playtime saved");
+ _date->setLabel(_("No date saved"));
+ _time->setLabel(_("No time saved"));
+ _playtime->setLabel(_("No playtime saved"));
if (selItem >= 0 && !_list->getSelectedString().empty() && _metaInfoSupport) {
SaveStateDescriptor desc = (*_plugin)->querySaveMetaInfos(_target.c_str(), atoi(_saveList[selItem].save_slot().c_str()));
@@ -261,15 +262,15 @@ void SaveLoadChooser::updateSelection(bool redraw) {
if (_saveDateSupport) {
if (desc.contains("save_date"))
- _date->setLabel("Date: " + desc.getVal("save_date"));
+ _date->setLabel(_("Date: ") + desc.getVal("save_date"));
if (desc.contains("save_time"))
- _time->setLabel("Time: " + desc.getVal("save_time"));
+ _time->setLabel(_("Time: ") + desc.getVal("save_time"));
}
if (_playTimeSupport) {
if (desc.contains("play_time"))
- _playtime->setLabel("Playtime: " + desc.getVal("play_time"));
+ _playtime->setLabel(_("Playtime: ") + desc.getVal("play_time"));
}
}
@@ -282,7 +283,7 @@ void SaveLoadChooser::updateSelection(bool redraw) {
if (startEditMode) {
_list->startEditMode();
- if (_chooseButton->isEnabled() && _list->getSelectedString() == "Untitled savestate" &&
+ if (_chooseButton->isEnabled() && _list->getSelectedString() == _("Untitled savestate") &&
_list->getSelectionColor() == ThemeEngine::kFontColorAlternate) {
_list->setEditString("");
_list->setEditColor(ThemeEngine::kFontColorNormal);
@@ -349,7 +350,7 @@ void SaveLoadChooser::updateSaveList() {
Common::String trimmedDescription = description;
trimmedDescription.trim();
if (trimmedDescription.empty()) {
- description = "Untitled savestate";
+ description = _("Untitled savestate");
colors.push_back(ThemeEngine::kFontColorAlternate);
} else {
colors.push_back(ThemeEngine::kFontColorNormal);
diff --git a/gui/themebrowser.cpp b/gui/themebrowser.cpp
index 5d0e24394f..43a9ed8d0a 100644
--- a/gui/themebrowser.cpp
+++ b/gui/themebrowser.cpp
@@ -26,6 +26,8 @@
#include "gui/ListWidget.h"
#include "gui/widget.h"
+#include "common/translation.h"
+
namespace GUI {
enum {
@@ -41,7 +43,7 @@ enum {
ThemeBrowser::ThemeBrowser() : Dialog("Browser") {
_fileList = 0;
- new StaticTextWidget(this, "Browser.Headline", "Select a Theme");
+ new StaticTextWidget(this, "Browser.Headline", _("Select a Theme"));
// Add file list
_fileList = new ListWidget(this, "Browser.List");
@@ -51,8 +53,8 @@ ThemeBrowser::ThemeBrowser() : Dialog("Browser") {
_backgroundType = GUI::ThemeEngine::kDialogBackgroundPlain;
// Buttons
- new ButtonWidget(this, "Browser.Cancel", "Cancel", kCloseCmd, 0);
- new ButtonWidget(this, "Browser.Choose", "Choose", kChooseCmd, 0);
+ new ButtonWidget(this, "Browser.Cancel", _("Cancel"), kCloseCmd, 0);
+ new ButtonWidget(this, "Browser.Choose", _("Choose"), kChooseCmd, 0);
}
void ThemeBrowser::open() {
diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index 67cbbf7990..1a4481376d 100644
--- a/gui/themes/scummclassic.zip
+++ b/gui/themes/scummclassic.zip
Binary files differ
diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx
index 14f19a7151..b7b07f8845 100644
--- a/gui/themes/scummclassic/classic_layout.stx
+++ b/gui/themes/scummclassic/classic_layout.stx
@@ -406,6 +406,14 @@
type = 'PopUp'
/>
</layout>
+ <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
+ <widget name = 'GuiLanguagePopupDesc'
+ type = 'OptionsLabel'
+ />
+ <widget name = 'GuiLanguagePopup'
+ type = 'PopUp'
+ />
+ </layout>
<widget name='KeysButton'
type='Button'
/>
diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip
index b3dc16b67e..64e9a633ff 100644
--- a/gui/themes/scummmodern.zip
+++ b/gui/themes/scummmodern.zip
Binary files differ
diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx
index 25add37462..699d59b0be 100644
--- a/gui/themes/scummmodern/scummmodern_layout.stx
+++ b/gui/themes/scummmodern/scummmodern_layout.stx
@@ -419,6 +419,14 @@
type = 'PopUp'
/>
</layout>
+ <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
+ <widget name = 'GuiLanguagePopupDesc'
+ type = 'OptionsLabel'
+ />
+ <widget name = 'GuiLanguagePopup'
+ type = 'PopUp'
+ />
+ </layout>
<widget name='KeysButton'
type='Button'
/>