[Scummvm-git-logs] scummvm master -> bbbd40477d1afe62df63b222193e016d1e9fdd7d

bgK bastien.bouclet at gmail.com
Sun Dec 2 19:47:35 CET 2018


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
bbbd40477d GUI: Add an option to set the GUI language to the game language


Commit: bbbd40477d1afe62df63b222193e016d1e9fdd7d
    https://github.com/scummvm/scummvm/commit/bbbd40477d1afe62df63b222193e016d1e9fdd7d
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2018-12-02T19:47:32+01:00

Commit Message:
GUI: Add an option to set the GUI language to the game language

Changed paths:
    base/main.cpp
    gui/options.cpp
    gui/options.h
    gui/themes/default.inc
    gui/themes/scummclassic.zip
    gui/themes/scummclassic/classic_layout.stx
    gui/themes/scummclassic/classic_layout_lowres.stx
    gui/themes/scummmodern.zip
    gui/themes/scummmodern/scummmodern_layout.stx
    gui/themes/scummmodern/scummmodern_layout_lowres.stx


diff --git a/base/main.cpp b/base/main.cpp
index c43b865..e9c0b96 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 1bfe386..5c5c9ec 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 18bb728..12b42bd 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 85b0aca..499ae7b 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
index 17ef7d4..2e283e3 100644
Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ
diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx
index 29d2375..1ac6390 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 0b3a529..71c8da3 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
index 2fe9279..197c5fe 100644
Binary files a/gui/themes/scummmodern.zip and b/gui/themes/scummmodern.zip differ
diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx
index b0c2b5b..48244c7 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 188f293..685082e 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'





More information about the Scummvm-git-logs mailing list