Removed code related to dummy locales.
This commit is contained in:
parent
5e564b2688
commit
b3e24d2050
8 changed files with 4 additions and 120 deletions
|
@ -439,12 +439,6 @@ game_controller::game_controller(int argc, char** argv) :
|
|||
loaded_game_ = argv_[arg_];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else if(val == "--dummy-locales") {
|
||||
#ifdef USE_DUMMYLOCALES
|
||||
game_config::use_dummylocales = true;
|
||||
#else
|
||||
std::cerr << "Option --dummy-locales ignored: support was not compiled in.\n";
|
||||
#endif
|
||||
} else if(val == "--no-srng") {
|
||||
rand_rng::disable_server_rng();
|
||||
|
@ -1747,8 +1741,6 @@ static int process_command_args(int argc, char** argv) {
|
|||
<< " The data can also be generated when the F12 is\n"
|
||||
<< " pressed in a dialog.\n"
|
||||
#endif
|
||||
<< " --dummy-locales enables dummy locales for switching to non-system\n"
|
||||
<< " locales.\n"
|
||||
#ifndef DISABLE_EDITOR
|
||||
<< " -e, --editor [<file>] starts the in-game map editor directly. If <file>\n"
|
||||
<< " is specified, equivalent to -e --load <file>.\n"
|
||||
|
|
|
@ -51,8 +51,6 @@ namespace game_config
|
|||
std::string wesnoth_program_dir;
|
||||
bool debug = false, editor = false, ignore_replay_errors = false, mp_debug = false, exit_at_end = false, no_delay = false, small_gui = false, disable_autosave = false;
|
||||
|
||||
bool use_dummylocales = false;
|
||||
|
||||
int cache_compression_level = 6;
|
||||
|
||||
std::string game_icon = "wesnoth-icon-small.png", game_title, game_logo, title_music, lobby_music;
|
||||
|
|
|
@ -56,8 +56,6 @@ namespace game_config
|
|||
|
||||
extern bool debug, editor, ignore_replay_errors, mp_debug, exit_at_end, no_delay, small_gui, disable_autosave;
|
||||
|
||||
extern bool use_dummylocales;
|
||||
|
||||
extern int cache_compression_level;
|
||||
|
||||
extern std::string path;
|
||||
|
|
|
@ -59,8 +59,6 @@ void tlanguage_selection::pre_show(CVideo& /*video*/, twindow& window)
|
|||
if(lang == current_language) {
|
||||
list->select_row(list->get_item_count() - 1);
|
||||
}
|
||||
|
||||
list->set_row_active(list->get_item_count() - 1, lang.available());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,39 +43,6 @@ extern "C" int _putenv(const char*);
|
|||
#define WRN_G LOG_STREAM(warn, lg::general)
|
||||
#define ERR_G LOG_STREAM(err, lg::general)
|
||||
|
||||
|
||||
/** Tests one locale to be available. */
|
||||
static bool has_locale(const char* s) {
|
||||
try {
|
||||
// The way to find out whether a locale is available is to set it and
|
||||
// hope not runtime error gets thrown.
|
||||
std::locale dummy(s);
|
||||
return true;
|
||||
} catch (std::runtime_error&) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** Test the locale for a language and it's utf-8 variations. */
|
||||
static bool has_language(const std::string& language)
|
||||
{
|
||||
if(has_locale(language.c_str())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string utf = language + ".utf-8";
|
||||
if(has_locale(utf.c_str())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
utf = language + ".UTF-8";
|
||||
if(has_locale(utf.c_str())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
namespace {
|
||||
language_def current_language;
|
||||
string_map strings_;
|
||||
|
@ -93,34 +60,6 @@ bool language_def::operator== (const language_def& a) const
|
|||
return ((language == a.language) /* && (localename == a.localename) */ );
|
||||
}
|
||||
|
||||
bool language_def::available() const
|
||||
{
|
||||
#if defined(_WIN32) || defined(__APPLE__)
|
||||
// Under windows and OSX all locales are available and testing for it seems
|
||||
// to fail so just return true.
|
||||
return true;
|
||||
#endif
|
||||
|
||||
//if (game_config::use_dummylocales)
|
||||
if (true)
|
||||
{
|
||||
// Dummy has every language available.
|
||||
return true;
|
||||
} else {
|
||||
if(has_language(localename)) {
|
||||
return true;
|
||||
} else {
|
||||
foreach(const std::string& lang, alternates) {
|
||||
if(has_language(lang)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
symbol_table string_table;
|
||||
|
||||
const t_string& symbol_table::operator[](const std::string& key) const
|
||||
|
@ -210,37 +149,6 @@ static void wesnoth_setlocale(int category, std::string const &slocale,
|
|||
|
||||
std::string extra;
|
||||
|
||||
#ifdef USE_DUMMYLOCALES
|
||||
if (game_config::use_dummylocales)
|
||||
{
|
||||
static enum { UNINIT, NONE, PRESENT } status = UNINIT;
|
||||
static std::string locpath;
|
||||
if (status == UNINIT) {
|
||||
if (char const *p = getenv("LOCPATH")) {
|
||||
locpath = p;
|
||||
status = PRESENT;
|
||||
} else status = NONE;
|
||||
}
|
||||
if (locale.empty())
|
||||
if (status == NONE)
|
||||
unsetenv("LOCPATH");
|
||||
else
|
||||
setenv("LOCPATH", locpath.c_str(), 1);
|
||||
else {
|
||||
std::string path = game_config::path + "/locales";
|
||||
setenv("LOCPATH", path.c_str(), 1);
|
||||
DBG_G << "LOCPATH set to '" << path << "'\n";
|
||||
}
|
||||
std::string xlocale;
|
||||
if (!locale.empty()) {
|
||||
// dummy suffix to prevent locale aliasing from kicking in
|
||||
extra = "@wesnoth";
|
||||
xlocale = locale + "@wesnoth";
|
||||
locale = xlocale.c_str();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
char *res = NULL;
|
||||
std::vector<std::string>::const_iterator i;
|
||||
if (alternates) i = alternates->begin();
|
||||
|
|
|
@ -55,13 +55,6 @@ struct language_def
|
|||
bool operator== (const language_def&) const;
|
||||
bool operator< (const language_def& a) const
|
||||
{ return sort_name < a.sort_name; }
|
||||
|
||||
/**
|
||||
* Is the locale available on the system?
|
||||
*
|
||||
* If the dummy locales are selected we always return true.
|
||||
*/
|
||||
bool available() const;
|
||||
};
|
||||
|
||||
typedef std::vector<language_def> language_list;
|
||||
|
|
|
@ -56,7 +56,6 @@ struct wesnoth_global_fixture {
|
|||
wesnoth_global_fixture()
|
||||
{
|
||||
// lg::set_log_domain_severity("all",3);
|
||||
game_config::use_dummylocales = true;
|
||||
game_config::path = get_cwd();
|
||||
|
||||
|
||||
|
|
|
@ -10,14 +10,12 @@
|
|||
* before and after each release.
|
||||
*/
|
||||
|
||||
// without this ifdef DUMMYLOCALES break, so leave it in even though is seems
|
||||
// to not have any real purpose...
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#else
|
||||
# ifndef LOCALEDIR
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifndef LOCALEDIR
|
||||
# define LOCALEDIR "translations"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
//always use the version string in here, otherwise autotools can override in
|
||||
|
|
Loading…
Add table
Reference in a new issue