本文整理汇总了C++中tinygettext::DictionaryManager::add_directory方法的典型用法代码示例。如果您正苦于以下问题:C++ DictionaryManager::add_directory方法的具体用法?C++ DictionaryManager::add_directory怎么用?C++ DictionaryManager::add_directory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tinygettext::DictionaryManager
的用法示例。
在下文中一共展示了DictionaryManager::add_directory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: I18N_Init
/**
* @brief Attempts to detect the system language unless cl_lang was already set.
* Then loads the PO file containing translated strings.
*/
void I18N_Init(void)
{
FL_Locale *locale;
std::set<tinygettext::Language> languages;
std::set<tinygettext::Language> languages_mod;
cl_lang = Cvar_Get("cl_lang", "en", CVAR_ARCHIVE | CVAR_LATCH);
cl_langDebug = Cvar_Get("cl_langDebug", "0", CVAR_ARCHIVE);
tinygettext::Log::set_log_error_callback(&Tinygettext_Error);
tinygettext::Log::set_log_info_callback(&Tinygettext_Info);
tinygettext::Log::set_log_warning_callback(&Tinygettext_Warning);
FL_FindLocale(&locale);
// Do not change the language if it is already set
if (!cl_lang->string[0])
{
// locale->country is also supported for 'en_US' format
if (locale->lang && locale->lang[0])
{
Cvar_Set("cl_lang", va("%s", locale->lang));
}
else
{
// Language detection failed. Fallback to English
Cvar_Set("cl_lang", "en");
}
}
dictionary.set_filesystem(std::auto_ptr<tinygettext::FileSystem>(new QFileSystem));
dictionary_mod.set_filesystem(std::auto_ptr<tinygettext::FileSystem>(new QFileSystem));
dictionary.add_directory("locale/client");
dictionary_mod.add_directory("locale/mod");
languages = dictionary.get_languages();
Com_Printf("Available client translations:");
for (std::set<tinygettext::Language>::iterator p = languages.begin(); p != languages.end(); p++)
{
Com_Printf(" %s", p->get_name().c_str());
}
Com_Printf("\n");
languages_mod = dictionary_mod.get_languages();
Com_Printf("Available mod translations:");
for (std::set<tinygettext::Language>::iterator p = languages_mod.begin(); p != languages_mod.end(); p++)
{
Com_Printf(" %s", p->get_name().c_str());
}
Com_Printf("\n");
I18N_SetLanguage(cl_lang->string);
FL_FreeLocale(&locale);
}
示例2: defined
// Get all filenames and directories
void
PingusMain::init_path_finder()
{
if (cmd_options.userdir.is_set())
System::set_userdir(cmd_options.userdir.get());
System::init_directories();
if (cmd_options.datadir.is_set())
{
g_path_manager.set_path(cmd_options.datadir.get());
}
else
{ // do magic to guess the datadir
#if defined(__APPLE__)
char resource_path[PATH_MAX];
CFURLRef ref = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
if (!ref || !CFURLGetFileSystemRepresentation(ref, true, (UInt8*)resource_path, PATH_MAX))
{
std::cout << "Error: Couldn't get Resources path.\n" << std::endl;
exit(EXIT_FAILURE);
}
CFRelease(ref);
g_path_manager.set_path("data");
#else
g_path_manager.set_path("data"); // assume game is run from source dir
#endif
}
// Language is automatically picked from env variable
//dictionary_manager.set_language(tinygettext::Language::from_env("it_IT.utf8")); // maybe overwritten by file ~/.pingus/config
dictionary_manager.add_directory(g_path_manager.complete("po/"));
}
示例3: initFactories
void initFactories()
{
static bool initialized = false;
if(!initialized) {
new INTERN_ButtonFactory();
new INTERN_DesktopFactory();
new INTERN_DocumentFactory();
new INTERN_FilledRectangleFactory();
new INTERN_GradientFactory();
new INTERN_ImageFactory();
new INTERN_PanelFactory();
new INTERN_ParagraphFactory();
new INTERN_ScrollBarFactory();
new INTERN_ScrollViewFactory();
new INTERN_SwitchComponentFactory();
new INTERN_TableLayoutFactory();
new INTERN_TooltipManagerFactory();
new INTERN_WindowFactory();
new ImportFactory();
dictionaryGUIManager.set_charset("UTF-8");
dictionaryGUIManager.add_directory("locale/gui");
initialized = true;
}
}
示例4: init_tinygettext
static void init_tinygettext()
{
dictionary_manager.add_directory("locale");
dictionary_manager.set_charset("UTF-8");
}