mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-22 12:12:16 +00:00
GUI: Add an option to set the GUI language to the game language
This commit is contained in:
parent
add9a0b49a
commit
bbbd40477d
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -281,6 +281,7 @@ protected:
|
||||
PopUpWidget *_autosavePeriodPopUp;
|
||||
StaticTextWidget *_guiLanguagePopUpDesc;
|
||||
PopUpWidget *_guiLanguagePopUp;
|
||||
CheckboxWidget *_guiLanguageUseGameLanguageCheckbox;
|
||||
|
||||
#ifdef USE_UPDATES
|
||||
StaticTextWidget *_updatesPopUpDesc;
|
||||
|
@ -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' "
|
||||
|
Binary file not shown.
@ -567,6 +567,11 @@
|
||||
type = 'PopUp'
|
||||
/>
|
||||
</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'
|
||||
|
@ -569,6 +569,11 @@
|
||||
type = 'PopUp'
|
||||
/>
|
||||
</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'
|
||||
|
Binary file not shown.
@ -581,6 +581,11 @@
|
||||
type = 'PopUp'
|
||||
/>
|
||||
</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'
|
||||
|
@ -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'
|
||||
|
Loading…
x
Reference in New Issue
Block a user