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
This commit is contained in:
Eugene Sandulenko 2010-06-15 10:44:51 +00:00
parent db6673c408
commit 859212df25
35 changed files with 3528 additions and 255 deletions

View file

@ -28,6 +28,7 @@
#include "common/savefile.h"
#include "common/system.h"
#include "common/events.h"
#include "common/translation.h"
#include "graphics/scaler.h"
@ -85,37 +86,37 @@ MainMenuDialog::MainMenuDialog(Engine *engine)
StaticTextWidget *version = new StaticTextWidget(this, "GlobalMenu.Version", gScummVMVersionDate);
version->setAlign(Graphics::kTextAlignCenter);
new GUI::ButtonWidget(this, "GlobalMenu.Resume", "Resume", kPlayCmd, 'P');
new GUI::ButtonWidget(this, "GlobalMenu.Resume", _("Resume"), kPlayCmd, 'P');
_loadButton = new GUI::ButtonWidget(this, "GlobalMenu.Load", "Load", kLoadCmd, 'L');
_loadButton = new GUI::ButtonWidget(this, "GlobalMenu.Load", _("Load"), kLoadCmd, 'L');
// TODO: setEnabled -> setVisible
_loadButton->setEnabled(_engine->hasFeature(Engine::kSupportsLoadingDuringRuntime));
_saveButton = new GUI::ButtonWidget(this, "GlobalMenu.Save", "Save", kSaveCmd, 'S');
_saveButton = new GUI::ButtonWidget(this, "GlobalMenu.Save", _("Save"), kSaveCmd, 'S');
// TODO: setEnabled -> setVisible
_saveButton->setEnabled(_engine->hasFeature(Engine::kSupportsSavingDuringRuntime));
new GUI::ButtonWidget(this, "GlobalMenu.Options", "Options", kOptionsCmd, 'O');
new GUI::ButtonWidget(this, "GlobalMenu.Options", _("Options"), kOptionsCmd, 'O');
// The help button is disabled by default.
// To enable "Help", an engine needs to use a subclass of MainMenuDialog
// (at least for now, we might change how this works in the future).
_helpButton = new GUI::ButtonWidget(this, "GlobalMenu.Help", "Help", kHelpCmd, 'H');
_helpButton = new GUI::ButtonWidget(this, "GlobalMenu.Help", _("Help"), kHelpCmd, 'H');
_helpButton->setEnabled(false);
new GUI::ButtonWidget(this, "GlobalMenu.About", "About", kAboutCmd, 'A');
new GUI::ButtonWidget(this, "GlobalMenu.About", _("About"), kAboutCmd, 'A');
_rtlButton = new GUI::ButtonWidget(this, "GlobalMenu.RTL", "Return to Launcher", kRTLCmd, 'R');
_rtlButton = new GUI::ButtonWidget(this, "GlobalMenu.RTL", _("Return to Launcher"), kRTLCmd, 'R');
_rtlButton->setEnabled(_engine->hasFeature(Engine::kSupportsRTL));
new GUI::ButtonWidget(this, "GlobalMenu.Quit", "Quit", kQuitCmd, 'Q');
new GUI::ButtonWidget(this, "GlobalMenu.Quit", _("Quit"), kQuitCmd, 'Q');
_aboutDialog = new GUI::AboutDialog();
_optionsDialog = new ConfigDialog(_engine->hasFeature(Engine::kSupportsSubtitleOptions));
_loadDialog = new GUI::SaveLoadChooser("Load game:", "Load");
_loadDialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"));
_loadDialog->setSaveMode(false);
_saveDialog = new GUI::SaveLoadChooser("Save game:", "Save");
_saveDialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"));
_saveDialog->setSaveMode(true);
}
@ -297,11 +298,11 @@ ConfigDialog::ConfigDialog(bool subtitleControls)
// Add the buttons
//
new GUI::ButtonWidget(this, "GlobalConfig.Ok", "OK", GUI::kOKCmd, 'O');
new GUI::ButtonWidget(this, "GlobalConfig.Cancel", "Cancel", GUI::kCloseCmd, 'C');
new GUI::ButtonWidget(this, "GlobalConfig.Ok", _("OK"), GUI::kOKCmd, 'O');
new GUI::ButtonWidget(this, "GlobalConfig.Cancel", _("Cancel"), GUI::kCloseCmd, 'C');
#ifdef SMALL_SCREEN_DEVICE
new GUI::ButtonWidget(this, "GlobalConfig.Keys", "Keys", kKeysCmd, 'K');
new GUI::ButtonWidget(this, "GlobalConfig.Keys", _("Keys"), kKeysCmd, 'K');
_keysDialog = NULL;
#endif
}