The Battle for Wesnoth  1.19.0-dev
Macros | Functions | Variables
language.cpp File Reference
#include "filesystem.hpp"
#include "gettext.hpp"
#include "language.hpp"
#include "log.hpp"
#include "preferences/general.hpp"
#include "serialization/parser.hpp"
#include "serialization/preprocessor.hpp"
#include "game_config_manager.hpp"
#include <clocale>
Include dependency graph for language.cpp:

Go to the source code of this file.

Macros

#define DBG_G   LOG_STREAM(debug, lg::general())
 
#define LOG_G   LOG_STREAM(info, lg::general())
 
#define WRN_G   LOG_STREAM(warn, lg::general())
 
#define ERR_G   LOG_STREAM(err, lg::general())
 

Functions

bool load_strings (bool complain)
 
bool current_language_rtl ()
 
bool & time_locale_correct ()
 
bool load_language_list ()
 
language_list get_languages (bool all)
 Return a list of available translations. More...
 
int get_min_translation_percent ()
 
void set_min_translation_percent (int percent)
 
static void wesnoth_setlocale (int category, const std::string &slocale, std::vector< std::string > const *alternates)
 
void set_language (const language_def &locale)
 
const language_defget_language ()
 
const language_defget_locale ()
 
void init_textdomains (const game_config_view &cfg)
 Initializes the list of textdomains from a configuration object. More...
 
bool init_strings (const game_config_view &cfg)
 Initializes certain English strings. More...
 

Variables

static language_list known_languages
 
symbol_table string_table
 

Macro Definition Documentation

◆ DBG_G

#define DBG_G   LOG_STREAM(debug, lg::general())

Definition at line 38 of file language.cpp.

◆ ERR_G

#define ERR_G   LOG_STREAM(err, lg::general())

Definition at line 41 of file language.cpp.

◆ LOG_G

#define LOG_G   LOG_STREAM(info, lg::general())

Definition at line 39 of file language.cpp.

◆ WRN_G

#define WRN_G   LOG_STREAM(warn, lg::general())

Definition at line 40 of file language.cpp.

Function Documentation

◆ current_language_rtl()

bool current_language_rtl ( )

Definition at line 54 of file language.cpp.

References get_language(), and language_def::rtl.

Referenced by gui::menu::draw_row(), and gui::menu::hit_on_indent_or_icon().

◆ get_language()

const language_def& get_language ( )

◆ get_languages()

language_list get_languages ( bool  all = false)

Return a list of available translations.

The list will normally be filtered with incomplete (according to min_translation_percent) translations removed.

Parameters
allif true, include incomplete translations
Precondition
load_language_list() has already been called

Definition at line 126 of file language.cpp.

References known_languages.

Referenced by test_utils::game_config_manager::game_config_manager(), game_launcher::init_language(), and gui2::dialogs::title_screen::update_static_labels().

◆ get_locale()

const language_def& get_locale ( )

◆ get_min_translation_percent()

int get_min_translation_percent ( )

Definition at line 143 of file language.cpp.

Referenced by gui2::dialogs::language_selection::language_selection().

◆ init_strings()

bool init_strings ( const game_config_view cfg)

Initializes certain English strings.

Definition at line 394 of file language.cpp.

References game_config_view::child_range(), and load_strings().

Referenced by game_config_manager::load_game_config().

◆ init_textdomains()

void init_textdomains ( const game_config_view cfg)

◆ load_language_list()

bool load_language_list ( )

◆ load_strings()

bool load_strings ( bool  complain)

Definition at line 308 of file language.cpp.

References DBG_G, LOG_G, and PLAIN_LOG.

Referenced by init_strings(), and set_language().

◆ set_language()

void set_language ( const language_def locale)

◆ set_min_translation_percent()

void set_min_translation_percent ( int  percent)

Definition at line 148 of file language.cpp.

Referenced by game_launcher::game_launcher().

◆ time_locale_correct()

bool& time_locale_correct ( )

Definition at line 66 of file language.cpp.

Referenced by set_language(), and wesnoth_setlocale().

◆ wesnoth_setlocale()

static void wesnoth_setlocale ( int  category,
const std::string &  slocale,
std::vector< std::string > const *  alternates 
)
static

Definition at line 213 of file language.cpp.

References DBG_G, i, LOG_G, time_locale_correct(), and WRN_G.

Referenced by set_language().

Variable Documentation

◆ known_languages

language_list known_languages
static

Definition at line 50 of file language.cpp.

Referenced by get_languages(), get_locale(), and load_language_list().

◆ string_table

symbol_table string_table