Ticket #9116: translations.patch

File translations.patch, 29.1 KB (added by SF/abevi, 14 years ago)

Patch

  • configure

     
    122122_keymapper=no
    123123# Default platform settings
    124124_backend=sdl
     125_translation=yes
    125126_endian=unknown
    126127_need_memalign=no
    127128_have_x86=no
     
    585586  --disable-mt32emu        don't enable the integrated MT-32 emulator
    586587  --disable-hq-scalers     exclude HQ2x and HQ3x scalers
    587588  --disable-scalers        exclude scalers
     589  --disable-translation    don't build support for translated messages
    588590
    589591Optional Libraries:
    590592  --with-alsa-prefix=DIR   Prefix where alsa is installed (optional)
     
    661663        --default-dynamic)        _plugins_default=dynamic ;;
    662664        --enable-mt32emu)         _mt32emu=yes    ;;
    663665        --disable-mt32emu)        _mt32emu=no     ;;
     666        --enable-translation)     _translation=yes ;;
     667        --disable-translation)    _translation=no ;;
    664668        --enable-vkeybd)          _vkeybd=yes     ;;
    665669        --disable-vkeybd)         _vkeybd=no      ;;
    666670        --enable-keymapper)       _keymapper=yes  ;;
     
    18961900        _def_fluidsynth='#undef USE_FLUIDSYNTH'
    18971901fi
    18981902echo "$_fluidsynth"
    1899 rm -rf $TMPC $TMPO$HOSTEXEEXT $TMPO.dSYM
    19001903
    19011904#
    19021905# Check for nasm
     
    19551958fi
    19561959
    19571960#
     1961# Check whether to build translation support
     1962#
     1963echo_n "Building translation support... "
     1964add_to_config_mk_if_yes $_translation 'ENABLE_TRANSLATION = 1'
     1965add_to_config_h_if_yes $_translation '#define TRANSLATION'
     1966if test "$_translation" = no ; then
     1967        echo "no"
     1968else
     1969        echo_n "yes ("
     1970
     1971        cat > $TMPC << EOF
     1972#include <locale.h>
     1973int main(void) { setlocale(LC_ALL, ""); return 0; }
     1974EOF
     1975        _detectlang=no
     1976        cc_check $LDFLAGS $CXXFLAGS && _detectlang=yes
     1977
     1978        add_to_config_h_if_yes $_detectlang '#define DETECTLANG'
     1979        if test "$_detectlang" = yes ; then
     1980                echo_n "with runtime language detection, "
     1981
     1982                cat > $TMPC << EOF
     1983#include <langinfo.h>
     1984#include <iconv.h>
     1985int main(void) { nl_langinfo(CODESET); iconv_open(0, 0); return 0; }
     1986EOF
     1987                _termconv=no
     1988                cc_check $LDFLAGS $CXXFLAGS && _termconv=yes
     1989                cc_check $LDFLAGS $CXXFLAGS -liconv && LIBS="$LIBS -liconv" && _termconv=yes
     1990
     1991                add_to_config_h_if_yes $_termconv '#define TERMCONV'
     1992                if test "$_termconv" = yes ; then
     1993                        echo "with terminal conversion)"
     1994                else
     1995                        echo "without terminal conversion)"
     1996                fi
     1997        else
     1998                echo "without runtime language detection)"
     1999        fi
     2000fi
     2001rm -rf $TMPC $TMPO$HOSTEXEEXT $TMPO.dSYM
     2002
     2003#
    19582004# Figure out installation directories
    19592005#
    19602006test -z "$_bindir" && _bindir="$_prefix/bin"
  • gui/options.h

     
    190190        PopUpWidget *_rendererPopUp;
    191191        StaticTextWidget *_autosavePeriodPopUpDesc;
    192192        PopUpWidget *_autosavePeriodPopUp;
     193        StaticTextWidget *_guiLanguagePopUpDesc;
     194        PopUpWidget *_guiLanguagePopUp;
    193195};
    194196
    195197} // End of namespace GUI
  • gui/themes/scummclassic/classic_layout.stx

     
    406406                                                type = 'PopUp'
    407407                                />
    408408                        </layout>
     409                        <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
     410                                <widget name = 'GuiLanguagePopupDesc'
     411                                                type = 'OptionsLabel'
     412                                />
     413                                <widget name = 'GuiLanguagePopup'
     414                                                type = 'PopUp'
     415                                />
     416                        </layout>
    409417                        <widget name='KeysButton'
    410418                                     type='Button'
    411419                        />
  • gui/themes/scummmodern/scummmodern_layout.stx

     
    416416                                                type = 'PopUp'
    417417                                />
    418418                        </layout>
     419                        <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'>
     420                                <widget name = 'GuiLanguagePopupDesc'
     421                                                type = 'OptionsLabel'
     422                                />
     423                                <widget name = 'GuiLanguagePopup'
     424                                                type = 'PopUp'
     425                                />
     426                        </layout>
    419427                        <widget name='KeysButton'
    420428                                     type='Button'
    421429                        />
  • gui/options.cpp

     
    3535#include "common/fs.h"
    3636#include "common/config-manager.h"
    3737#include "common/system.h"
     38#include "common/translation.h"
    3839
    3940#include "graphics/scaler.h"
    4041
     
    6768};
    6869#endif
    6970
    70 static const char *savePeriodLabels[] = { "Never", "every 5 mins", "every 10 mins", "every 15 mins", "every 30 mins", 0 };
     71static const char *savePeriodLabels[] = { _s("Never"), _s("every 5 mins"), _s("every 10 mins"), _s("every 15 mins"), _s("every 30 mins"), 0 };
    7172static const int savePeriodValues[] = { 0, 5 * 60, 10 * 60, 15 * 60, 30 * 60, -1 };
    72 static const char *outputRateLabels[] = { "<default>", "22 kHz", "8 kHz", "11kHz", "44 kHz", "48 kHz", 0 };
     73static const char *outputRateLabels[] = { _s("<default>"), _s("22 kHz"), _s("8 kHz"), _s("11kHz"), _s("44 kHz"), _s("48 kHz"), 0 };
    7374static const int outputRateValues[] = { 0, 22050, 8000, 11025, 44100, 48000, -1 };
    7475
    7576
     
    8586}
    8687
    8788const char *OptionsDialog::_subModeDesc[] = {
    88         "Speech Only",
    89         "Speech and Subtitles",
    90         "Subtitles Only"
     89        _s("Speech Only"),
     90        _s("Speech and Subtitles"),
     91        _s("Subtitles Only")
    9192};
    9293
    9394const char *OptionsDialog::_lowresSubModeDesc[] = {
    94         "Speech Only",
    95         "Speech & Subs",
    96         "Subtitles Only"
     95        _s("Speech Only"),
     96        _s("Speech & Subs"),
     97        _s("Subtitles Only")
    9798};
    9899
    99100void OptionsDialog::init() {
     
    222223
    223224                String soundFont(ConfMan.get("soundfont", _domain));
    224225                if (soundFont.empty() || !ConfMan.hasKey("soundfont", _domain)) {
    225                         _soundFont->setLabel("None");
     226                        _soundFont->setLabel(_("None"));
    226227                        _soundFontClearButton->setEnabled(false);
    227228                } else {
    228229                        _soundFont->setLabel(soundFont);
     
    267268                int speed;              int sliderMaxValue = _subSpeedSlider->getMaxValue();
    268269
    269270                _subMode = getSubtitleMode(ConfMan.getBool("subtitles", _domain), ConfMan.getBool("speech_mute", _domain));
    270                 _subToggleButton->setLabel(_subModeDesc[_subMode]);
     271                _subToggleButton->setLabel(_(_subModeDesc[_subMode]));
    271272
    272273                // Engines that reuse the subtitle speed widget set their own max value.
    273274                // Scale the config value accordingly (see addSubtitleControls)
     
    378379                                ConfMan.setInt("midi_gain", _midiGainSlider->getValue(), _domain);
    379380
    380381                                String soundFont(_soundFont->getLabel());
    381                                 if (!soundFont.empty() && (soundFont != "None"))
     382                                if (!soundFont.empty() && (soundFont != _("None")))
    382383                                        ConfMan.set("soundfont", soundFont, _domain);
    383384                                else
    384385                                        ConfMan.removeKey("soundfont", _domain);
     
    465466                else
    466467                        _subMode = 0;
    467468
    468                 _subToggleButton->setLabel(g_system->getOverlayWidth() > 320 ? _subModeDesc[_subMode] : _lowresSubModeDesc[_subMode]);
     469                _subToggleButton->setLabel(g_system->getOverlayWidth() > 320 ? _(_subModeDesc[_subMode]) : _(_lowresSubModeDesc[_subMode]));
    469470                _subToggleButton->draw();
    470471                _subSpeedDesc->draw();
    471472                _subSpeedSlider->draw();
     
    476477                _subSpeedLabel->draw();
    477478                break;
    478479        case kClearSoundFontCmd:
    479                 _soundFont->setLabel("None");
     480                _soundFont->setLabel(_("None"));
    480481                _soundFontClearButton->setEnabled(false);
    481482                draw();
    482483                break;
     
    522523        _soundFontButton->setEnabled(enabled);
    523524        _soundFont->setEnabled(enabled);
    524525
    525         if (enabled && !_soundFont->getLabel().empty() && (_soundFont->getLabel() != "None"))
     526        if (enabled && !_soundFont->getLabel().empty() && (_soundFont->getLabel() != _("None")))
    526527                _soundFontClearButton->setEnabled(enabled);
    527528        else
    528529                _soundFontClearButton->setEnabled(false);
     
    591592        const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
    592593
    593594        // The GFX mode popup
    594         _gfxPopUpDesc = new StaticTextWidget(boss, prefix + "grModePopupDesc", "Graphics mode:");
     595        _gfxPopUpDesc = new StaticTextWidget(boss, prefix + "grModePopupDesc", _("Graphics mode:"));
    595596        _gfxPopUp = new PopUpWidget(boss, prefix + "grModePopup");
    596597
    597         _gfxPopUp->appendEntry("<default>");
     598        _gfxPopUp->appendEntry(_("<default>"));
    598599        _gfxPopUp->appendEntry("");
    599600        while (gm->name) {
    600                 _gfxPopUp->appendEntry(gm->description, gm->id);
     601                _gfxPopUp->appendEntry(_(gm->description), gm->id);
    601602                gm++;
    602603        }
    603604
    604605        // RenderMode popup
    605         _renderModePopUpDesc = new StaticTextWidget(boss, prefix + "grRenderPopupDesc", "Render mode:");
     606        _renderModePopUpDesc = new StaticTextWidget(boss, prefix + "grRenderPopupDesc", _("Render mode:"));
    606607        _renderModePopUp = new PopUpWidget(boss, prefix + "grRenderPopup");
    607         _renderModePopUp->appendEntry("<default>", Common::kRenderDefault);
     608        _renderModePopUp->appendEntry(_("<default>"), Common::kRenderDefault);
    608609        _renderModePopUp->appendEntry("");
    609610        const Common::RenderModeDescription *rm = Common::g_renderModes;
    610611        for (; rm->code; ++rm) {
    611                 _renderModePopUp->appendEntry(rm->description, rm->id);
     612                _renderModePopUp->appendEntry(_(rm->description), rm->id);
    612613        }
    613614
    614615        // Fullscreen checkbox
    615         _fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", "Fullscreen mode", 0, 0);
     616        _fullscreenCheckbox = new CheckboxWidget(boss, prefix + "grFullscreenCheckbox", _("Fullscreen mode"), 0, 0);
    616617
    617618        // Aspect ratio checkbox
    618         _aspectCheckbox = new CheckboxWidget(boss, prefix + "grAspectCheckbox", "Aspect ratio correction", 0, 0);
     619        _aspectCheckbox = new CheckboxWidget(boss, prefix + "grAspectCheckbox", _("Aspect ratio correction"), 0, 0);
    619620
    620621        _enableGraphicSettings = true;
    621622}
    622623
    623624void OptionsDialog::addAudioControls(GuiObject *boss, const String &prefix) {
    624625        // The MIDI mode popup & a label
    625         _midiPopUpDesc = new StaticTextWidget(boss, prefix + "auMidiPopupDesc", "Music driver:");
     626        _midiPopUpDesc = new StaticTextWidget(boss, prefix + "auMidiPopupDesc", _("Music driver:"));
    626627        _midiPopUp = new PopUpWidget(boss, prefix + "auMidiPopup");
    627628
    628629        // Populate it
     
    633634        }
    634635
    635636        // The OPL emulator popup & a label
    636         _oplPopUpDesc = new StaticTextWidget(boss, prefix + "auOPLPopupDesc", "AdLib emulator:");
     637        _oplPopUpDesc = new StaticTextWidget(boss, prefix + "auOPLPopupDesc", _("AdLib emulator:"));
    637638        _oplPopUp = new PopUpWidget(boss, prefix + "auOPLPopup");
    638639
    639640        // Populate it
    640641        const OPL::Config::EmulatorDescription *ed = OPL::Config::getAvailable();
    641642        while (ed->name) {
    642                 _oplPopUp->appendEntry(ed->description, ed->id);
     643                _oplPopUp->appendEntry(_(ed->description), ed->id);
    643644                ++ed;
    644645        }
    645646
    646647        // Sample rate settings
    647         _outputRatePopUpDesc = new StaticTextWidget(boss, prefix + "auSampleRatePopupDesc", "Output rate:");
     648        _outputRatePopUpDesc = new StaticTextWidget(boss, prefix + "auSampleRatePopupDesc", _("Output rate:"));
    648649        _outputRatePopUp = new PopUpWidget(boss, prefix + "auSampleRatePopup");
    649650
    650651        for (int i = 0; outputRateLabels[i]; i++) {
     
    656657
    657658void OptionsDialog::addMIDIControls(GuiObject *boss, const String &prefix) {
    658659        // SoundFont
    659         _soundFontButton = new ButtonWidget(boss, prefix + "mcFontButton", "SoundFont:", kChooseSoundFontCmd, 0);
    660         _soundFont = new StaticTextWidget(boss, prefix + "mcFontPath", "None");
     660        _soundFontButton = new ButtonWidget(boss, prefix + "mcFontButton", _("SoundFont:"), kChooseSoundFontCmd, 0);
     661        _soundFont = new StaticTextWidget(boss, prefix + "mcFontPath", _("None"));
    661662        _soundFontClearButton = new ButtonWidget(boss, prefix + "mcFontClearButton", "C", kClearSoundFontCmd, 0);
    662663
    663664        // Multi midi setting
    664         _multiMidiCheckbox = new CheckboxWidget(boss, prefix + "mcMixedCheckbox", "Mixed AdLib/MIDI mode", 0, 0);
     665        _multiMidiCheckbox = new CheckboxWidget(boss, prefix + "mcMixedCheckbox", _("Mixed AdLib/MIDI mode"), 0, 0);
    665666
    666667        // Native mt32 setting
    667         _mt32Checkbox = new CheckboxWidget(boss, prefix + "mcMt32Checkbox", "True Roland MT-32 (disable GM emulation)", 0, 0);
     668        _mt32Checkbox = new CheckboxWidget(boss, prefix + "mcMt32Checkbox", _("True Roland MT-32 (disable GM emulation)"), 0, 0);
    668669
    669670        // GS Extensions setting
    670         _enableGSCheckbox = new CheckboxWidget(boss, prefix + "mcGSCheckbox", "Enable Roland GS Mode", 0, 0);
     671        _enableGSCheckbox = new CheckboxWidget(boss, prefix + "mcGSCheckbox", _("Enable Roland GS Mode"), 0, 0);
    671672
    672673        // MIDI gain setting (FluidSynth uses this)
    673         _midiGainDesc = new StaticTextWidget(boss, prefix + "mcMidiGainText", "MIDI gain:");
     674        _midiGainDesc = new StaticTextWidget(boss, prefix + "mcMidiGainText", _("MIDI gain:"));
    674675        _midiGainSlider = new SliderWidget(boss, prefix + "mcMidiGainSlider", kMidiGainChanged);
    675676        _midiGainSlider->setMinValue(0);
    676677        _midiGainSlider->setMaxValue(1000);
     
    683684// make use of the widgets. The launcher range is 0-255. SCUMM's 0-9
    684685void OptionsDialog::addSubtitleControls(GuiObject *boss, const String &prefix, int maxSliderVal) {
    685686
    686         _subToggleDesc = new StaticTextWidget(boss, prefix + "subToggleDesc", "Text and Speech:");
     687        _subToggleDesc = new StaticTextWidget(boss, prefix + "subToggleDesc", _("Text and Speech:"));
    687688        _subToggleButton = new ButtonWidget(boss, prefix + "subToggleButton", "", kSubtitleToggle, 0);
    688689
    689690        // Subtitle speed
    690         _subSpeedDesc = new StaticTextWidget(boss, prefix + "subSubtitleSpeedDesc", "Subtitle speed:");
     691        _subSpeedDesc = new StaticTextWidget(boss, prefix + "subSubtitleSpeedDesc", _("Subtitle speed:"));
    691692        _subSpeedSlider = new SliderWidget(boss, prefix + "subSubtitleSpeedSlider", kSubtitleSpeedChanged);
    692693        _subSpeedLabel = new StaticTextWidget(boss, prefix + "subSubtitleSpeedLabel", "100%");
    693694        _subSpeedSlider->setMinValue(0); _subSpeedSlider->setMaxValue(maxSliderVal);
     
    699700void OptionsDialog::addVolumeControls(GuiObject *boss, const String &prefix) {
    700701
    701702        // Volume controllers
    702         _musicVolumeDesc = new StaticTextWidget(boss, prefix + "vcMusicText", "Music volume:");
     703        _musicVolumeDesc = new StaticTextWidget(boss, prefix + "vcMusicText", _("Music volume:"));
    703704        _musicVolumeSlider = new SliderWidget(boss, prefix + "vcMusicSlider", kMusicVolumeChanged);
    704705        _musicVolumeLabel = new StaticTextWidget(boss, prefix + "vcMusicLabel", "100%");
    705706        _musicVolumeSlider->setMinValue(0);
    706707        _musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
    707708        _musicVolumeLabel->setFlags(WIDGET_CLEARBG);
    708709
    709         _muteCheckbox = new CheckboxWidget(boss, prefix + "vcMuteCheckbox", "Mute All", kMuteAllChanged, 0);
     710        _muteCheckbox = new CheckboxWidget(boss, prefix + "vcMuteCheckbox", _("Mute All"), kMuteAllChanged, 0);
    710711
    711712
    712         _sfxVolumeDesc = new StaticTextWidget(boss, prefix + "vcSfxText", "SFX volume:");
     713        _sfxVolumeDesc = new StaticTextWidget(boss, prefix + "vcSfxText", _("SFX volume:"));
    713714        _sfxVolumeSlider = new SliderWidget(boss, prefix + "vcSfxSlider", kSfxVolumeChanged);
    714715        _sfxVolumeLabel = new StaticTextWidget(boss, prefix + "vcSfxLabel", "100%");
    715716        _sfxVolumeSlider->setMinValue(0);
    716717        _sfxVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
    717718        _sfxVolumeLabel->setFlags(WIDGET_CLEARBG);
    718719
    719         _speechVolumeDesc = new StaticTextWidget(boss, prefix + "vcSpeechText" , "Speech volume:");
     720        _speechVolumeDesc = new StaticTextWidget(boss, prefix + "vcSpeechText" , _("Speech volume:"));
    720721        _speechVolumeSlider = new SliderWidget(boss, prefix + "vcSpeechSlider", kSpeechVolumeChanged);
    721722        _speechVolumeLabel = new StaticTextWidget(boss, prefix + "vcSpeechLabel", "100%");
    722723        _speechVolumeSlider->setMinValue(0);
     
    739740        else if (subtitles && speech_mute) // Subtitles only
    740741                return 2;
    741742        else
    742                 warning("Wrong configuration: Both subtitles and speech are off. Assuming subtitles only");
     743                warning(_t("Wrong configuration: Both subtitles and speech are off. Assuming subtitles only"));
    743744        return 2;
    744745}
    745746
    746747void OptionsDialog::reflowLayout() {
    747748        if (_graphicsTabId != -1 && _tabWidget)
    748                 _tabWidget->setTabTitle(_graphicsTabId, g_system->getOverlayWidth() > 320 ? "Graphics" : "GFX");
     749                _tabWidget->setTabTitle(_graphicsTabId, g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"));
    749750
    750751        Dialog::reflowLayout();
    751752}
     
    768769        //
    769770        // 2) The audio tab
    770771        //
    771         tab->addTab("Audio");
     772        tab->addTab(_("Audio"));
    772773        addAudioControls(tab, "GlobalOptions_Audio.");
    773774        addSubtitleControls(tab, "GlobalOptions_Audio.");
    774775
    775         tab->addTab("Volume");
     776        tab->addTab(_("Volume"));
    776777        addVolumeControls(tab, "GlobalOptions_Volume.");
    777778
    778779        // TODO: cd drive setting
     
    780781        //
    781782        // 3) The MIDI tab
    782783        //
    783         tab->addTab("MIDI");
     784        tab->addTab(_("MIDI"));
    784785        addMIDIControls(tab, "GlobalOptions_MIDI.");
    785786
    786787        //
    787788        // 4) The miscellaneous tab
    788789        //
    789         tab->addTab("Paths");
     790        tab->addTab(_("Paths"));
    790791
    791792#if !( defined(__DC__) || defined(__GP32__) )
    792793        // These two buttons have to be extra wide, or the text will be
    793794        // truncated in the small version of the GUI.
    794795
    795796        // Save game path
    796         new ButtonWidget(tab, "GlobalOptions_Paths.SaveButton", "Save Path: ", kChooseSaveDirCmd, 0);
     797        new ButtonWidget(tab, "GlobalOptions_Paths.SaveButton", _("Save Path: "), kChooseSaveDirCmd, 0);
    797798        _savePath = new StaticTextWidget(tab, "GlobalOptions_Paths.SavePath", "/foo/bar");
    798799
    799         new ButtonWidget(tab, "GlobalOptions_Paths.ThemeButton", "Theme Path:", kChooseThemeDirCmd, 0);
    800         _themePath = new StaticTextWidget(tab, "GlobalOptions_Paths.ThemePath", "None");
     800        new ButtonWidget(tab, "GlobalOptions_Paths.ThemeButton", _("Theme Path:"), kChooseThemeDirCmd, 0);
     801        _themePath = new StaticTextWidget(tab, "GlobalOptions_Paths.ThemePath", _("None"));
    801802
    802         new ButtonWidget(tab, "GlobalOptions_Paths.ExtraButton", "Extra Path:", kChooseExtraDirCmd, 0);
    803         _extraPath = new StaticTextWidget(tab, "GlobalOptions_Paths.ExtraPath", "None");
     803        new ButtonWidget(tab, "GlobalOptions_Paths.ExtraButton", _("Extra Path:"), kChooseExtraDirCmd, 0);
     804        _extraPath = new StaticTextWidget(tab, "GlobalOptions_Paths.ExtraPath", _("None"));
    804805
    805806#ifdef DYNAMIC_MODULES
    806         new ButtonWidget(tab, "GlobalOptions_Paths.PluginsButton", "Plugins Path:", kChoosePluginsDirCmd, 0);
     807        new ButtonWidget(tab, "GlobalOptions_Paths.PluginsButton", _("Plugins Path:"), kChoosePluginsDirCmd, 0);
    807808        _pluginsPath = new StaticTextWidget(tab, "GlobalOptions_Paths.PluginsPath", "None");
    808809#endif
    809810#endif
    810811
    811         tab->addTab("Misc");
     812        tab->addTab(_("Misc"));
    812813
    813         new ButtonWidget(tab, "GlobalOptions_Misc.ThemeButton", "Theme:", kChooseThemeCmd, 0);
     814        new ButtonWidget(tab, "GlobalOptions_Misc.ThemeButton", _("Theme:"), kChooseThemeCmd, 0);
    814815        _curTheme = new StaticTextWidget(tab, "GlobalOptions_Misc.CurTheme", g_gui.theme()->getThemeName());
    815816
    816817
    817         _rendererPopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Misc.RendererPopupDesc", "GUI Renderer:");
     818        _rendererPopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Misc.RendererPopupDesc", _("GUI Renderer:"));
    818819        _rendererPopUp = new PopUpWidget(tab, "GlobalOptions_Misc.RendererPopup");
    819820
    820821        for (uint i = 1; i < GUI::ThemeEngine::_rendererModesSize; ++i)
    821822                _rendererPopUp->appendEntry(GUI::ThemeEngine::_rendererModes[i].name, GUI::ThemeEngine::_rendererModes[i].mode);
    822823
    823         _autosavePeriodPopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Misc.AutosavePeriodPopupDesc", "Autosave:");
     824        _autosavePeriodPopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Misc.AutosavePeriodPopupDesc", _("Autosave:"));
    824825        _autosavePeriodPopUp = new PopUpWidget(tab, "GlobalOptions_Misc.AutosavePeriodPopup");
    825826
    826827        for (int i = 0; savePeriodLabels[i]; i++) {
     
    828829        }
    829830
    830831#ifdef SMALL_SCREEN_DEVICE
    831         new ButtonWidget(tab, "GlobalOptions_Misc.KeysButton", "Keys", kChooseKeyMappingCmd, 0);
     832        new ButtonWidget(tab, "GlobalOptions_Misc.KeysButton", _("Keys"), kChooseKeyMappingCmd, 0);
    832833#endif
    833834
     835#ifdef TRANSLATION
     836        _guiLanguagePopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Misc.GuiLanguagePopupDesc", _("Language:"));
     837        _guiLanguagePopUp = new PopUpWidget(tab, "GlobalOptions_Misc.GuiLanguagePopup");
     838#ifdef DETECTLANG
     839        _guiLanguagePopUp->appendEntry(_("<default>"), 0);
     840#endif // DETECTLANG
     841        _guiLanguagePopUp->appendEntry(_("English"), 1);
     842        _guiLanguagePopUp->appendEntry("", 0);
     843        Common::List<String> languages = TransMan.getSupportedLanguages();
     844        Common::List<String>::iterator lang = languages.begin();
     845        while (lang != languages.end()) {
     846                _guiLanguagePopUp->appendEntry(*lang, 2);
     847                lang++;
     848        }
     849#endif // TRANSLATION
     850
    834851        // TODO: joystick setting
    835852
    836853
     
    839856        _tabWidget = tab;
    840857
    841858        // Add OK & Cancel buttons
    842         new ButtonWidget(this, "GlobalOptions.Cancel", "Cancel", kCloseCmd, 0);
    843         new ButtonWidget(this, "GlobalOptions.Ok", "OK", kOKCmd, 0);
     859        new ButtonWidget(this, "GlobalOptions.Cancel", _("Cancel"), kCloseCmd, 0);
     860        new ButtonWidget(this, "GlobalOptions.Ok", _("OK"), kOKCmd, 0);
    844861
    845862#ifdef SMALL_SCREEN_DEVICE
    846863        _keysDialog = new KeysDialog();
     
    863880        Common::String extraPath(ConfMan.get("extrapath", _domain));
    864881
    865882        if (savePath.empty() || !ConfMan.hasKey("savepath", _domain)) {
    866                 _savePath->setLabel("None");
     883                _savePath->setLabel(_("None"));
    867884        } else {
    868885                _savePath->setLabel(savePath);
    869886        }
    870887
    871888        if (themePath.empty() || !ConfMan.hasKey("themepath", _domain)) {
    872                 _themePath->setLabel("None");
     889                _themePath->setLabel(_("None"));
    873890        } else {
    874891                _themePath->setLabel(themePath);
    875892        }
    876893
    877894        if (extraPath.empty() || !ConfMan.hasKey("extrapath", _domain)) {
    878                 _extraPath->setLabel("None");
     895                _extraPath->setLabel(_("None"));
    879896        } else {
    880897                _extraPath->setLabel(extraPath);
    881898        }
     
    883900#ifdef DYNAMIC_MODULES
    884901        Common::String pluginsPath(ConfMan.get("pluginspath", _domain));
    885902        if (pluginsPath.empty() || !ConfMan.hasKey("pluginspath", _domain)) {
    886                 _pluginsPath->setLabel("None");
     903                _pluginsPath->setLabel(_("None"));
    887904        } else {
    888905                _pluginsPath->setLabel(pluginsPath);
    889906        }
     
    907924void GlobalOptionsDialog::close() {
    908925        if (getResult()) {
    909926                String savePath(_savePath->getLabel());
    910                 if (!savePath.empty() && (savePath != "None"))
     927                if (!savePath.empty() && (savePath != _("None")))
    911928                        ConfMan.set("savepath", savePath, _domain);
    912929
    913930                String themePath(_themePath->getLabel());
    914                 if (!themePath.empty() && (themePath != "None"))
     931                if (!themePath.empty() && (themePath != _("None")))
    915932                        ConfMan.set("themepath", themePath, _domain);
    916933                else
    917934                        ConfMan.removeKey("themepath", _domain);
    918935
    919936                String extraPath(_extraPath->getLabel());
    920                 if (!extraPath.empty() && (extraPath != "None"))
     937                if (!extraPath.empty() && (extraPath != _("None")))
    921938                        ConfMan.set("extrapath", extraPath, _domain);
    922939                else
    923940                        ConfMan.removeKey("extrapath", _domain);
    924941
    925942#ifdef DYNAMIC_MODULES
    926943                String pluginsPath(_pluginsPath->getLabel());
    927                 if (!pluginsPath.empty() && (pluginsPath != "None"))
     944                if (!pluginsPath.empty() && (pluginsPath != _("None")))
    928945                        ConfMan.set("pluginspath", pluginsPath, _domain);
    929946                else
    930947                        ConfMan.removeKey("pluginspath", _domain);
     
    940957                        g_gui.loadNewTheme(g_gui.theme()->getThemeId(), selected);
    941958                        ConfMan.set("gui_renderer", cfg, _domain);
    942959                }
     960#ifdef TRANSLATION
     961                String oldLang = ConfMan.get("gui_language");
     962                switch (_guiLanguagePopUp->getSelectedTag()) {
     963                case 0:
     964#ifdef DETECTLANG
     965                        // Default
     966                        ConfMan.set("gui_language", "", _domain);
     967                        break;
     968#endif // DETECTLANG
     969                case 1:
     970                        // English
     971                        ConfMan.set("gui_language", "C", _domain);
     972                        break;
     973                case 2:
     974                        // Other language
     975                        ConfMan.set("gui_language", _guiLanguagePopUp->getSelectedString(), _domain);
     976                        break;
     977                }
     978                String newLang = ConfMan.get("gui_language").c_str();
     979                if (newLang != oldLang) {
     980                /*
     981                        // Activate the selected language
     982                        TransMan.setLanguage(newLang.c_str());
     983
     984                        // Update widgets' strings
     985                        g_gui.updateTranslation(); // TODO: Currently you have to restart.
     986                */
     987                }
     988#endif // TRANSLATION
    943989        }
    944990        OptionsDialog::close();
    945991}
     
    947993void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
    948994        switch (cmd) {
    949995        case kChooseSaveDirCmd: {
    950                 BrowserDialog browser("Select directory for savegames", true);
     996                BrowserDialog browser(_("Select directory for savegames"), true);
    951997                if (browser.runModal() > 0) {
    952998                        // User made his choice...
    953999                        Common::FSNode dir(browser.getResult());
    9541000                        if (dir.isWritable()) {
    9551001                                _savePath->setLabel(dir.getPath());
    9561002                        } else {
    957                                 MessageDialog error("The chosen directory cannot be written to. Please select another one.");
     1003                                MessageDialog error(_("The chosen directory cannot be written to. Please select another one."));
    9581004                                error.runModal();
    9591005                                return;
    9601006                        }
     
    9631009                break;
    9641010        }
    9651011        case kChooseThemeDirCmd: {
    966                 BrowserDialog browser("Select directory for GUI themes", true);
     1012                BrowserDialog browser(_("Select directory for GUI themes"), true);
    9671013                if (browser.runModal() > 0) {
    9681014                        // User made his choice...
    9691015                        Common::FSNode dir(browser.getResult());
     
    9731019                break;
    9741020        }
    9751021        case kChooseExtraDirCmd: {
    976                 BrowserDialog browser("Select directory for extra files", true);
     1022                BrowserDialog browser(_("Select directory for extra files"), true);
    9771023                if (browser.runModal() > 0) {
    9781024                        // User made his choice...
    9791025                        Common::FSNode dir(browser.getResult());
     
    9841030        }
    9851031#ifdef DYNAMIC_MODULES
    9861032        case kChoosePluginsDirCmd: {
    987                 BrowserDialog browser("Select directory for plugins", true);
     1033                BrowserDialog browser(_("Select directory for plugins"), true);
    9881034                if (browser.runModal() > 0) {
    9891035                        // User made his choice...
    9901036                        Common::FSNode dir(browser.getResult());
     
    9951041        }
    9961042#endif
    9971043        case kChooseSoundFontCmd: {
    998                 BrowserDialog browser("Select SoundFont", false);
     1044                BrowserDialog browser(_("Select SoundFont"), false);
    9991045                if (browser.runModal() > 0) {
    10001046                        // User made his choice...
    10011047                        Common::FSNode file(browser.getResult());
    10021048                        _soundFont->setLabel(file.getPath());
    10031049
    1004                         if (!file.getPath().empty() && (file.getPath() != "None"))
     1050                        if (!file.getPath().empty() && (file.getPath() != _("None")))
    10051051                                _soundFontClearButton->setEnabled(true);
    10061052                        else
    10071053                                _soundFontClearButton->setEnabled(false);
  • gui/GuiManager.cpp

     
    2727#include "common/util.h"
    2828#include "common/config-manager.h"
    2929#include "common/algorithm.h"
     30#include "common/translation.h"
    3031
    3132#include "backends/keymapper/keymapper.h"
    3233
     
    6970                // Loading the theme failed, try to load the built-in theme
    7071                if (!loadNewTheme("builtin", gfxMode)) {
    7172                        // Loading the built-in theme failed as well. Bail out
    72                         error("Failed to load any GUI theme, aborting");
     73                        error(_t("Failed to load any GUI theme, aborting"));
    7374                }
    7475        }
    7576}
  • common/module.mk

     
    1515        stream.o \
    1616        util.o \
    1717        system.o \
     18        translation.o \
    1819        unarj.o \
    1920        unzip.o \
    2021        xmlparser.o \
    2122        zlib.o
    2223
     24ifdef ENABLE_TRANSLATION
     25common/translation.cpp: common/messages.cpp
     26
     27common/messages.cpp: $(wildcard po/*.po)
     28 tools/po2c $^ > common/messages.cpp
     29endif
     30
    2331# Include common rules
    2432include $(srcdir)/rules.mk
  • Makefile.common

     
    2828        sound \
    2929        backends \
    3030        common \
     31        po
    3132
    3233ifdef USE_MT32EMU
    3334MODULES += sound/softsynth/mt32
  • base/main.cpp

     
    4444#include "common/file.h"
    4545#include "common/fs.h"
    4646#include "common/system.h"
     47#include "common/translation.h"
    4748#include "gui/GuiManager.h"
    4849#include "gui/message.h"
    4950
     
    9495        ConfMan.set("gameid", gameid);
    9596
    9697        // Query the plugins and find one that will handle the specified gameid
    97         printf("User picked target '%s' (gameid '%s')...\n", ConfMan.getActiveDomainName().c_str(), gameid.c_str());
    98         printf("  Looking for a plugin supporting this gameid... ");
     98        printf(_t("User picked target '%s' (gameid '%s')...\n"), ConfMan.getActiveDomainName().c_str(), gameid.c_str());
     99        printf(_t("  Looking for a plugin supporting this gameid... "));
    99100        GameDescriptor game = EngineMan.findGame(gameid, &plugin);
    100101
    101102        if (plugin == 0) {
    102                 printf("failed\n");
    103                 warning("%s is an invalid gameid. Use the --list-games option to list supported gameid", gameid.c_str());
     103                printf(_t("failed\n"));
     104                warning(_t("%s is an invalid gameid. Use the --list-games option to list supported gameid"), gameid.c_str());
    104105                return 0;
    105106        } else {
    106107                printf("%s\n", plugin->getName());
    107108        }
    108109
    109110        // FIXME: Do we really need this one?
    110         printf("  Starting '%s'\n", game.description().c_str());
     111        printf(_t("  Starting '%s'\n"), game.description().c_str());
    111112
    112113        return plugin;
    113114}
     
    136137                const char *errMsg = 0;
    137138                switch (err) {
    138139                case Common::kInvalidPathError:
    139                         errMsg = "Invalid game path";
     140                        errMsg = _t("Invalid game path");
    140141                        break;
    141142                case Common::kNoGameDataFoundError:
    142                         errMsg = "Unable to locate game data";
     143                        errMsg = _t("Unable to locate game data");
    143144                        break;
    144145                default:
    145                         errMsg = "Unknown error";
     146                        errMsg = _t("Unknown error");
    146147                }
    147148
    148                 warning("%s failed to instantiate engine: %s (target '%s', path '%s')",
     149                warning(_t("%s failed to instantiate engine: %s (target '%s', path '%s')"),
    149150                        plugin->getName(),
    150151                        errMsg,
    151152                        ConfMan.getActiveDomainName().c_str(),
     
    321322        // Update the config file
    322323        ConfMan.set("versioninfo", gScummVMVersion, Common::ConfigManager::kApplicationDomain);
    323324
     325        // Enable translation
     326        TransMan.setLanguage(ConfMan.get("gui_language").c_str());
    324327
    325328        // Load and setup the debuglevel and the debug flags. We do this at the
    326329        // soonest possible moment to ensure debug output starts early on, if