static gboolean nemo_link_local_set_key (const char *uri, const char *key, const char *value, gboolean localize) { gboolean success; GKeyFile *key_file; GFile *file; file = g_file_new_for_uri (uri); key_file = g_key_file_new (); if (!_g_key_file_load_from_gfile (key_file, file, G_KEY_FILE_KEEP_COMMENTS, NULL)) { g_key_file_free (key_file); g_object_unref (file); return FALSE; } if (localize) { g_key_file_set_locale_string (key_file, MAIN_GROUP, key, get_language (), value); } else { g_key_file_set_string (key_file, MAIN_GROUP, key, value); } success = _g_key_file_save_to_gfile (key_file, file, NULL); g_key_file_free (key_file); g_object_unref (file); return success; }
void tlanguage_selection::pre_show(CVideo& /*video*/, twindow& window) { window.set_canvas_variable("border", variant("default-border")); tlistbox& list = find_widget<tlistbox>(&window, "language_list", false); window.keyboard_capture(&list); const std::vector<language_def>& languages = get_languages(); const language_def& current_language = get_language(); std::stringstream strstr; int number = hero::number_normal_min; BOOST_FOREACH (const language_def& lang, languages) { string_map list_item; std::map<std::string, string_map> list_item_item; strstr.str(""); strstr << "hero-64/" << number << ".png"; list_item["label"] = strstr.str(); list_item_item.insert(std::make_pair("icon", list_item)); list_item["label"] = lang.language; list_item_item.insert(std::make_pair("name", list_item)); list.add_row(list_item_item); if (lang == current_language) { list.select_row(list.get_item_count() - 1); } number ++; }
void Script::_notification( int p_what) { if (p_what==NOTIFICATION_POSTINITIALIZE) { if (ScriptDebugger::get_singleton()) ScriptDebugger::get_singleton()->set_break_language(get_language()); } }
/* DDS3.2.12: Get Ballot Heading Height */ static unsigned int get_ballot_h_height(const struct electorate *voter_electorate) { struct image *ballot_h_image; ballot_h_image = get_bh_image(get_language(), voter_electorate); return image_height(ballot_h_image); }
LOCALELIST *get_locales_language() { LOCALELIST *list = NULL; struct dirent **dirents; int ndirents; int cnt; ndirents = scandir(LOCALEDIR, &dirents, select_dirs, alphasort); // build languages list for (cnt = 0; cnt < ndirents; ++cnt) { LOCALELIST *ptr = calloc(sizeof (LOCALELIST), 1); if (!ptr) return NULL; ptr->locale_code = strdup(dirents[cnt]->d_name); { char buf[sizeof (LOCALEDIR) + strlen(dirents[cnt]->d_name) + sizeof "/LC_IDENTIFICATION"]; char *enddir; struct stat st; stpcpy(enddir = stpcpy(stpcpy(stpcpy(buf, LOCALEDIR), "/"), dirents[cnt]->d_name), "/LC_IDENTIFICATION"); if (stat(buf, &st) == 0 && S_ISREG(st.st_mode)) { int fd = open(buf, O_RDONLY); if (fd != -1) { void *mapped = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); if (mapped != MAP_FAILED) { char *lang = get_language(mapped, st.st_size); ptr->language_name = mysprintf("%s (%.2s)", lang ? lang : ptr->locale_code, &ptr->locale_code[3]); munmap(mapped, st.st_size); } close(fd); } } } append_localelist(&list, ptr); } // free direntries if (ndirents > 0) { while (ndirents--) { free(dirents[ndirents]); } free(dirents); } if (list == NULL) { list = calloc(sizeof (LOCALELIST), 1); if (!list) return NULL; list->locale_code = mysprintf("%s%.2s.utf8", current_language, current_language); list->locale_code[3] = toupper(list->locale_code[3]); list->locale_code[4] = toupper(list->locale_code[4]); list->language_name = strdup(list->locale_code); } return list; }
static mask_t create_lang_field (char *s) { char *p; mask_t bitfield = 0; for (p = s; *p != NIL; p++) { if (*p == ',') continue; bitfield |= get_language_mask(get_language(*p)); } return bitfield; }
void AySpellChecker::reload() { language = get_language(); delete spell_checker; try { spell_checker = enchant::Broker::instance()->request_dict(language); } catch (enchant::Exception e) { eb_debug(DBG_CORE, "Error while loading enchant dictionary: %s\n", e.what()); } }
std::string from_expr( const namespacet &ns, const irep_idt &identifier, const exprt &expr) { std::unique_ptr<languaget> p=get_language(ns, identifier); std::string result; p->from_expr(expr, result, ns); return result; }
std::string from_type( const namespacet &ns, const irep_idt &identifier, const typet &type) { std::unique_ptr<languaget> p=get_language(ns, identifier); std::string result; p->from_type(type, result, ns); return result; }
void ConfigManager::set_language(const tinygettext::Language& v) { log_info("%1%", v.str()); if (v != get_language()) { dictionary_manager.set_language(v); on_language_change(v); } m_opts.language.set(v.str()); }
void language_save_arg (char *arg) { char *lang_name = strsep (&arg, ":"); struct language *lang = get_language (lang_name); if (lang == NULL) { error (0, 0, _("unrecognized language: `%s'"), lang_name); usage (); } if (lang->lg_argc == 0) lang->lg_argv[lang->lg_argc++] = program_name; lang->lg_argv[lang->lg_argc++] = arg; }
exprt to_expr( const namespacet &ns, const irep_idt &identifier, const std::string &src) { std::unique_ptr<languaget> p=get_language(ns, identifier); const symbolt &symbol=ns.lookup(identifier); exprt expr; if(p->to_expr(src, id2string(symbol.module), expr, ns)) return nil_exprt(); return expr; }
void tlanguage_selection::pre_show(CVideo& /*video*/, twindow& window) { tlistbox& list = find_widget<tlistbox>(&window, "language_list", false); window.keyboard_capture(&list); const std::vector<language_def>& languages = get_languages(); const language_def& current_language = get_language(); FOREACH(const AUTO& lang, languages) { string_map item; item.insert(std::make_pair("label", lang.language)); list.add_row(item); if(lang == current_language) { list.select_row(list.get_item_count() - 1); } }
void sync_enter_ui(void) { StatusBar_Trans(); // 保留给将来使用按钮,当前版本全都灰掉 ToolBar_EnableButton(gdmgr._htb_sync, IDM_REFRESH, TRUE); ToolBar_EnableButton(gdmgr._htb_sync, IDM_SYNC_SYNC, FALSE); HWND hctl = GetDlgItem(gdmgr._htb_sync, IDC_CMB_SYNC_LANGUAGE); ComboBox_ResetContent(hctl); const std::vector<language_def>& languages = get_languages(); const language_def& current_language = get_language(); BOOST_FOREACH (const language_def& lang, languages) { ComboBox_AddString(hctl, utf8_2_ansi(lang.language.c_str())); if (lang == current_language) { ComboBox_SetCurSel(hctl, ComboBox_GetCount(hctl) - 1); } }
int varnam_detect_lang(varnam *handle, const char *input) { strbuf *word; utf8_decoder decoder; int codepoint, language = VARNAM_LANG_CODE_UNKNOWN, prev_language = 0; if (handle == NULL || input == NULL) { return VARNAM_LANG_CODE_UNKNOWN; } word = get_pooled_string (handle); strbuf_add (word, input); if (strbuf_is_blank (word)) { return VARNAM_LANG_CODE_UNKNOWN; } utf8_decode_init (word->buffer, (int) word->length, &decoder); for (;;) { codepoint = utf8_decode_next (&decoder); if (codepoint == UTF8_END || codepoint == UTF8_ERROR) break; if (should_skip(codepoint)) continue; language = get_language (codepoint); if (language == VARNAM_LANG_CODE_UNKNOWN) return VARNAM_LANG_CODE_UNKNOWN; if (prev_language != 0 && language != prev_language) { /* Looks like characters from multiple languages are mixed */ return VARNAM_LANG_CODE_UNKNOWN; } prev_language = language; } return language; }
std::string Omegle_client::choose_action( int request_type, std::string* data, std::string* get_data ) { switch ( request_type ) { case OMEGLE_REQUEST_START: { std::string action = "/start?rcs=1&spid=&lang="; action += get_language(); if (get_data != NULL) action += (*get_data); return action; } case OMEGLE_REQUEST_STOP: return "/disconnect"; case OMEGLE_REQUEST_SEND: return "/send"; case OMEGLE_REQUEST_EVENTS: return "/events"; case OMEGLE_REQUEST_TYPING_START: return "/typing"; case OMEGLE_REQUEST_TYPING_STOP: return "/stoppedtyping"; case OMEGLE_REQUEST_RECAPTCHA: return "/recaptcha"; case OMEGLE_REQUEST_COUNT: return "/count"; // "/stoplookingforcommonlikes" /* case OMEGLE_REQUEST_HOME: */ default: return "/"; } }
void set_default_language (char const *lang_name) { struct lang_args *new_args; const struct language *lang; obstack_init (&lang_args_obstack); new_args = obstack_alloc (&lang_args_obstack, sizeof *new_args); new_args->la_pattern = obstack_copy0 (&lang_args_obstack, lang_name, strlen(lang_name)+1); new_args->la_args_string = 0; new_args->la_next = 0; lang = new_args->la_language = get_language (lang_name); new_args->la_args_digested = (lang ? lang->lg_parse_args (&new_args->la_args_string, 0) : 0); lang_args_default = new_args; DEBUG ((", <default>\n")); }
/* DDS????: Display Error */ void display_error(enum error err) { unsigned int language; struct image *bgimage; language = get_language(); fprintf(stderr, "Fatal Error number %d\n", err); exit(-1); /* Draw background if we can, otherwise clear screen */ bgimage = get_message_mayfail(language, MSG_BACKGROUND); if (bgimage) paste_image(0, 0, bgimage); else clear_screen(); /* Use electorate "1" here for the numbers. */ draw_error(get_message_mayfail(language, MSG_ERROR), get_preference_image_mayfail(1, (unsigned int)err), err); }
static gchar *get_local_path_with_locale(gchar *rootpath) { gchar *lang_str, *dir; lang_str = get_language(); dir = g_strconcat(rootpath, G_DIR_SEPARATOR_S, lang_str, NULL); g_free(lang_str); if(!is_dir_exist(dir)) { g_free(dir); dir = g_strconcat(rootpath, G_DIR_SEPARATOR_S, "en", NULL); if(!is_dir_exist(dir)) { g_free(dir); dir = NULL; } } return dir; }
static char * get_translated_language (const char *code, const char *locale) { const char *language; char *name; language = get_language (code); name = NULL; if (language != NULL) { const char *translated_name; locale_t loc; locale_t old_locale; if (locale != NULL) { loc = newlocale (LC_MESSAGES_MASK, locale, (locale_t) 0); if (loc == (locale_t) 0) return NULL; old_locale = uselocale (loc); } if (is_fallback_language (code)) { name = g_strdup (_("Unspecified")); } else { g_autofree char *tmp = NULL; translated_name = dgettext ("iso_639", language); tmp = get_first_item_in_semicolon_list (translated_name); name = capitalize_utf8_string (tmp); } if (locale != NULL) { uselocale (old_locale); freelocale (loc); } } return name; }
/* DDS????: Display Error */ void display_error(enum error err) { unsigned int language; struct image *bgimage; language = get_language(); /* Draw background if we can, otherwise clear screen */ bgimage = get_message_mayfail(language, MSG_BACKGROUND); if (bgimage) paste_image(0, 0, bgimage); else clear_screen(); /* Message to tell them */ play_audio(true, get_audio("error.raw")); /* Use electorate "1" here for the numbers. */ draw_error(get_message_mayfail(language, MSG_ERROR), get_preference_image_mayfail(1, (unsigned int)err), err); /* Loop until reset. */ wait_for_reset(); }
BOOL CAlarmCenterApp::InitInstance() { /*{ bool connect_by_sse_or_ip_ = true; std::string cloud_sse_id_ = ""; std::string device_ipv4_ = ""; int device_port_ = 0; std::wstring user_name_ = L""; int user_id = 0; std::wstring _device_note = L""; int _id = 0; CString sql; sql.Format(L"update table_device_info_jovision set \ connect_by_sse_or_ip=%d,\ cloud_sse_id='%s',\ device_ipv4='%s',\ device_port=%d,\ user_name='%s',\ user_passwd='%s',\ user_info_id=%d,\ device_note='%s' where id=%d", connect_by_sse_or_ip_ ? 1 : 0, utf8::a2w(cloud_sse_id_).c_str(), utf8::a2w(device_ipv4_).c_str(), device_port_, user_name_.c_str(), user_id, _device_note.c_str(), _id); JLOG(sql); }*/ do { if (IfProcessRunning()) break; auto log = log::get_instance(); log->set_output_to_dbg_view(); log->set_line_prifix("HB"); log->set_log_file_foler(get_exe_path_a() + "\\Log"); log->set_log_file_prefix("AlarmCenter"); log->set_output_to_file(); JLOG(L"AlarmCenter startup.\n"); AUTO_LOG_FUNCTION; int nRet; WSAData wsData; nRet = WSAStartup(MAKEWORD(2, 2), &wsData); if (nRet < 0) { JLOG(L"Can't load winsock.dll.\n"); break; } #pragma region init crashrpt // Place all significant initialization in InitInstance // Define CrashRpt configuration parameters CR_INSTALL_INFO info; memset(&info, 0, sizeof(CR_INSTALL_INFO)); info.cb = sizeof(CR_INSTALL_INFO); info.pszAppName = _T("AlarmCenter"); static CString version; detail::GetProductVersion(version); info.pszAppVersion = version; info.pszEmailSubject = _T("AlarmCenter Error Report"); info.pszEmailTo = _T("*****@*****.**"); info.pszUrl = _T("http://113.140.30.118/crashrpt.php"); info.uPriorities[CR_HTTP] = 3; // First try send report over HTTP info.uPriorities[CR_SMTP] = 2; // Second try send report over SMTP info.uPriorities[CR_SMAPI] = 1; // Third try send report over Simple MAPI // Install all available exception handlers info.dwFlags |= CR_INST_ALL_POSSIBLE_HANDLERS; // Restart the app on crash info.dwFlags |= CR_INST_APP_RESTART; info.dwFlags |= CR_INST_SEND_QUEUED_REPORTS; //info.pszRestartCmdLine = _T("/restart"); // Define the Privacy Policy URL //info.pszPrivacyPolicyURL = _T("http://myapp.com/privacypolicy.html"); // Install crash reporting int nResult = crInstall(&info); if (nResult != 0) { // Something goes wrong. Get error message. TCHAR szErrorMsg[512] = _T(""); crGetLastErrorMsg(szErrorMsg, 512); _tprintf_s(_T("%s\n"), szErrorMsg); MessageBox(nullptr, szErrorMsg, L"Error", MB_ICONERROR); break; } // Set crash callback function //crSetCrashCallback(CrashCallback, nullptr); // Add our log file to the error report crAddFile2(utf8::a2w(log::get_instance()->get_log_file_path()).c_str(), nullptr, _T("Log File"), CR_AF_MAKE_FILE_COPY); // We want the screenshot of the entire desktop is to be added on crash crAddScreenshot2(CR_AS_VIRTUAL_SCREEN, 0); // Add a named property that means what graphics adapter is // installed on user's machine //crAddProperty(_T("VideoCard"), _T("nVidia GeForce 8600 GTS")); #pragma endregion auto res = res::get_instance(); auto cfg = util::CConfigHelper::get_instance(); auto lang = cfg->get_language(); auto path = get_exe_path(); #ifdef _DEBUG path = path.substr(0, path.find_last_of(L'\\')); path += L"\\installer"; #endif switch (lang) { case util::AL_TAIWANESE: res->parse_file(path + L"\\lang\\zh-tw.txt"); SetThreadUILanguage(MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL), SORT_DEFAULT)); break; case util::AL_ENGLISH: res->parse_file(path + L"\\lang\\en-us.txt"); SetThreadUILanguage(MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); break; case util::AL_CHINESE: default: res->parse_file(path + L"\\lang\\zh-cn.txt"); SetThreadUILanguage(MAKELCID(MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED), SORT_DEFAULT)); break; } CAppResource::get_instance(); // InitCommonControlsEx() is required on Windows XP if an application // manifest specifies use of ComCtl32.dll version 6 or later to enable // visual styles. Otherwise, any window creation will fail. INITCOMMONCONTROLSEX InitCtrls; InitCtrls.dwSize = sizeof(InitCtrls); // Set this to include all the common control classes you want to use // in your application. InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); CWinApp::InitInstance(); AfxEnableControlContainer(); // Create the shell manager, in case the dialog contains // any shell tree view or shell list view controls. auto pShellManager = std::make_unique<CShellManager>(); // Activate "Windows Native" visual manager for enabling themes in MFC controls //CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // Change the registry key under which our settings are stored // You should modify this string to be something appropriate // such as the name of your company or organization SetRegistryKey(_T("Local AppWizard-Generated Applications")); CLoginDlg loginDlg; if (loginDlg.DoModal() != IDOK) { JLOG(L"user canceled login.\n"); break; } CSetupNetworkDlg setupDlg; if (setupDlg.DoModal() != IDOK) { JLOG(L"user canceled setup network.\n"); break; } CAlarmCenterDlg dlg; m_pMainWnd = &dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { } else if (nResponse == IDCANCEL) { } else if (nResponse == -1) { TRACE(L"Warning: dialog creation failed, so application is terminating unexpectedly.\n"); TRACE(L"Warning: if you are using MFC controls on the dialog, you cannot #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS.\n"); } } while (false); //video::ezviz::sdk_mgr_ezviz::release_singleton(); // Since the dialog has been closed, return FALSE so that we exit the // application, rather than start the application's message pump. return FALSE; }
extern bool ini_conf_load(const char *inifilename, p_conf conf) { dictionary *dict; char buf[80]; int i; extern void get_language(void); if (conf == NULL || inifilename == NULL) { return false; } dict = iniparser_load(inifilename); if (dict == NULL) return false; conf_default(conf); STRCPY_S(conf->path, iniparser_getstring(dict, "Global:path", conf->path)); conf->forecolor = iniparser_getunsigned(dict, "UI:forecolor", conf->forecolor); conf->giftranscolor = iniparser_getunsigned(dict, "Image:giftranscolor", conf->giftranscolor); conf->bgcolor = iniparser_getunsigned(dict, "UI:bgcolor", conf->bgcolor); conf->have_bg = iniparser_getboolean(dict, "UI:have_bg", conf->have_bg); conf->titlecolor = iniparser_getunsigned(dict, "UI:titlecolor", conf->titlecolor); conf->menutextcolor = iniparser_getunsigned(dict, "UI:menutextcolor", conf->menutextcolor); conf->menubcolor = iniparser_getunsigned(dict, "UI:menubcolor", conf->menubcolor); conf->selicolor = iniparser_getunsigned(dict, "UI:selicolor", conf->selicolor); conf->selbcolor = iniparser_getunsigned(dict, "UI:selbcolor", conf->selbcolor); conf->msgbcolor = iniparser_getunsigned(dict, "UI:msgbcolor", conf->msgbcolor); conf->usedyncolor = iniparser_getboolean(dict, "UI:usedyncolor", conf->usedyncolor); conf->rowspace = iniparser_getint(dict, "Text:rowspace", conf->rowspace); conf->infobar = stringToInfobar(iniparser_getstring (dict, "Text:infobar", infobarToString(buf, sizeof(buf), conf->infobar))); conf->infobar_style = iniparser_getint(dict, "Text:infobar_style", conf->infobar_style); conf->infobar_fontsize = iniparser_getunsigned(dict, "Text:infobar_fontsize", conf->infobar_fontsize); conf->rlastrow = iniparser_getboolean(dict, "Text:rlastrow", conf->rlastrow); conf->autobm = iniparser_getboolean(dict, "Text:autobm", conf->autobm); conf->vertread = stringToVertread(iniparser_getstring (dict, "Text:vertread", vertreadToString(buf, sizeof(buf), conf->vertread))); conf->encode = stringToEncode(iniparser_getstring (dict, "Text:encode", encodeToString(buf, sizeof(buf), conf->encode))); conf->fit = stringToFit(iniparser_getstring (dict, "Image:fit", fitToString(buf, sizeof(buf), conf->fit))); conf->imginfobar = iniparser_getboolean(dict, "Image:imginfobar", conf->imginfobar); conf->scrollbar = iniparser_getboolean(dict, "Text:scrollbar", conf->scrollbar); conf->scale = iniparser_getint(dict, "Image:scale", conf->scale); conf->rotate = stringToRotate(iniparser_getstring (dict, "Image:rotate", rotateToString(buf, sizeof(buf), conf->rotate))); for (i = 0; i < 20; ++i) { char key[20]; SPRINTF_S(key, "Text:txtkey1_%02d", i); conf->txtkey[i] = iniparser_getint(dict, key, conf->txtkey[i]); SPRINTF_S(key, "Image:imgkey1_%02d", i); conf->imgkey[i] = iniparser_getint(dict, key, conf->imgkey[i]); } check_empty_imgkey(conf); STRCPY_S(conf->shortpath, iniparser_getstring(dict, "Global:shortpath", conf->shortpath)); conf->confver = iniparser_getint(dict, "Global:confver", conf->confver); conf->bicubic = iniparser_getboolean(dict, "Image:bicubic", conf->bicubic); conf->wordspace = iniparser_getint(dict, "Text:wordspace", conf->wordspace); conf->borderspace = iniparser_getunsigned(dict, "Text:borderspace", conf->borderspace); STRCPY_S(conf->lastfile, iniparser_getstring(dict, "Global:lastfile", conf->lastfile)); conf->mp3encode = stringToEncode(iniparser_getstring (dict, "Music:mp3encode", encodeToString(buf, sizeof(buf), conf->mp3encode))); conf->lyricencode = stringToEncode(iniparser_getstring (dict, "Music:lyricencode", encodeToString(buf, sizeof(buf), conf->lyricencode))); conf->mp3cycle = stringToCycle(iniparser_getstring (dict, "Music:mp3cycle", cycleToString(buf, sizeof(buf), conf->mp3cycle))); conf->isreading = iniparser_getboolean(dict, "Global:isreading", conf->isreading); STRCPY_S(conf->bgarch, iniparser_getstring(dict, "UI:bgarch", conf->bgarch)); STRCPY_S(conf->bgfile, iniparser_getstring(dict, "UI:bgfile", conf->bgfile)); conf->bgwhere = iniparser_getint(dict, "UI:bgwhere", conf->bgwhere); conf->slideinterval = iniparser_getint(dict, "Image:slideinterval", conf->slideinterval); conf->hprmctrl = iniparser_getboolean(dict, "Music:hprmctrl", conf->hprmctrl); conf->grayscale = iniparser_getint(dict, "UI:grayscale", conf->grayscale); conf->showhidden = iniparser_getboolean(dict, "Global:showhidden", conf->showhidden); conf->showunknown = iniparser_getboolean(dict, "Global:showunknown", conf->showunknown); conf->showfinfo = iniparser_getboolean(dict, "Global:showfinfo", conf->showfinfo); conf->allowdelete = iniparser_getboolean(dict, "Global:allowdelete", conf->allowdelete); conf->arrange = stringToArrange(iniparser_getstring (dict, "Global:arrange", arrangeToString(buf, sizeof(buf), conf->arrange))); conf->enableusb = iniparser_getboolean(dict, "Global:enableusb", conf->enableusb); conf->viewpos = stringToViewpos(iniparser_getstring (dict, "Image:viewpos", viewposToString(buf, sizeof(buf), conf->viewpos))); conf->imgmvspd = iniparser_getint(dict, "Image:imgmvspd", conf->imgmvspd); conf->imgpaging = stringToImgpaging(iniparser_getstring (dict, "Image:imgpaging", imgpagingToString(buf, sizeof(buf), conf->imgpaging))); conf->imgpaging_spd = iniparser_getint(dict, "Image:imgpaging_spd", conf->imgpaging_spd); conf->imgpaging_interval = iniparser_getint(dict, "Image:imgpaging_interval", conf->imgpaging_interval); conf->imgpaging_duration = iniparser_getint(dict, "Image:imgpaging_duration", conf->imgpaging_duration); for (i = 0; i < 20; ++i) { char key[20]; SPRINTF_S(key, "Global:flkey1_%02d", i); conf->flkey[i] = iniparser_getint(dict, key, conf->flkey[i]); } conf->fontsize = iniparser_getint(dict, "UI:fontsize", conf->fontsize); conf->reordertxt = iniparser_getboolean(dict, "Text:reordertxt", conf->reordertxt); conf->pagetonext = iniparser_getboolean(dict, "Text:pagetonext", conf->pagetonext); conf->autopage = iniparser_getint(dict, "Text:autopage", conf->autopage); conf->prev_autopage = iniparser_getint(dict, "Text:prev_autopage", conf->prev_autopage); conf->autopagetype = iniparser_getint(dict, "Text:autopagetype", conf->autopagetype); conf->autolinedelay = iniparser_getint(dict, "Text:autolinedelay", conf->autolinedelay); conf->thumb = stringToThumb(iniparser_getstring (dict, "Image:thumb", thumbToString(buf, sizeof(buf), conf->thumb))); conf->bookfontsize = iniparser_getint(dict, "Text:bookfontsize", conf->bookfontsize); conf->enable_analog = iniparser_getboolean(dict, "Text:enable_analog", conf->enable_analog); conf->img_enable_analog = iniparser_getboolean(dict, "Image:img_enable_analog", conf->img_enable_analog); for (i = 0; i < 20; ++i) { char key[20]; SPRINTF_S(key, "Text:txtkey2_%02d", i); conf->txtkey2[i] = iniparser_getint(dict, key, conf->txtkey2[i]); SPRINTF_S(key, "Image:imgkey2_%02d", i); conf->imgkey2[i] = iniparser_getint(dict, key, conf->imgkey2[i]); SPRINTF_S(key, "Global:flkey2_%02d", i); conf->flkey2[i] = iniparser_getint(dict, key, conf->flkey2[i]); } conf->imgpagereserve = iniparser_getint(dict, "Image:imgpagereserve", conf->imgpagereserve); conf->lyricex = iniparser_getint(dict, "Music:lyricex", conf->lyricex); conf->autoplay = iniparser_getboolean(dict, "Music:autoplay", conf->autoplay); conf->usettf = iniparser_getboolean(dict, "Text:usettf", conf->usettf); STRCPY_S(conf->cttfarch, iniparser_getstring(dict, "Text:cttfarch", conf->cttfarch)); STRCPY_S(conf->cttfpath, iniparser_getstring(dict, "Text:cttfpath", conf->cttfpath)); STRCPY_S(conf->ettfarch, iniparser_getstring(dict, "Text:ettfarch", conf->ettfarch)); STRCPY_S(conf->ettfpath, iniparser_getstring(dict, "Text:ettfpath", conf->ettfpath)); for (i = 0; i < 3; ++i) { char key[20]; SPRINTF_S(key, "Global:freqs_%d", i); conf->freqs[i] = iniparser_getint(dict, key, conf->freqs[i]); } conf->imgbrightness = iniparser_getint(dict, "Image:imgbrightness", conf->imgbrightness); conf->dis_scrsave = iniparser_getboolean(dict, "Global:dis_scrsave", conf->dis_scrsave); conf->autosleep = iniparser_getint(dict, "Global:autosleep", conf->autosleep); conf->load_exif = iniparser_getboolean(dict, "Image:load_exif", conf->load_exif); conf->launchtype = iniparser_getint(dict, "Global:launchtype", conf->launchtype); conf->infobar_use_ttf_mode = iniparser_getboolean(dict, "Text:infobar_use_ttf_mode", conf->infobar_use_ttf_mode); conf->img_no_repeat = iniparser_getboolean(dict, "Image:no_repeat", conf->img_no_repeat); conf->hide_flash = iniparser_getboolean(dict, "Global:hide_flash", conf->hide_flash); conf->tabstop = iniparser_getunsigned(dict, "Text:tabstop", conf->tabstop); conf->apetagorder = iniparser_getboolean(dict, "Music:apetagorder", conf->apetagorder); STRCPY_S(conf->language, iniparser_getstring(dict, "UI:language", conf->language)); get_language(); conf->filelistwidth = iniparser_getint(dict, "UI:filelistwidth", conf->filelistwidth); if (conf->filelistwidth < 0 || conf->filelistwidth > 240) conf->filelistwidth = 160; conf->ttf_load_to_memory = iniparser_getboolean(dict, "Text:ttf_load_to_memory", conf->ttf_load_to_memory); conf->save_password = iniparser_getboolean(dict, "Global:save_password", conf->save_password); conf->scrollbar_width = iniparser_getint(dict, "Text:scrollbar_width", conf->scrollbar_width); conf->hide_last_row = iniparser_getboolean(dict, "Text:hide_last_row", conf->hide_last_row); conf->infobar_show_timer = iniparser_getboolean(dict, "Text:infobar_show_timer", conf->infobar_show_timer); conf->englishtruncate = iniparser_getboolean(dict, "Text:englishtruncate", conf->englishtruncate); conf->image_scroll_chgn_speed = iniparser_getboolean(dict, "Image:image_scroll_chgn_speed", conf->image_scroll_chgn_speed); conf->ttf_haste_up = iniparser_getboolean(dict, "Text:ttf_haste_up", conf->ttf_haste_up); conf->linenum_style = iniparser_getboolean(dict, "Text:linenum_style", conf->linenum_style); conf->infobar_align = stringToAlign(iniparser_getstring(dict, "Text:infobar_align", "")); STRCPY_S(conf->musicdrv_opts, iniparser_getstring(dict, "Music:musicdrv_opts", conf->musicdrv_opts)); conf->magnetic_scrolling = iniparser_getboolean(dict, "Image:magnetic_scrolling", conf->magnetic_scrolling); conf->use_image_queue = iniparser_getboolean(dict, "Image:use_image_queue", conf->use_image_queue); conf->max_cache_img = iniparser_getunsigned(dict, "Image:max_cache_img", conf->max_cache_img); conf->show_encoder_msg = iniparser_getboolean(dict, "Music:show_encoder_msg", conf->show_encoder_msg); if (conf->max_cache_img == 0) { conf->use_image_queue = false; } dictionary_del(dict); return true; }
// Returns the language pack that defines the statement. inline int stmt::get_feature() const { return get_language(kind_); }
static int belpic_init(sc_card_t *card) { struct belpic_priv_data *priv = NULL; scconf_block *conf_block; #ifdef BELPIC_PIN_PAD int r; #endif sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "Belpic V%s", BELPIC_VERSION); #ifdef HAVE_GUI sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, " with GUI support"); #endif #ifdef BELPIC_PIN_PAD sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, " with support for pin pad reader libs"); #endif sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "\n"); if (card->type < 0) card->type = SC_CARD_TYPE_BELPIC_EID; /* Unknown card: assume it's the Belpic Card */ priv = calloc(1, sizeof(struct belpic_priv_data)); if (priv == NULL) return SC_ERROR_OUT_OF_MEMORY; card->drv_data = priv; card->cla = 0x00; if (card->type == SC_CARD_TYPE_BELPIC_EID) { _sc_card_add_rsa_alg(card, 1024, SC_ALGORITHM_RSA_PAD_PKCS1 | SC_ALGORITHM_RSA_HASH_NONE, 0); } /* V1 applets have a problem: if the card sends a 6C XX (only XX bytes available), * and we resend the command too soon (i.e. the reader is too fast), the card * doesn't respond. So we build in a delay. */ card->wait_resend_apdu = 40; /* State that we have an RNG */ card->caps |= SC_CARD_CAP_RNG; /* State that we don't return FCI (no file type, no file size, ...) */ card->caps |= SC_CARD_CAP_NO_FCI; /* Language prefences */ priv->lang = -1; conf_block = get_belpic_conf(card->ctx, "belpic_general"); if (conf_block != NULL) { char *lang = (char *) scconf_get_str(conf_block, "force_language", NULL); if (lang != NULL && strlen(lang) == 2) priv->lang = str2lang(card->ctx, lang); } #ifdef GET_LANG_FROM_CARD if (priv->lang == -1) priv->lang = get_language(card); #endif card->max_pin_len = BELPIC_MAX_USER_PIN_LEN; #ifdef HAVE_GUI r = scgui_init(); if (r != 0) sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "scgui_init() returned error %d\n", i); #endif #ifdef BELPIC_PIN_PAD r = belpic_detect_pin_pad(card, priv); if (r == 1) card->reader->capabilities |= SC_READER_CAP_PIN_PAD; else if (r < 0) return r; /* error loading/initing pin pad lib */ conf_block = get_belpic_conf(card->ctx, "belpic_pin_pad"); if (conf_block != NULL) { if (scconf_get_bool(conf_block, "msg_auth_pin", 1)) priv->options |= PP_MSG_AUTH_PIN; if (scconf_get_bool(conf_block, "msg_wrong_pin", 1)) priv->options |= PP_MSG_WRONG_PIN; if (scconf_get_bool(conf_block, "msg_changepin_mismatch", 1)) priv->options |= PP_MSG_CHANGEPIN_MISMATCH; if (scconf_get_bool(conf_block, "msg_pin_blocked", 1)) priv->options |= PP_MSG_PIN_BLOCKED; } #endif return 0; }
/* XXX WARNING!!! IN osx somehow the previous function call jumps in this one??? (ton, ppc) */ void BLF_lang_set(const char *str) { char *locreturn; const char *short_locale; int ok = 1; const char *long_locale = locales[2 * U.language]; if ((U.transopts&USER_DOTRANSLATE) == 0) return; if (str) short_locale = str; else short_locale = locales[ 2 * U.language + 1]; #if defined (_WIN32) && !defined(FREE_WINDOWS) if (short_locale) { char *envStr; if (U.language == 0)/* use system setting */ envStr = BLI_sprintfN( "LANG=%s", getenv("LANG") ); else envStr = BLI_sprintfN( "LANG=%s", short_locale ); gettext_putenv(envStr); MEM_freeN(envStr); } locreturn = setlocale(LC_ALL, long_locale); if (locreturn == NULL) { if (G.debug & G_DEBUG) printf("Could not change locale to %s\n", long_locale); ok = 0; } #else { static char default_lang[64] ="\0"; static char default_language[64] ="\0"; if (default_lang[0] == 0) get_language_variable("LANG", default_lang, sizeof(default_lang)); if (default_language[0] == 0) get_language_variable("LANGUAGE", default_language, sizeof(default_language)); if (short_locale[0]) { if (G.debug & G_DEBUG) printf("Setting LANG= and LANGUAGE to %s\n", short_locale); BLI_setenv("LANG", short_locale); BLI_setenv("LANGUAGE", short_locale); } else { if (G.debug & G_DEBUG) printf("Setting LANG=%s and LANGUAGE=%s\n", default_lang, default_language); BLI_setenv("LANG", default_lang); BLI_setenv("LANGUAGE", default_language); } locreturn = setlocale(LC_ALL, short_locale); if (locreturn == NULL) { char *short_locale_utf8 = NULL; if (short_locale[0]) { short_locale_utf8 = BLI_sprintfN("%s.UTF-8", short_locale); locreturn = setlocale(LC_ALL, short_locale_utf8); } if (locreturn == NULL) { char language[65]; get_language(long_locale, default_lang, language, sizeof(language)); if (G.debug & G_DEBUG) { if (short_locale[0]) printf("Could not change locale to %s nor %s\n", short_locale, short_locale_utf8); else printf("Could not reset locale\n"); printf("Fallback to LANG=%s and LANGUAGE=%s\n", default_lang, language); } /* fallback to default settings */ BLI_setenv("LANG", default_lang); BLI_setenv("LANGUAGE", language); locreturn = setlocale(LC_ALL, ""); ok = 0; } if (short_locale_utf8) MEM_freeN(short_locale_utf8); } } #endif if (ok) { /*printf("Change locale to %s\n", locreturn ); */ BLI_strncpy(global_language, locreturn, sizeof(global_language)); } setlocale(LC_NUMERIC, "C"); textdomain(TEXT_DOMAIN_NAME); bindtextdomain(TEXT_DOMAIN_NAME, global_messagepath); bind_textdomain_codeset(TEXT_DOMAIN_NAME, global_encoding_name); }
config_cache_fixture() : cache(test_config_cache::instance()), old_locale(get_language()), test_def("TEST") { test_utils::get_test_config_ref(); }
/* DDS3.12: Display DEO Ballot Screen */ void dsp_mn_vt_scn(void) { const struct electorate *electorate; struct ballot_contents *bc; unsigned int group_index; unsigned int physical_column; unsigned int grid_block; int cand; struct cursor cursor_position; struct image *ballot_h_image; /* Number of grid blocks in each row. */ unsigned int groups_across; /* grid_block_mod_groups_across = (grid_block % groups_across) */ unsigned int grid_block_mod_groups_across; /* The first grid block of the next group (or the end of the ballot, if there is no next group). */ unsigned int next_grid_block; electorate = get_voter_electorate(); bc = get_ballot_contents(); ballot_h_image = get_bh_image(get_language(), electorate); paste_image(0,0,ballot_h_image); /* SIPL 2011-07-11 Need this to fill in map_physical_column_to_grid_block. */ groups_across = get_grid_blocks_across(electorate); /* SIPL 2011-06-29 Now loop over physical columns and grid blocks as well as groups. Fill in map_physical_column_to_grid_block during this process. */ group_index = 0; physical_column = 0; grid_block = 0; while (group_index < bc->num_groups) { /* Need to fill in all the map entries for the group before calling draw_group_entry. */ bc->map_physical_column_to_grid_block[physical_column] = grid_block; /* For the rest in the group, draw blank entry */ /* All physical columns but the last for this group. */ while (physical_column < bc->map_group_to_physical_column[group_index+1] - 1) { for (cand = bc->num_candidates_in_physical_column[ physical_column]; cand < electorate->num_seats; cand++) draw_blank_entry_no_divider_grid_block( grid_block, cand); physical_column++; grid_block++; bc->map_physical_column_to_grid_block[ physical_column] = grid_block; } /* The last physical column for this group. */ for (cand = bc->num_candidates_in_physical_column[ physical_column]; cand < electorate->num_seats; cand++) draw_blank_entry_grid_block(grid_block, cand); /* Now all of the entries in map_physical_column_to_grid_block required for this group have been filled in, so the candidates can be drawn. */ /* candidate -1 corresponds to group heading */ for (cand = -1; cand < (int)bc->num_candidates[group_index]; cand++) { cursor_position.group_index = group_index; cursor_position.screen_candidate_index = cand; draw_group_entry(cursor_position,NO,false); } group_index++; physical_column++; grid_block++; /* Is there a next group, and, if so, it there room for the next group? If this is the last group, set the map value to the grid block after the end of the entire screen. Otherwise, set the map value to the grid block at the beginning of the next row. Group group_index occupies (bc->map_group_to_physical_column[group_index+1] - bc->map_group_to_physical_column[group_index]) physical columns. */ grid_block_mod_groups_across = grid_block % groups_across; if (group_index < bc->num_groups) { if (grid_block_mod_groups_across + (bc->map_group_to_physical_column[group_index+1] - bc->map_group_to_physical_column[group_index]) > groups_across) /* No room. Move to the next row. */ next_grid_block = grid_block + (groups_across - grid_block_mod_groups_across); else /* There is room. */ next_grid_block = grid_block; } else { /* This is the last group. */ next_grid_block = grid_blocks_possible(); } /* Now fill in the map entry. */ bc->map_physical_column_to_grid_block[physical_column] = next_grid_block; /* Fill in any blank grid blocks at the end of the row, or the ballot. */ while (grid_block < next_grid_block) { draw_blank_group_entry_grid_block(grid_block); for (cand = 0; cand < (int)electorate->num_seats; cand++) draw_blank_entry_grid_block(grid_block, cand); grid_block++; } } }
static int intf_get_language(lua_State* L) { lua_push(L, get_language().localename); return 1; }
bool current_language_rtl() { return get_language().rtl; }