From a2945ba440db388792733cd175c6074b34e03eb5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 20 Aug 2011 12:28:06 +0100 Subject: COMMON: Implemented functions for determining localized Y/N equivalent --- common/localization.cpp | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 common/localization.cpp (limited to 'common/localization.cpp') diff --git a/common/localization.cpp b/common/localization.cpp new file mode 100644 index 0000000000..c4c76c3b99 --- /dev/null +++ b/common/localization.cpp @@ -0,0 +1,57 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "common/localization.h" + +namespace Common { + +void getLanguageYesNo(Language id, KeyCode &keyYes, KeyCode &keyNo) { + // If all else fails, use English as fallback. + keyYes = KEYCODE_y; + keyNo = KEYCODE_n; + + switch (id) { + case Common::RU_RUS: + break; + case Common::PL_POL: + keyYes = Common::KEYCODE_t; + break; + case Common::HE_ISR: + keyYes = Common::KEYCODE_f; + break; + case Common::ES_ESP: + keyYes = Common::KEYCODE_s; + break; + case Common::IT_ITA: + keyYes = Common::KEYCODE_s; + break; + case Common::FR_FRA: + keyYes = Common::KEYCODE_o; + break; + case Common::DE_DEU: + keyYes = Common::KEYCODE_j; + break; + default: + break; + } +} + +} // End of namespace Common -- cgit v1.2.3 From 59200bf426cc85b9ec49865010a035ce214bb2bd Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 20 Aug 2011 19:36:54 +0200 Subject: SCUMM: Fix compilation when translation support is disabled. For this I added a convenience version of getLanguageYesNo, which works on the currently setup GUI translation language. All other code which requires this acan also use it instead of having to worry about the USE_TRANSLATION and thus having two code paths. --- common/localization.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'common/localization.cpp') diff --git a/common/localization.cpp b/common/localization.cpp index c4c76c3b99..afd31b8d22 100644 --- a/common/localization.cpp +++ b/common/localization.cpp @@ -20,6 +20,7 @@ */ #include "common/localization.h" +#include "common/translation.h" namespace Common { @@ -54,4 +55,12 @@ void getLanguageYesNo(Language id, KeyCode &keyYes, KeyCode &keyNo) { } } +void getLanguageYesNo(KeyCode &keyYes, KeyCode &keyNo) { +#ifdef USE_TRANSLATION + getLanguageYesNo(Common::parseLanguageFromLocale(TransMan.getCurrentLanguage().c_str()), keyYes, keyNo); +#else + getLanguageYesNo(Common::EN_ANY, keyYes, keyNo); +#endif +} + } // End of namespace Common -- cgit v1.2.3