本文整理汇总了C++中tinygettext::DictionaryManager::get_language方法的典型用法代码示例。如果您正苦于以下问题:C++ DictionaryManager::get_language方法的具体用法?C++ DictionaryManager::get_language怎么用?C++ DictionaryManager::get_language使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tinygettext::DictionaryManager
的用法示例。
在下文中一共展示了DictionaryManager::get_language方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
PingusMain::print_greeting_message()
{
std::string greeting = "Welcome to Pingus 0.7.6"/*VERSION*/;
greeting += "!";
std::cout << greeting << std::endl;
for (unsigned int i = 0; i < greeting.length(); ++i)
std::cout.put('=');
std::cout << std::endl;
std::cout << "userdir: " << System::get_userdir() << std::endl;
std::cout << "datadir: " << g_path_manager.get_path() << std::endl;
std::cout << "language: "
<< dictionary_manager.get_language().get_name()
<< " ("
<< dictionary_manager.get_language().str()
<< ")"
<< std::endl;
if (globals::sound_enabled)
std::cout << "sound support: enabled" << std::endl;
else
std::cout << "sound support: disabled" << std::endl;
if (globals::music_enabled)
std::cout << "music support: enabled" << std::endl;
else
std::cout << "music support: disabled" << std::endl;
std::cout << "fullscreen: ";
if (cmd_options.fullscreen.is_set() && cmd_options.fullscreen.get())
{
std::cout << cmd_options.fullscreen_resolution.get().width << "x"
<< cmd_options.fullscreen_resolution.get().height << std::endl;
}
else
{
std::cout << "disabled" << std::endl;
}
std::cout << std::endl;
}
示例2: I18N_SetLanguage
/**
* @brief Loads a localization file
* @param[in] language
*/
void I18N_SetLanguage(const char *language)
{
// TODO: check if there is a localization file available for the selected language
dictionary.set_language(tinygettext::Language::from_env(std::string(language)));
dictionary_mod.set_language(tinygettext::Language::from_env(std::string(language)));
Com_Printf("Language set to %s\n", dictionary.get_language().get_name().c_str());
Com_sprintf(cl_lang_last, sizeof(cl_lang_last), "%s", language);
if (!Q_stricmp(cl_lang->string, "en"))
{
doTranslate = qfalse;
}
else
{
doTranslate = qtrue;
}
strings.clear();
}
示例3:
tinygettext::Language
ConfigManager::get_language() const
{
return dictionary_manager.get_language();
}
示例4: background
OptionMenu::OptionMenu() :
background(),
ok_button(),
x_pos(),
y_pos(),
options(),
fullscreen_box(),
swcursor_box(),
autoscroll_box(),
mousegrab_box(),
printfps_box(),
master_volume_box(),
sound_volume_box(),
music_volume_box(),
defaults_label(),
defaults_box(),
connections(),
language(),
language_map()
{
background = Sprite("core/menu/optionmenu");
gui_manager->add(ok_button = new OptionMenuCloseButton(this,
Display::get_width()/2 + 225,
Display::get_height()/2 + 125));
x_pos = 0;
y_pos = 0;
int resolutions[][2] = {
{ 640, 480 }, // 4:3, VGA
{ 768, 576 }, // 4:3, PAL
{ 800, 480 }, // Nokia N770, N800
{ 800, 600 }, // 4:3, SVGA
{ 1024, 768 }, // 4:3, XGA
{ 1152, 864 }, // 4:3
{ 1280, 720 }, // 16:9, HD-TV, 720p
{ 1280, 960 }, // 4:3
{ 1280, 1024 }, // 5:4
{ 1366, 768 }, // ~16:9, Wide XGA
{ 1440, 900, }, // 16:10
{ 1600, 1200 }, // 4:3, UXGA
{ 1680, 1050 }, // 16:10, WSXGA
{ 1920, 1080 }, // 16:9, HD-TV, 1080p
{ 1920, 1200 }, // 16:10
{ -1, -1 }
};
int current_choice = -1;
int n;
ChoiceBox* resolution_box = new ChoiceBox(Rect());
for (n = 0; resolutions[n][0] != -1; ++n)
{
std::ostringstream ostr;
ostr << resolutions[n][0] << "x" << resolutions[n][1];
resolution_box->add_choice(ostr.str());
if (Display::get_width() == resolutions[n][0] &&
Display::get_height() == resolutions[n][1])
{
current_choice = n;
}
}
resolution_box->add_choice("Custom");
if (current_choice == -1)
current_choice = n;
resolution_box->set_current_choice(current_choice);
tinygettext::Language current_language = dictionary_manager.get_language();
language = current_language;
n = 0;
ChoiceBox* language_box = new ChoiceBox(Rect());
std::set<tinygettext::Language> languages = dictionary_manager.get_languages();
for (std::set<tinygettext::Language>::iterator i = languages.begin(); i != languages.end(); ++i)
{
language_box->add_choice(i->str());
if (current_language == *i)
language_box->set_current_choice(current_choice);
}
ChoiceBox* scroll_box = new ChoiceBox(Rect());
scroll_box->add_choice("Drag&Drop");
scroll_box->add_choice("Rubberband");
swcursor_box = new CheckBox(Rect());
fullscreen_box = new CheckBox(Rect());
autoscroll_box = new CheckBox(Rect());
mousegrab_box = new CheckBox(Rect());
printfps_box = new CheckBox(Rect());
master_volume_box = new SliderBox(Rect());
sound_volume_box = new SliderBox(Rect());
music_volume_box = new SliderBox(Rect());
C(swcursor_box->on_change.connect(std::bind(&OptionMenu::on_swcursor_change, this, std::placeholders::_1)));
C(fullscreen_box->on_change.connect(std::bind(&OptionMenu::on_fullscreen_change, this, std::placeholders::_1)));
C(autoscroll_box->on_change.connect(std::bind(&OptionMenu::on_autoscroll_change, this, std::placeholders::_1)));
C(mousegrab_box->on_change.connect(std::bind(&OptionMenu::on_mousegrab_change, this, std::placeholders::_1)));
C(printfps_box->on_change.connect(std::bind(&OptionMenu::on_printfps_change, this, std::placeholders::_1)));
//.........这里部分代码省略.........
示例5: options
OptionMenu::OptionMenu() :
m_background("core/menu/wood"),
m_blackboard("core/menu/blackboard"),
ok_button(),
x_pos(),
y_pos(),
options(),
fullscreen_box(),
software_cursor_box(),
autoscroll_box(),
dragdrop_scroll_box(),
mousegrab_box(),
printfps_box(),
master_volume_box(),
sound_volume_box(),
music_volume_box(),
//defaults_label(),
//defaults_box(),
connections(),
m_language(),
m_language_map()
{
gui_manager->add(ok_button = new OptionMenuCloseButton(this,
Display::get_width()/2 + 245,
Display::get_height()/2 + 150));
x_pos = 0;
y_pos = 0;
ChoiceBox* resolution_box = new ChoiceBox(Rect());
{
std::vector<SDL_DisplayMode> resolutions = Display::get_fullscreen_video_modes();
Size fullscreen = config_manager.get_fullscreen_resolution();
int choice = static_cast<int>(resolutions.size()) - 1;
for (auto it = resolutions.begin(); it != resolutions.end(); ++it)
{
// add resolution to the box
std::ostringstream ostr;
ostr << it->w << "x" << it->h << "@" << it->refresh_rate;
resolution_box->add_choice(ostr.str());
// FIXME: ignoring refresh_rate
if (fullscreen.width == it->w &&
fullscreen.height == it->h)
{
choice = static_cast<int>(it - resolutions.begin());
}
}
resolution_box->set_current_choice(choice);
}
ChoiceBox* renderer_box = new ChoiceBox(Rect());
renderer_box->add_choice("sdl");
renderer_box->add_choice("delta");
renderer_box->add_choice("opengl");
switch(config_manager.get_renderer())
{
case SDL_FRAMEBUFFER: renderer_box->set_current_choice(0); break;
case DELTA_FRAMEBUFFER: renderer_box->set_current_choice(1); break;
case OPENGL_FRAMEBUFFER: renderer_box->set_current_choice(2); break;
default: assert(!"unknown renderer type");
}
m_language = dictionary_manager.get_language();
ChoiceBox* language_box = new ChoiceBox(Rect());
{
std::set<tinygettext::Language> languages = dictionary_manager.get_languages();
// English is the default language, thus it's not in the list of
// languages returned by tinygettext and we have to add it manually
languages.insert(tinygettext::Language::from_name("en"));
std::vector<tinygettext::Language> langs(languages.begin(), languages.end());
std::sort(langs.begin(), langs.end(), LanguageSorter());
for (auto i = langs.begin(); i != langs.end(); ++i)
{
m_language_map[i->get_name()] = *i;
language_box->add_choice(i->get_name());
if (m_language == *i)
{
language_box->set_current_choice(static_cast<int>(i - langs.begin()));
}
}
}
ChoiceBox* scroll_box = new ChoiceBox(Rect());
scroll_box->add_choice("Drag&Drop");
scroll_box->add_choice("Rubberband");
software_cursor_box = new CheckBox(Rect());
fullscreen_box = new CheckBox(Rect());
autoscroll_box = new CheckBox(Rect());
dragdrop_scroll_box = new CheckBox(Rect());
mousegrab_box = new CheckBox(Rect());
//.........这里部分代码省略.........