static int roadmap_lang_load (const char *path) { char *p; FILE *file; char line[1024]; char file_name[20]; char *name; char *value; #ifndef J2ME sprintf(file_name, "lang.%s", roadmap_lang_get_system_lang()); #else sprintf(file_name, "lang.%s_j2me", roadmap_lang_get_system_lang()); #endif file = roadmap_file_fopen (path, file_name, "sr"); if (file == NULL) return 0; while (!feof(file)) { #ifndef J2ME /* Read the next line, skip empty lines and comments. */ if (fgets (line, sizeof(line), file) == NULL) break; p = roadmap_config_extract_data (line, sizeof(line)); if (p == NULL) continue; /* Decode the line (name= value). */ name = p; p = roadmap_config_skip_until (p, '='); if (*p != '=') continue; *(p++) = 0; p = roadmap_config_skip_spaces (p); value = p; p = roadmap_config_skip_until (p, 0); *p = 0; name = strdup (name); value = strdup (value); #else // J2ME if(!roadmap_config_get_name_value_binary(&name, &value, file)) break; // reached end of file #endif roadmap_lang_new_item (name, value); } fclose (file); return 1; }
void roadmap_lang_initialize (void) { const char *p; initialized = TRUE; roadmap_log (ROADMAP_INFO, "Starting 'roadmap_lang_initialize'"); roadmap_lang_initialize_params(); roadmap_lang_allocate (); lang_labels[0] = "English"; lang_values[0] = "eng"; p = roadmap_path_user (); LangNextLoginCb = Realtime_NotifyOnLogin (roadmap_lang_login_cb); roadmap_lang_conf_load(roadmap_path_downloads()); RoadMapLangLoaded = roadmap_lang_load (p); if (!RoadMapLangLoaded){ p = roadmap_path_downloads(); RoadMapLangLoaded = roadmap_lang_load (p); } RoadMapLangRTL = (strcasecmp(roadmap_lang_get ("RTL"), "Yes") == 0); NOPH_SetSystemLanguage(roadmap_lang_get_system_lang()); }
void download_lang_files(void){ int i; for (i = 0; i < languages_count; i++){ if (strcmp(lang_values[i], roadmap_lang_get_system_lang())) roadmap_lang_download_lang_file(lang_values[i], NULL); } }
void roadmap_lang_login_cb(void){ if (LangNextLoginCb) { LangNextLoginCb (); LangNextLoginCb = NULL; } roadmap_lang_download_lang_file(roadmap_lang_get_system_lang(), NULL); roadmap_lang_download_conf_file(NULL); }
static const char * create_group_url(const char *group_name) { static char url[1024]; snprintf(url, sizeof(url),"%s?sessionid=%d&cookie=%s&deviceid=%d&width=%d&height=%d&gotogroup=%s&client_version=%s&web_version=%s&lang=%s", roadmap_groups_get_url(), Realtime_GetServerId(), Realtime_GetServerCookie(), RT_DEVICE_ID, roadmap_canvas_width(), roadmap_canvas_height() - roadmap_bar_bottom_height(), group_name, roadmap_start_version(), BROWSER_WEB_VERSION, roadmap_lang_get_system_lang()); append_current_location(url + strlen(url)); return &url[0]; }
static char *build_url(RTBonus *pbonus, int iHeight, int iWidth){ static char url[1024]; snprintf(url, sizeof(url),"%s?bonus_id=%d&sessionid=%d&cookie=%s&deviceid=%d&width=%d&height=%d&client_version=%s&lang=%s&template=%d&%s", GetBaseUrl(), pbonus->iID, Realtime_GetServerId(), Realtime_GetServerCookie(), RT_DEVICE_ID, iWidth, iHeight, roadmap_start_version(), roadmap_lang_get_system_lang(), pbonus->iTemplateID, (pbonus->pWebDlgExtraParams == NULL) ? "" : pbonus->pWebDlgExtraParams); return &url[0]; }
static const char *create_url(void) { static char url[1024]; snprintf(url, sizeof(url),"%s?sessionid=%d&cookie=%s&deviceid=%d&width=%d&height=%d&client_version=%s&web_version=%s&lang=%s", roadmap_groups_get_url(), Realtime_GetServerId(), Realtime_GetServerCookie(), #ifndef RIMAPI RT_DEVICE_ID, #else 20, // until server is changed. TODO : CHANGE! #endif roadmap_canvas_width(), roadmap_canvas_height() - roadmap_bar_bottom_height(), roadmap_start_version(), BROWSER_WEB_VERSION, roadmap_lang_get_system_lang()); append_current_location(url + strlen(url)); return &url[0]; }
int CRoadMapNativeSound::PlayList(const RoadMapSoundList list) { m_AudioPlayers.ResetAndDestroy(); // stop playing whatever is playing now m_NextPlaying = 0; m_NumReady = 0; int listSize = roadmap_sound_list_count(list); m_ListSize = listSize; // know how much we need to play for (int i = 0; i < roadmap_sound_list_count(list); i++) {//TODO load resource const char *name = roadmap_sound_list_get (list, i); RoadMapSound sound = (RoadMapSound) roadmap_res_get (RES_SOUND, RES_NOCREATE, name); if (sound) { PlaySound (sound); } else { char sound_filename[MAX_SOUND_NAME]; char path_prefix[16]; snprintf( path_prefix, sizeof(path_prefix), "sound\\%s\\", roadmap_lang_get_system_lang() ); if( roadmap_construct_res_path( sound_filename, sizeof(sound_filename), name, ".mp3", path_prefix ) == KErrNone ) { PlayFile( sound_filename ); } } } if ( (list->flags & SOUND_LIST_NO_FREE) == false ) { free (list); } return 0; }
static void lang_changed_delayed_message(void){ roadmap_main_remove_periodic(lang_changed_delayed_message); roadmap_messagebox_timeout("","Language changed, Please restart waze",5); } static void update_events_radius(){ const char * data = (const char *)ssd_dialog_get_data("event_radius"); if (!(roadmap_config_match(&RoadMapConfigEventsRadius, data))){ // descriptor changed roadmap_config_set (&RoadMapConfigEventsRadius,data); OnSettingsChanged_VisabilityGroup(); // notify server of visibilaty settings change } } static int on_ok( SsdWidget this, const char *new_value) { const char *current_lang = roadmap_lang_get_system_lang(); const char *new_lang = ssd_dialog_get_data("lang"); const char *prompts = ssd_dialog_get_data("Prompts"); if (prompts) roadmap_prompts_set_name(prompts); #ifdef __SYMBIAN32__ roadmap_config_set(&RoadMapConfigConnectionAuto, ( const char* ) ssd_dialog_get_data("AutoConnect")); #endif #if (defined(__SYMBIAN32__) || defined(ANDROID)) roadmap_device_set_backlight( !( strcasecmp( ( const char* ) ssd_dialog_get_data("BackLight"), yesno[0] ) ) ); roadmap_sound_set_volume( ( int ) ssd_dialog_get_data( "Volume Control" ) ); #endif // Symbian or android
static void on_recieved_completed (void) { char updateText[] = "We've made a few infrastructural changes that require re-start. Please exit and re-start waze."; const char *user_lang = roadmap_lang_get_user_lang();//"heb";//todomt const char *force_lang = roadmap_config_get( &RoadMapConfigForceLanguage); // compare the old and new server id's - if different, user needs to restart int oldServerId = roadmap_config_get_integer(&RoadMapConfigSystemServerId); int newServerId = GeoConfigContext.id; // Save the RT server ID. roadmap_config_set_integer (&RoadMapConfigSystemServerId, GeoConfigContext.id); #ifndef J2ME // in J2ME don't download the language until user chooses it manually // TODODAN //set the language if (!strcmp(force_lang, "")){ roadmap_lang_set_system_lang (GeoConfigContext.lang, NULL); }else{ roadmap_lang_set_system_lang (force_lang, NULL); } #endif // Save version roadmap_config_set_integer (&RoadMapConfigGeoConfigVersion, GeoConfigContext.version); //Save new configuration roadmap_config_save (0); //Remove timer roadmap_main_remove_periodic (GeoConfigTimer); roadmap_log (ROADMAP_DEBUG,"GeoServerConfig Completed setting all parameters!!" ); roadmap_log (ROADMAP_INFO, "GeoServerConfig: user_lang='%s' newServerId=%d", user_lang, newServerId ); if ((user_lang[0] == 0) && (newServerId != 2)){ roadmap_lang_download_conf_file(on_lang_conf_downloaded); return; } if ((user_lang[0] == 0) && (newServerId == 2)){ roadmap_lang_set_system_lang(GeoConfigContext.lang, NULL); } if ((oldServerId==-1)){ ssd_progress_msg_dialog_show("Downloading language"); roadmap_lang_download_lang_file(roadmap_lang_get_system_lang(), on_user_lang_downloaded); //on_user_lang_downloaded();//todomt return; } #ifndef J2ME roadmap_lang_download_lang_file(GeoConfigContext.lang, NULL); #endif ssd_progress_msg_dialog_hide(); clean_up(); roadmap_screen_refresh(); if (GeoConfigContext.callback) (*GeoConfigContext.callback)(); GeoConfigContext.callback = NULL; // if ((oldServerId!=newServerId)&&(oldServerId!=-1)){ // // roadmap_lang_set_update_time(""); //#ifndef J2ME // roadmap_lang_set_lang_file_update_time("heb",""); // roadmap_lang_set_lang_file_update_time("eng",""); //#endif // roadmap_prompts_set_update_time (""); // roadmap_splash_set_update_time (""); // roadmap_splash_reset_check_time(); // roadmap_config_save(FALSE); //#if (defined (IPHONE) || defined (ANDROID)) // roadmap_tile_remove_all(roadmap_locator_active()); //#endif // roadmap_messagebox_cb(roadmap_lang_get("Please restart Waze"), roadmap_lang_get(updateText), restart_msg_cb); // } }