The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Namespaces | Macros | Functions
gettext.hpp File Reference
#include "wesconfig.h"
#include <string>
#include <vector>
Include dependency graph for gettext.hpp:

Go to the source code of this file.

Namespaces

 translation
 

Macros

#define GETTEXT_DOMAIN   PACKAGE
 How to use gettext for wesnoth source files:

  1. include this header file in the .cpp file
  2. make sure, that the source file is listed in the respective POTFILES.in for the textdomain, in the case of wesnoth-lib it is this file: po/wesnoth-lib/POTFILES.in
  3. add the following include to set the correct textdomain, in this example wesnoth-lib (not required for the domain 'wesnoth', required for all other textdomains).
More...
 
#define UNUSEDNOWARN
 
#define gettext_noop(String)   String
 
#define N_(String)   gettext_noop (String)
 

Functions

std::string translation::dgettext (const char *domain, const char *msgid)
 
std::string translation::egettext (char const *msgid)
 
std::string translation::dsgettext (const char *domainname, const char *msgid)
 
std::string translation::dsngettext (const char *domainname, const char *singular, const char *plural, int n)
 
static UNUSEDNOWARN std::string translation::gettext (const char *str)
 
static UNUSEDNOWARN std::string translation::sgettext (const char *str)
 
static UNUSEDNOWARN std::string translation::sngettext (const char *str1, const char *str2, int n)
 
void translation::bind_textdomain (const char *domain, const char *directory, const char *encoding)
 
void translation::set_default_textdomain (const char *domain)
 
void translation::set_language (const std::string &slocale, const std::vector< std::string > *alternates)
 
void translation::init ()
 
int translation::compare (const std::string &s1, const std::string &s2)
 
static UNUSEDNOWARN std::string _ (const char *str)
 
static UNUSEDNOWARN std::string _n (const char *str1, const char *str2, int n)
 

Macro Definition Documentation

#define GETTEXT_DOMAIN   PACKAGE

How to use gettext for wesnoth source files:

  1. include this header file in the .cpp file
  2. make sure, that the source file is listed in the respective POTFILES.in for the textdomain, in the case of wesnoth-lib it is this file: po/wesnoth-lib/POTFILES.in
  3. add the following include to set the correct textdomain, in this example wesnoth-lib (not required for the domain 'wesnoth', required for all other textdomains).

1 #define GETTEXT_DOMAIN "wesnoth-lib"

This should be all that is required to have your strings that are marked translatable in the po files and translated ingame. So you at least have to mark the strings translatable, too. ;)

Definition at line 42 of file gettext.hpp.

Referenced by _(), _n(), translation::gettext(), translation::sgettext(), and translation::sngettext().

#define gettext_noop (   String)    String

Definition at line 89 of file gettext.hpp.

#define N_ (   String)    gettext_noop (String)
#define UNUSEDNOWARN

Definition at line 53 of file gettext.hpp.

Function Documentation

static UNUSEDNOWARN std::string _ ( const char *  str)
inlinestatic

Definition at line 82 of file gettext.hpp.

References translation::dsgettext(), and GETTEXT_DOMAIN.

Referenced by statistics_dialog::action(), dialogs::file_dialog::action(), ad_hoc_addon_fetch_session(), gui2::tpreferences::add_friend_list_entry(), gui2::tpreferences::add_hotkey_callback(), add_next_page_item(), add_prev_page_item(), editor::location_palette::adjust_size(), dialogs::advance_unit_dialog(), editor::context_manager::apply_mask_dialog(), attack_info(), savegame::autosave_savegame::autosave_savegame(), battle_context::battle_context(), battle_prediction_pane::battle_prediction_pane(), help::best_str(), gui2::tlua_interpreter::controller::bind(), gui2::tchat_log::view::bind(), gui2::tgamestate_inspector::view::bind(), BOOST_AUTO_TEST_CASE(), gui2::implementation::tbuilder_slider::build(), attack_prediction_displayer::button_pressed(), events::chat_handler::change_logging(), check_error(), savegame::savegame::check_filename(), savegame::savegame::check_overwrite(), mp::check_response(), editor::context_manager::check_switch_open_map(), savegame::loadgame::check_version_compatibility(), battle_context::choose_defender_weapon(), gui2::tgame_cache_options::clean_cache_callback(), savegame::clean_saves(), game_config::color_info(), events::map_command_handler< chat_command_handler >::command_failed(), mp::configure::configure(), editor::context_manager::confirm_discard(), mp::connect::connect(), ng::connect_engine::connect_engine(), pathfind::shortest_path_calculator::cost(), mp::create::create(), savegame::ingame_savegame::create_filename(), savegame::replay_savegame::create_filename(), savegame::autosave_savegame::create_filename(), editor::context_manager::create_mask_to_dialog(), windows_tray_notification::create_tray_icon(), editor::editor_controller::custom_tods_dialog(), default_map_generator_job::default_generate_map(), gui2::tpreferences::default_hotkey_callback(), quit_confirmation::default_prompt(), attack_type::describe_modification(), gui2::describe_status_simple(), gui2::describe_status_verbose(), ng::user_map::description(), gui::dialog::dialog(), events::map_command_handler< chat_command_handler >::dispatch(), statistics_dialog::display_stats(), addon_info::display_type(), events::menu_handler::do_ai_formula(), events::console_handler::do_choose_level(), events::console_handler::do_create(), events::console_handler::do_debug(), events::chat_command_handler::do_drop(), events::chat_command_handler::do_friend(), playmp_controller::do_idle_notification(), events::chat_command_handler::do_ignore(), events::chat_command_handler::do_info(), events::console_handler::do_layers(), events::console_handler::do_nodebug(), events::menu_handler::do_recruit(), events::chat_command_handler::do_register(), events::chat_command_handler::do_remove(), events::chat_command_handler::do_set(), events::console_handler::do_set_var(), events::console_handler::do_toggle_whiteboard(), events::console_handler::do_undiscover(), events::console_handler::do_unsafe_lua(), events::chat_command_handler::do_version(), mp::wait::download_level_data(), mp::wait::leader_preview_pane::draw_contents(), editor::editor_palette< Item >::draw_contents(), dialogs::unit_preview_pane::draw_contents(), mp::gamebrowser::draw_contents(), mp::gamebrowser::draw_row(), events::menu_handler::end_turn(), enter_configure_mode(), sp::enter_create_mode(), gui2::tgame_load::evaluate_summary_string(), hotkey::execute_command(), editor::context_manager::expand_areas_menu(), play_controller::hotkey_handler::expand_autosaves(), editor::context_manager::expand_load_mru_menu(), editor::context_manager::expand_open_maps_menu(), editor::editor_palette< Item >::expand_palette_groups_menu(), editor::context_manager::expand_sides_menu(), dialogs::file_dialog::file_dialog(), actions::find_recall_location(), actions::find_recruit_location(), savegame::savegame::finish_save_game(), gui2::format_stats(), savegame::save_info::format_time_local(), util::format_time_summary(), mp_ui_alerts::game_has_begun(), game_info::game_info(), help::generate_ability_topics(), help::generate_era_topics(), help::generate_faction_topics(), editor::context_manager::generate_map_dialog(), mp::wait::generate_menu(), help::generate_races_sections(), help::generate_unit_topics(), mp::generate_user_description(), help::generate_weapon_special_topics(), preferences::get_chat_timestamp(), mp::get_color_string(), events::chat_command_handler::get_command_flags_description(), events::console_handler::get_command_flags_description(), get_connection_details(), game_config::get_default_title_string(), events::chat_command_handler::get_flags_description(), events::console_handler::get_flags_description(), editor::terrain_palette::get_help_string(), mp::get_income_string(), image::get_localized_path(), gui2::get_max_autosaves_status_label(), battle_prediction_pane::get_unit_strings(), mp::handle_addon_requirements_gui(), help::help_browser::handle_event(), mp::ui::handle_event(), events::map_command_handler< chat_command_handler >::help(), events::map_command_handler< chat_command_handler >::help_command(), play_controller::init(), ng::create_engine::init_all_levels(), events::chat_command_handler::init_map(), events::console_handler::init_map(), events::map_command_handler< chat_command_handler >::init_map_default(), gui2::tpreferences::initialize_tabs(), intf_synchronize_choice(), intf_synchronize_choices(), mp::wait::join_game(), gui2::twindow::layout(), playsingle_controller::hotkey_handler::load_autosave(), savegame::loadgame::load_game(), game_launcher::load_game(), game_config_manager::load_game_config(), editor::context_manager::load_map(), editor::context_manager::load_map_dialog(), savegame::loadgame::load_multiplayer_game(), gui2::load_settings(), mp::lobby::lobby(), preferences::login(), editor::editor_controller::main_loop(), ng::depcheck::MAKE_ENUM(), gui2::tlobby_main::make_game_row_data(), editor::map_context::map_context(), hotkey::command_executor_default::map_screenshot(), ng::scenario::map_size(), editor::editor_map::mask_to(), editor::context_manager::modified_maps(), events::mouse_handler::move_unit_along_route(), dialogs::network_connect_dialog(), dialogs::network_receive_dialog(), ng::side_engine::new_config(), open_connection(), help::terrain_topic_generator::operator()(), help::unit_topic_generator::operator()(), savegame::save_info_less_time::operator()(), game_config::optional_features_table(), wb::manager::options_dlg(), desktop::os_version(), campaign_controller::play_game(), playmp_controller::play_human_turn(), game_launcher::play_multiplayer(), playsingle_controller::play_scenario(), playsingle_controller::play_scenario_init(), mp_ui_alerts::player_joins(), mp_ui_alerts::player_leaves(), mp::gamebrowser::populate_game_item(), mp::gamebrowser::populate_game_item_campaign_or_scenario_info(), mp::gamebrowser::populate_game_item_era_info(), mp::gamebrowser::populate_game_item_mod_info(), gui2::tmp_create_game::pre_show(), gui2::tmp_alerts_options::pre_show(), gui2::teditor_set_starting_position::pre_show(), gui2::tlobby_player_info::pre_show(), gui2::tscreenshot_notification::pre_show(), gui2::taddon_list::pre_show(), gui2::taddon_description::pre_show(), gui2::tgame_cache_options::pre_show(), gui2::tpreferences::pre_show(), gui2::twml_error::pre_show(), gui2::tgame_version::pre_show(), gui2::ttitle_screen::pre_show(), gui2::tnetwork_transmission::pump_monitor::process(), mp::create::process_event_impl(), mp::configure::process_event_impl(), mp::lobby::process_event_impl(), mp::wait::process_network_data(), turn_info::process_network_data(), playmp_controller::process_oos(), play_controller::process_oos(), gui2::tgame_cache_options::purge_cache_callback(), game_events::t_pump::put_wml_message(), editor::editor_controller::quit_confirm(), gui2::twindow_builder::read(), mp_ui_alerts::ready_for_start(), replay_controller::rebuild_replay_theme(), events::menu_handler::recall(), dialogs::recall_dialog(), events::menu_handler::recruit(), dialogs::recruit_dialog(), reformat(), gui2::tpreferences::remove_friend_list_entry(), savegame::remove_old_auto_saves(), REPORT_GENERATOR(), campaign_controller::report_victory(), addons_client::request_addons_list(), addons_client::request_distribution_terms(), ng::flg_manager::reset_gender_combo(), ng::flg_manager::reset_leader_combo(), ng::flg_manager::resolve_random(), savegame::savegame::save_game(), events::menu_handler::save_map(), editor::map_context::save_map(), editor::context_manager::save_map_as(), editor::context_manager::save_map_as_dialog(), editor::context_manager::save_scenario_as(), editor::context_manager::save_scenario_as_dialog(), events::menu_handler::scenario_settings_table(), events::menu_handler::search(), gui2::tcustom_tod::select_file(), preferences::server_list(), mp::create::set_description(), gui2::tunit_preview_pane::set_displayed_type(), font::ttext::set_markup_helper(), ng::scenario::set_metadata(), editor::context_manager::set_window_title(), gui2::tpreferences::setup_friends_list(), gui2::tpreferences::setup_hotkey_list(), storyscreen::controller::show(), twml_exception::show(), about::show_about(), events::mouse_handler::show_attack_dialog(), hotkey::show_binding_dialog(), campaign_controller::show_carryover_message(), savegame::loadgame::show_dialog(), gui2::show_error_message(), help::show_help(), gui2::show_message(), dialogs::show_objectives(), quit_confirmation::show_prompt(), events::menu_handler::show_statistics(), preferences::show_theme_dialog(), gui2::show_transient_error_message(), playsingle_controller::show_turn_dialog(), dialogs::show_unit_list(), preferences::show_wesnothd_server_search(), utils::si_string(), gui2::tlabel::signal_handler_left_button_click(), gui2::tlabel::signal_handler_right_button_click(), size_display_string(), events::menu_handler::speak(), help::split_in_width(), statistics_dialog::statistics_dialog(), gui2::taddon_filter_options::status_label(), events::menu_handler::status_table(), t_translation::string_to_layer_(), theme::tborder::tborder(), gui2::implementation::tbuilder_control::tbuilder_control(), gui2::tbuilder_grid::tbuilder_grid(), gui2::implementation::tbuilder_horizontal_listbox::tbuilder_horizontal_listbox(), gui2::implementation::tbuilder_listbox::tbuilder_listbox(), gui2::implementation::tbuilder_multi_page::tbuilder_multi_page(), gui2::implementation::tbuilder_pane::tbuilder_pane(), gui2::implementation::tbuilder_panel::tbuilder_panel(), gui2::implementation::tbuilder_scrollbar_panel::tbuilder_scrollbar_panel(), gui2::implementation::tbuilder_stacked_widget::tbuilder_stacked_widget(), gui2::implementation::tbuilder_toggle_panel::tbuilder_toggle_panel(), gui2::implementation::tbuilder_tree_view::tbuilder_tree_view(), gui2::tcontrol_definition::tcontrol_definition(), gui2::tdepcheck_select_new::tdepcheck_select_new(), terrain_type::terrain_type(), the_end(), time_of_day_at(), gui2::tlabel_settings::tlabel_settings(), play_controller::hotkey_handler::toggle_accelerated_speed(), theme::action::tooltip(), gui2::tscrollbar_panel_definition::tresolution::tresolution(), gui2::tunit_preview_pane_definition::tresolution::tresolution(), gui2::tscroll_label_definition::tresolution::tresolution(), gui2::tstacked_widget_definition::tresolution::tresolution(), gui2::twindow_builder::tresolution::tresolution(), gui2::ttree_view_definition::tresolution::tresolution(), gui2::tmulti_page_definition::tresolution::tresolution(), gui2::tlistbox_definition::tresolution::tresolution(), gui2::tscreenshot_notification::tscreenshot_notification(), gui2::tstate_definition::tstate_definition(), gui2::implementation::ttree_node::ttree_node(), gui2::ttree_view_node::ttree_view_node(), mp_ui_alerts::turn_changed(), gui2::twml_error::twml_error(), unit_abilities(), unit_alignment(), unit_box_at(), unit_defense(), unit_type::unit_description(), unit_hp(), unit_level(), unit_moves(), unit_name(), unit_race(), unit_traits(), unit_type(), unit_vision(), unit_weapons(), unit_xp(), gui2::tgame_cache_options::update_cache_size_display(), ng::side_engine::update_controller_options(), gui2::tcampaign_settings::update_lists(), mp::connect::update_playerlist_state(), gui2::tlobby_player_info::update_relation(), mp::connect::side::update_ui(), default_map_generator::user_config(), vgettext(), addons_client::wait_for_transfer_done(), playmp_controller::wait_for_upload(), playsingle_controller::hotkey_handler::whiteboard_toggle(), font::word_wrap_text(), savegame::savegame::write_game_to_disk(), editor::context_manager::write_map(), editor::context_manager::write_scenario(), and map_location::write_translated_direction().

static UNUSEDNOWARN std::string _n ( const char *  str1,
const char *  str2,
int  n 
)
inlinestatic