Use USE_TRANSLATION, USE_DETECTLANG and USE_TERMCONV instead of (ENABLE_)TRANSLATION, DETECTLANG and TERMCONV.
svn-id: r49885
This commit is contained in:
parent
7360bea1ee
commit
49463c2bf9
5 changed files with 35 additions and 35 deletions
|
@ -29,7 +29,7 @@ MODULE_OBJS := \
|
|||
xmlparser.o \
|
||||
zlib.o
|
||||
|
||||
ifdef ENABLE_TRANSLATION
|
||||
ifdef USE_TRANSLATION
|
||||
common/translation.cpp: common/messages.cpp
|
||||
|
||||
common/messages.cpp: $(wildcard po/*.po)
|
||||
|
|
|
@ -26,28 +26,28 @@
|
|||
|
||||
DECLARE_SINGLETON(Common::TranslationManager)
|
||||
|
||||
#ifdef DETECTLANG
|
||||
#ifdef USE_DETECTLANG
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
#ifdef TERMCONV
|
||||
#ifdef USE_TERMCONV
|
||||
#include <langinfo.h>
|
||||
#endif
|
||||
|
||||
#ifdef TRANSLATION
|
||||
#ifdef USE_TRANSLATION
|
||||
#include "messages.cpp"
|
||||
#endif
|
||||
|
||||
namespace Common {
|
||||
|
||||
|
||||
#ifdef TRANSLATION
|
||||
#ifdef USE_TRANSLATION
|
||||
|
||||
// Translation enabled
|
||||
|
||||
|
||||
TranslationManager::TranslationManager() {
|
||||
#ifdef DETECTLANG
|
||||
#ifdef USE_DETECTLANG
|
||||
// Activating current locale settings
|
||||
const char *locale = setlocale(LC_ALL, "");
|
||||
|
||||
|
@ -74,25 +74,25 @@ TranslationManager::TranslationManager() {
|
|||
|
||||
_syslang = String(locale, length);
|
||||
}
|
||||
#else // DETECTLANG
|
||||
#else // USE_DETECTLANG
|
||||
_syslang = "C";
|
||||
#endif // DETECTLANG
|
||||
#endif // USE_DETECTLANG
|
||||
|
||||
#ifdef TERMCONV
|
||||
#ifdef USE_TERMCONV
|
||||
_convmsg = NULL;
|
||||
_conversion = NULL;
|
||||
#endif // TERMCONV
|
||||
#endif // USE_TERMCONV
|
||||
|
||||
// Set the default language
|
||||
setLanguage("");
|
||||
}
|
||||
|
||||
TranslationManager::~TranslationManager() {
|
||||
#ifdef TERMCONV
|
||||
#ifdef USE_TERMCONV
|
||||
iconv_close(_conversion);
|
||||
if (_convmsg)
|
||||
delete[] _convmsg;
|
||||
#endif // TERMCONV
|
||||
#endif // USE_TERMCONV
|
||||
}
|
||||
|
||||
void TranslationManager::setLanguage(const char *lang) {
|
||||
|
@ -101,7 +101,7 @@ void TranslationManager::setLanguage(const char *lang) {
|
|||
else
|
||||
po2c_setlang(lang);
|
||||
|
||||
#ifdef TERMCONV
|
||||
#ifdef USE_TERMCONV
|
||||
// Get the locale character set (for terminal output)
|
||||
const char *charset_term = nl_langinfo(CODESET);
|
||||
|
||||
|
@ -114,7 +114,7 @@ void TranslationManager::setLanguage(const char *lang) {
|
|||
|
||||
// Initialize the conversion
|
||||
_conversion = iconv_open(charset_term, charset_po);
|
||||
#endif // TERMCONV
|
||||
#endif // USE_TERMCONV
|
||||
}
|
||||
|
||||
const char *TranslationManager::getTranslation(const char *message) {
|
||||
|
@ -125,7 +125,7 @@ String TranslationManager::getTranslation(const String &message) {
|
|||
return po2c_gettext(message.c_str());
|
||||
}
|
||||
|
||||
#ifdef TERMCONV
|
||||
#ifdef USE_TERMCONV
|
||||
bool TranslationManager::convert(const char *message) {
|
||||
// Preparing conversion origin
|
||||
size_t len = strlen(message);
|
||||
|
@ -154,10 +154,10 @@ bool TranslationManager::convert(const char *message) {
|
|||
|
||||
return result != ((size_t)-1);
|
||||
}
|
||||
#endif // TERMCONV
|
||||
#endif // USE_TERMCONV
|
||||
|
||||
const char *TranslationManager::convertTerm(const char *message) {
|
||||
#ifdef TERMCONV
|
||||
#ifdef USE_TERMCONV
|
||||
size_t len = strlen(message);
|
||||
if (!_convmsg) {
|
||||
_sizeconv = len * 2;
|
||||
|
@ -177,9 +177,9 @@ const char *TranslationManager::convertTerm(const char *message) {
|
|||
}
|
||||
|
||||
return _convmsg;
|
||||
#else // TERMCONV
|
||||
#else // USE_TERMCONV
|
||||
return message;
|
||||
#endif // TERMCONV
|
||||
#endif // USE_TERMCONV
|
||||
}
|
||||
|
||||
const TLangArray TranslationManager::getSupportedLanguages() const {
|
||||
|
@ -225,7 +225,7 @@ const char *TranslationManager::getLangById(int id) {
|
|||
return "";
|
||||
}
|
||||
|
||||
#else // TRANSLATION
|
||||
#else // USE_TRANSLATION
|
||||
|
||||
// Translation disabled
|
||||
|
||||
|
@ -244,6 +244,6 @@ const char *TranslationManager::convertTerm(const char *message) {
|
|||
return message;
|
||||
}
|
||||
|
||||
#endif // TRANSLATION
|
||||
#endif // USE_TRANSLATION
|
||||
|
||||
} // End of namespace Common
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "common/singleton.h"
|
||||
#include "common/str-array.h"
|
||||
|
||||
#ifdef TERMCONV
|
||||
#ifdef USE_TERMCONV
|
||||
#include <iconv.h>
|
||||
#endif
|
||||
|
||||
|
@ -63,13 +63,13 @@ class TranslationManager : public Singleton<TranslationManager> {
|
|||
private:
|
||||
Common::String _syslang;
|
||||
|
||||
#ifdef TERMCONV
|
||||
#ifdef USE_TERMCONV
|
||||
iconv_t _conversion;
|
||||
char *_convmsg;
|
||||
int _sizeconv;
|
||||
|
||||
bool convert(const char *message);
|
||||
#endif // TERMCONV
|
||||
#endif // USE_TERMCONV
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -147,7 +147,7 @@ public:
|
|||
|
||||
#define TransMan Common::TranslationManager::instance()
|
||||
|
||||
#ifdef TRANSLATION
|
||||
#ifdef USE_TRANSLATION
|
||||
#define _(str) TransMan.getTranslation(str)
|
||||
#define _t(str) TransMan.convertTerm(_(str))
|
||||
#else
|
||||
|
|
8
configure
vendored
8
configure
vendored
|
@ -2323,8 +2323,8 @@ fi
|
|||
# Check whether to build translation support
|
||||
#
|
||||
echo_n "Building translation support... "
|
||||
add_to_config_mk_if_yes $_translation 'ENABLE_TRANSLATION = 1'
|
||||
add_to_config_h_if_yes $_translation '#define TRANSLATION'
|
||||
add_to_config_mk_if_yes $_translation 'USE_TRANSLATION = 1'
|
||||
add_to_config_h_if_yes $_translation '#define USE_TRANSLATION'
|
||||
if test "$_translation" = no ; then
|
||||
echo "no"
|
||||
else
|
||||
|
@ -2337,7 +2337,7 @@ EOF
|
|||
_detectlang=no
|
||||
cc_check $LDFLAGS $CXXFLAGS && _detectlang=yes
|
||||
|
||||
add_to_config_h_if_yes $_detectlang '#define DETECTLANG'
|
||||
add_to_config_h_if_yes $_detectlang '#define USE_DETECTLANG'
|
||||
if test "$_detectlang" = yes ; then
|
||||
echo_n "with runtime language detection, "
|
||||
|
||||
|
@ -2350,7 +2350,7 @@ EOF
|
|||
cc_check_no_clean $LDFLAGS $CXXFLAGS && _termconv=yes
|
||||
cc_check $LDFLAGS $CXXFLAGS -liconv && LIBS="$LIBS -liconv" && _termconv=yes
|
||||
|
||||
add_to_config_h_if_yes $_termconv '#define TERMCONV'
|
||||
add_to_config_h_if_yes $_termconv '#define USE_TERMCONV'
|
||||
if test "$_termconv" = yes ; then
|
||||
uses_const=no
|
||||
cat > $TMPC << EOF
|
||||
|
|
|
@ -853,12 +853,12 @@ GlobalOptionsDialog::GlobalOptionsDialog()
|
|||
// TODO: joystick setting
|
||||
|
||||
|
||||
#ifdef TRANSLATION
|
||||
#ifdef USE_TRANSLATION
|
||||
_guiLanguagePopUpDesc = new StaticTextWidget(tab, "GlobalOptions_Misc.GuiLanguagePopupDesc", _("GUI Language:"), _("Language of ScummVM GUI"));
|
||||
_guiLanguagePopUp = new PopUpWidget(tab, "GlobalOptions_Misc.GuiLanguagePopup");
|
||||
#ifdef DETECTLANG
|
||||
#ifdef USE_DETECTLANG
|
||||
_guiLanguagePopUp->appendEntry(_("<default>"), Common::kTranslationAutodetectId);
|
||||
#endif // DETECTLANG
|
||||
#endif // USE_DETECTLANG
|
||||
_guiLanguagePopUp->appendEntry(_("English"), Common::kTranslationBuiltinId);
|
||||
_guiLanguagePopUp->appendEntry("", 0);
|
||||
Common::TLangArray languages = TransMan.getSupportedLanguages();
|
||||
|
@ -869,7 +869,7 @@ GlobalOptionsDialog::GlobalOptionsDialog()
|
|||
}
|
||||
_guiLanguagePopUp->setSelectedTag(TransMan.parseLanguage(ConfMan.get("gui_language").c_str()));
|
||||
|
||||
#endif // TRANSLATION
|
||||
#endif // USE_TRANSLATION
|
||||
|
||||
// Activate the first tab
|
||||
tab->setActiveTab(0);
|
||||
|
@ -977,7 +977,7 @@ void GlobalOptionsDialog::close() {
|
|||
g_gui.loadNewTheme(g_gui.theme()->getThemeId(), selected);
|
||||
ConfMan.set("gui_renderer", cfg, _domain);
|
||||
}
|
||||
#ifdef TRANSLATION
|
||||
#ifdef USE_TRANSLATION
|
||||
Common::String oldLang = ConfMan.get("gui_language");
|
||||
int selLang = _guiLanguagePopUp->getSelectedTag();
|
||||
|
||||
|
@ -997,7 +997,7 @@ void GlobalOptionsDialog::close() {
|
|||
error.runModal();
|
||||
#endif
|
||||
}
|
||||
#endif // TRANSLATION
|
||||
#endif // USE_TRANSLATION
|
||||
|
||||
}
|
||||
OptionsDialog::close();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue