Changeset 1856 for trunk/gsdl/src/recpt/pageaction.cpp
- Timestamp:
- 2001-01-23T10:58:19+13:00 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/pageaction.cpp
r1759 r1856 187 187 // _languageoption_ interface languages to select from (dependant on PreferenceLanguages) 188 188 189 // _encodingoption_ will be overridden to "" if chinese language interface isn't specified189 // _encodingoption_ encodings to select from 190 190 191 191 // if page is "about" … … 283 283 284 284 // _languageoption_ 285 // this is kind of a hack (another one!!). note that there're potential 286 // problems here as no checking is done anywhere to make sure language 287 // is set to a valid value. this does allow us to set which languages 288 // should go in the preference selection box (from collect.cfg) however 289 // and that's sufficient for current requirements 290 291 // currently supported languages (_languageoption_ will default to all 292 // these languages unless PreferenceLanguages is set 293 text_tarray languages; 294 languages.push_back ("en"); 295 languages.push_back ("fr"); 296 languages.push_back ("de"); 297 languages.push_back ("es"); 298 languages.push_back ("mi"); 299 languages.push_back ("zh"); 300 languages.push_back ("ar"); 301 languages.push_back ("pt"); 302 languages.push_back ("nl"); 303 text_tarray::const_iterator this_lang = languages.begin(); 304 text_tarray::const_iterator end_lang = languages.end(); 305 306 text_t languageoption = "_textlanguage_\n<select name=\"l\" onChange=\"updatel();\">\n"; 285 // Create the "interface language" selection box for the preferences page. 286 // You can use something like "format PreferenceLanguages en|fr|zn" from within 287 // a collect.cfg file to use only a subset of the available languages for 288 // any given collection. This facility is kind of ugly though and should be 289 // replaced by something better when the configuration files are tidied up (as 290 // should all the other "format Preference..." options). 291 292 text_t &arg_l = args["l"]; 293 const recptconf &configinfo = recpt->get_configinfo(); 294 // put languages in another map to sort them by longname 295 text_tmap languages; 296 languageinfo_tmap::const_iterator thislang = configinfo.languages.begin(); 297 languageinfo_tmap::const_iterator endlang = configinfo.languages.end(); 298 while (thislang != endlang) { 299 languages[(*thislang).second.longname] = (*thislang).first; 300 thislang++; 301 } 302 text_tmap::iterator tlang = languages.begin(); 303 text_tmap::iterator elang = languages.end(); 304 305 text_t languageoption; 307 306 it = cinfo->format.find ("PreferenceLanguages"); 308 307 if ((it != cinfo->format.end()) && (!(*it).second.empty())) { … … 310 309 splitchar ((*it).second.begin(), (*it).second.end(), '|', pref_langs); 311 310 if (pref_langs.size() > 1) { 312 while (this_lang != end_lang) { 313 if (pref_langs.find(*this_lang) != pref_langs.end()) 314 languageoption += "_" + *this_lang + "languageoption_\n"; 315 this_lang ++; 311 while (tlang != elang) { 312 if (pref_langs.find((*tlang).second) != pref_langs.end()) { 313 languageoption += "<option value=\"" + (*tlang).second + "\""; 314 if ((*tlang).second == arg_l) languageoption += " selected"; 315 languageoption += ">" + (*tlang).first + "\n"; 316 } 317 tlang ++; 316 318 } 317 languageoption += "</select>\n"; 318 disp.setmacro ("languageoption", "preferences", languageoption); 319 } 320 321 // _encodingoption_ 322 323 if (pref_langs.find("zh") == pref_langs.end()) 324 disp.setmacro ("encodingoption", "preferences", ""); 319 } 325 320 326 321 } else { 327 while (this_lang != end_lang) { 328 languageoption += "_" + *this_lang + "languageoption_\n"; 329 this_lang ++; 330 } 322 while (tlang != elang) { 323 languageoption += "<option value=\"" + (*tlang).second + "\""; 324 if ((*tlang).second == arg_l) languageoption += " selected"; 325 languageoption += ">" + (*tlang).first + "\n"; 326 tlang ++; 327 } 328 } 329 if (!languageoption.empty()) { 330 languageoption = "<select name=\"l\" onChange=\"updatel();\">\n" + languageoption; 331 331 languageoption += "</select>\n"; 332 332 disp.setmacro ("languageoption", "preferences", languageoption); 333 } 334 335 // _encodingoption_ 336 // create the "encoding" selection box for the preferences page 337 text_t &arg_w = args["w"]; 338 // put encodings in another map to sort them by longname 339 text_tmap encodings; 340 encodinginfo_tmap::const_iterator thisenc = configinfo.encodings.begin(); 341 encodinginfo_tmap::const_iterator endenc = configinfo.encodings.end(); 342 while (thisenc != endenc) { 343 encodings[(*thisenc).second.longname] = (*thisenc).first; 344 thisenc++; 345 } 346 text_tmap::iterator tenc = encodings.begin(); 347 text_tmap::iterator eenc = encodings.end(); 348 349 text_t encodingoption; 350 while (tenc != eenc) { 351 encodingoption += "<option value=\"" + (*tenc).second + "\""; 352 if ((*tenc).second == arg_w) encodingoption += " selected"; 353 encodingoption += ">" + (*tenc).first + "\n"; 354 tenc ++; 355 } 356 357 if (!encodingoption.empty()) { 358 encodingoption = "<select name=\"w\" onChange=\"updatew();\">\n" + encodingoption; 359 encodingoption += "</select>\n"; 360 disp.setmacro ("encodingoption", "preferences", encodingoption); 333 361 } 334 362
Note:
See TracChangeset
for help on using the changeset viewer.