16#define GETTEXT_DOMAIN "wesnoth-lib"
35const std::string translations_wiki_url =
"https://wiki.wesnoth.org/WesnothTranslations";
37const std::string translations_stats_url =
"https://gettext.wesnoth.org/";
46 , complete_langs_(langs_.size())
53 for(std::size_t
i = 0;
i < langs_.size(); ++
i) {
54 if(langs_[
i] == current_language) {
58 complete_langs_[
i] =
true;
67 register_bool(
"show_all",
true, [show_all]() {
return show_all; });
69 register_label(
"contrib_url",
true, translations_wiki_url,
true);
70 register_label(
"stats_url",
true, translations_stats_url,
true);
75 toggle_button& show_all_toggle = find_widget<toggle_button>(
"show_all");
76 listbox& list = find_widget<listbox>(
"language_list");
79 boost::dynamic_bitset<> mask;
80 mask.resize(
langs_.size(),
true);
89 listbox& list = find_widget<listbox>(
"language_list");
92 toggle_button& show_all_toggle = find_widget<toggle_button>(
"show_all");
93 connect_signal_mouse_left_click(show_all_toggle, std::bind(
105 for(
const auto& lang :
langs_) {
112 {
"label", std::move(lang_label) },
113 {
"use_markup",
"true" }
115 {
"translated_total", {
118 lang.localename.empty() ?
"" :
121 {
"use_markup",
"true" }
125 if(lang == current_language) {
138 const int res = find_widget<listbox>(
"language_list")
boost::dynamic_bitset complete_langs_
virtual void post_show() override
Actions to be taken after the window has been shown.
virtual void pre_show() override
Actions to be taken before showing the window.
const std::vector< language_def > langs_
void shown_filter_callback()
Abstract base class for all modal dialogs.
bool select_last_row(const bool select=true)
Does exactly as advertised: selects the list's last row.
void set_row_shown(const unsigned row, const bool shown)
Makes a row visible or invisible.
grid & add_row(const widget_item &item, const int index=-1)
When an item in the list is selected by the user we need to update the state.
bool get_value_bool() const
void keyboard_capture(widget *widget)
std::vector< language_def > get_languages(bool all)
Return a list of available translations.
const language_def & get_language()
int get_min_translation_percent()
void set_language(const language_def &locale)
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
color_t red_to_green(double val, bool for_text)
Return a color corresponding to the value val red for val=0.0 to green for val=100....
std::map< std::string, widget_item > widget_data
@ OK
Dialog was closed with the OK button.
std::string span_color(const color_t &color, Args &&... data)
Applies Pango markup to the input specifying its display color.
std::string tag(std::string_view tag, Args &&... data)
Wraps the given data in the specified tag.