diff options
author | Bastien Bouclet | 2018-09-27 07:12:11 +0200 |
---|---|---|
committer | Bastien Bouclet | 2018-12-02 19:47:32 +0100 |
commit | bbbd40477d1afe62df63b222193e016d1e9fdd7d (patch) | |
tree | 4d4e69d9631a725aeef2a10a27d075e1ed6823e3 | |
parent | add9a0b49a39a9e2a3c3cd3376afd3a4b7f71937 (diff) | |
download | scummvm-rg350-bbbd40477d1afe62df63b222193e016d1e9fdd7d.tar.gz scummvm-rg350-bbbd40477d1afe62df63b222193e016d1e9fdd7d.tar.bz2 scummvm-rg350-bbbd40477d1afe62df63b222193e016d1e9fdd7d.zip |
GUI: Add an option to set the GUI language to the game language
-rw-r--r-- | base/main.cpp | 13 | ||||
-rw-r--r-- | gui/options.cpp | 15 | ||||
-rw-r--r-- | gui/options.h | 1 | ||||
-rw-r--r-- | gui/themes/default.inc | 10 | ||||
-rw-r--r-- | gui/themes/scummclassic.zip | bin | 130467 -> 130822 bytes | |||
-rw-r--r-- | gui/themes/scummclassic/classic_layout.stx | 5 | ||||
-rw-r--r-- | gui/themes/scummclassic/classic_layout_lowres.stx | 5 | ||||
-rw-r--r-- | gui/themes/scummmodern.zip | bin | 1650007 -> 1650353 bytes | |||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_layout.stx | 5 | ||||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_layout_lowres.stx | 7 |
10 files changed, 60 insertions, 1 deletions
diff --git a/base/main.cpp b/base/main.cpp index c43b865251..e9c0b967d3 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -254,6 +254,15 @@ static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common warning(_("Engine does not support debug level '%s'"), token.c_str()); } +#ifdef USE_TRANSLATION + Common::String previousLanguage = TransMan.getCurrentLanguage(); + if (ConfMan.hasKey("gui_use_game_language") + && ConfMan.getBool("gui_use_game_language") + && ConfMan.hasKey("language")) { + TransMan.setLanguage(ConfMan.get("language")); + } +#endif + // Initialize any game-specific keymaps engine->initKeymap(); @@ -278,6 +287,10 @@ static Common::Error runGame(const Plugin *plugin, OSystem &system, const Common // Reset the file/directory mappings SearchMan.clear(); +#ifdef USE_TRANSLATION + TransMan.setLanguage(previousLanguage); +#endif + // Return result (== 0 means no error) return result; } diff --git a/gui/options.cpp b/gui/options.cpp index 1bfe386ca4..5c5c9ecd7c 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -1467,6 +1467,7 @@ GlobalOptionsDialog::GlobalOptionsDialog(LauncherDialog *launcher) _autosavePeriodPopUp = 0; _guiLanguagePopUpDesc = 0; _guiLanguagePopUp = 0; + _guiLanguageUseGameLanguageCheckbox = nullptr; #ifdef USE_UPDATES _updatesPopUpDesc = 0; _updatesPopUp = 0; @@ -1690,6 +1691,17 @@ void GlobalOptionsDialog::build() { _guiLanguagePopUp->setSelectedTag(Common::kTranslationBuiltinId); #endif // USE_DETECTLANG + _guiLanguageUseGameLanguageCheckbox = new CheckboxWidget(tab, "GlobalOptions_Misc.GuiLanguageUseGameLanguage", + _("Switch the GUI language to the game language"), + _("When starting a game, change the GUI language to the game language." + "That way, if a game uses the ScummVM save and load dialogs, they are" + "in the same language as the game.") + ); + + if (ConfMan.hasKey("gui_use_game_language")) { + _guiLanguageUseGameLanguageCheckbox->setState(ConfMan.getBool("gui_use_game_language", _domain)); + } + #endif // USE_TRANSLATION #ifdef USE_UPDATES @@ -1960,6 +1972,9 @@ void GlobalOptionsDialog::apply() { newCharset = TransMan.getCurrentCharset(); isRebuildNeeded = true; } + + bool guiUseGameLanguage = _guiLanguageUseGameLanguageCheckbox->getState(); + ConfMan.setBool("gui_use_game_language", guiUseGameLanguage, _domain); #endif GUI::ThemeEngine::GraphicsMode gfxMode = (GUI::ThemeEngine::GraphicsMode)_rendererPopUp->getSelectedTag(); diff --git a/gui/options.h b/gui/options.h index 18bb728369..12b42bd3a0 100644 --- a/gui/options.h +++ b/gui/options.h @@ -281,6 +281,7 @@ protected: PopUpWidget *_autosavePeriodPopUp; StaticTextWidget *_guiLanguagePopUpDesc; PopUpWidget *_guiLanguagePopUp; + CheckboxWidget *_guiLanguageUseGameLanguageCheckbox; #ifdef USE_UPDATES StaticTextWidget *_updatesPopUpDesc; diff --git a/gui/themes/default.inc b/gui/themes/default.inc index 85b0aca8ab..499ae7b5ee 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -1135,6 +1135,11 @@ const char *defaultXML1 = "<?xml version = '1.0'?>" "/>" "</layout>" "<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'>" +"<widget name='GuiLanguageUseGameLanguage' " +"type='Checkbox' " +"/>" +"</layout>" +"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'>" "<widget name='UpdatesPopupDesc' " "type='OptionsLabel' " "/>" @@ -2739,6 +2744,11 @@ const char *defaultXML1 = "<?xml version = '1.0'?>" "/>" "</layout>" "<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'>" +"<widget name='GuiLanguageUseGameLanguage' " +"type='Checkbox' " +"/>" +"</layout>" +"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'>" "<widget name='UpdatesPopupDesc' " "width='80' " "height='Globals.Line.Height' " diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip Binary files differindex 17ef7d4d49..2e283e3b79 100644 --- a/gui/themes/scummclassic.zip +++ b/gui/themes/scummclassic.zip diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index 29d23757ec..1ac639046b 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -568,6 +568,11 @@ /> </layout> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'GuiLanguageUseGameLanguage' + type = 'Checkbox' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> <widget name = 'UpdatesPopupDesc' type = 'OptionsLabel' /> diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx index 0b3a52914f..71c8da3469 100644 --- a/gui/themes/scummclassic/classic_layout_lowres.stx +++ b/gui/themes/scummclassic/classic_layout_lowres.stx @@ -570,6 +570,11 @@ /> </layout> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> + <widget name = 'GuiLanguageUseGameLanguage' + type = 'Checkbox' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> <widget name = 'UpdatesPopupDesc' width = '80' height = 'Globals.Line.Height' diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip Binary files differindex 2fe9279877..197c5feff5 100644 --- a/gui/themes/scummmodern.zip +++ b/gui/themes/scummmodern.zip diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index b0c2b5b209..48244c7a23 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -582,6 +582,11 @@ /> </layout> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> + <widget name = 'GuiLanguageUseGameLanguage' + type = 'Checkbox' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> <widget name = 'UpdatesPopupDesc' type = 'OptionsLabel' /> diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index 188f29366f..685082e7e3 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -567,7 +567,12 @@ type = 'PopUp' /> </layout> - <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> + <widget name = 'GuiLanguageUseGameLanguage' + type = 'Checkbox' + /> + </layout> + <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> <widget name = 'UpdatesPopupDesc' width = '80' height = 'Globals.Line.Height' |