void tlanguage_selection::pre_show(CVideo& /*video*/, twindow& window)
{
	window.set_canvas_variable("border", variant("default-border"));

	tlistbox& list = find_widget<tlistbox>(&window, "language_list", false);
	window.keyboard_capture(&list);

	const std::vector<language_def>& languages = get_languages();
	const language_def& current_language = get_language();
	std::stringstream strstr;
	int number = hero::number_normal_min;
	BOOST_FOREACH (const language_def& lang, languages) {
		string_map list_item;
		std::map<std::string, string_map> list_item_item;

		strstr.str("");
		strstr << "hero-64/" << number << ".png";
		list_item["label"] = strstr.str();
		list_item_item.insert(std::make_pair("icon", list_item));

		list_item["label"] = lang.language;
		list_item_item.insert(std::make_pair("name", list_item));

		list.add_row(list_item_item);

		if (lang == current_language) {
			list.select_row(list.get_item_count() - 1);
		}
		number ++;
	}
Esempio n. 2
0
bool game_launcher::init_language()
{
	if(!::load_language_list())
		return false;

	language_def locale;
	if(cmdline_opts_.language) {
		std::vector<language_def> langs = get_languages();
		for(const language_def & def : langs) {
			if(def.localename == *cmdline_opts_.language) {
				locale = def;
				break;
			}
		}
		if(locale.localename.empty()) {
			std::cerr << "Language symbol '" << *cmdline_opts_.language << "' not found.\n";
			return false;
		}
	} else {
		locale = get_locale();
	}
	::set_language(locale);

	return true;
}
Esempio n. 3
0
	std::string langcode_to_string(const std::string& lcode)
	{
		for(const auto & ld : get_languages())
		{
			if(ld.localename == lcode || ld.localename.substr(0, 2) == lcode) {
				return ld.language;
			}
		}

		return "";
	}
Esempio n. 4
0
void tlanguage_selection::post_show(twindow& window)
{
	if(get_retval() == twindow::OK) {
		const int res = find_widget<tlistbox>(&window, "language_list", false)
								.get_selected_row();

		assert(res != -1);

		const std::vector<language_def>& languages = get_languages();
		::set_language(languages[res]);
		preferences::set_language(languages[res].localename);
	}
}
Esempio n. 5
0
		game_config_manager()
			: cfg_()
			, paths_manager_()
			, hotkey_manager_()
			, font_manager_()
		{
#ifdef _WIN32
			std::setlocale(LC_ALL, "English");
#else
			std::setlocale(LC_ALL, "C");
			std::setlocale(LC_MESSAGES, "");
#endif
			const std::string& intl_dir = get_intl_dir();
			bindtextdomain ("wesnoth", intl_dir.c_str());
			bind_textdomain_codeset ("wesnoth", "UTF-8");
			bindtextdomain ("wesnoth-lib", intl_dir.c_str());
			bind_textdomain_codeset ("wesnoth-lib", "UTF-8");
			textdomain ("wesnoth");


			font::load_font_config();
			gui2::init();
			load_language_list();
			game_config::config_cache::instance().add_define("TEST");
			game_config::config_cache::instance().get_config(game_config::path + "/data/test/", cfg_);
			::init_textdomains(cfg_);
			const std::vector<language_def>& languages = get_languages();
			std::vector<language_def>::const_iterator English = std::find_if(languages.begin(),
					languages.end(),
					match_english); // Using German because the most active translation
			::set_language(*English);

			cfg_.merge_children("units");

			const config* const units = cfg_.child("units");
			if(units != NULL) {
				unit_type_data::types().set_config(*units);
			}

			game_config::load_config(cfg_.child("game_config"));
			hotkey::deactivate_all_scopes();
			hotkey::set_scope_active(hotkey::SCOPE_GENERAL);
			hotkey::set_scope_active(hotkey::SCOPE_GAME);

			hotkey::load_hotkeys(cfg_);
			paths_manager_.set_paths(cfg_);
			font::load_font_config();

		}
void tlanguage_selection::pre_show(CVideo& /*video*/, twindow& window)
{
	tlistbox& list = find_widget<tlistbox>(&window, "language_list", false);
	window.keyboard_capture(&list);

	const std::vector<language_def>& languages = get_languages();
	const language_def& current_language = get_language();
	FOREACH(const AUTO& lang, languages) {
		string_map item;
		item.insert(std::make_pair("label", lang.language));

		list.add_row(item);
		if(lang == current_language) {
			list.select_row(list.get_item_count() - 1);
		}
	}
Esempio n. 7
0
void sync_enter_ui(void) 
{
	StatusBar_Trans();

	// 保留给将来使用按钮,当前版本全都灰掉
	ToolBar_EnableButton(gdmgr._htb_sync, IDM_REFRESH, TRUE);
	ToolBar_EnableButton(gdmgr._htb_sync, IDM_SYNC_SYNC, FALSE);

	HWND hctl = GetDlgItem(gdmgr._htb_sync, IDC_CMB_SYNC_LANGUAGE);
	ComboBox_ResetContent(hctl);
	const std::vector<language_def>& languages = get_languages();
	const language_def& current_language = get_language();
	BOOST_FOREACH (const language_def& lang, languages) {
		ComboBox_AddString(hctl, utf8_2_ansi(lang.language.c_str()));
		if (lang == current_language) {
			ComboBox_SetCurSel(hctl, ComboBox_GetCount(hctl) - 1);
		}
	}