Index: trunk/gsdl/macros/home.dm
===================================================================
--- trunk/gsdl/macros/home.dm	(revision 3624)
+++ trunk/gsdl/macros/home.dm	(revision 3625)
@@ -174,11 +174,9 @@
 <tr valign="top">
 <td>_preferences:textlanguage_</td>
-<td><select name="l" onChange="updatel();">
-<option value="en" _If_("_cgiargl_" eq "en", selected)>English
-<option value="fr" _If_("_cgiargl_" eq "fr", selected)>French
-<option value="es" _If_("_cgiargl_" eq "es", selected)>Spanish
-<option value="tr" _If_("_cgiargl_" eq "tr", selected)>Turkish
-</select>
-</td>
+<td>_languageoption_</td>
+</tr>
+<tr valign="top">
+<td>_preferences:textencoding_</td>
+<td>_encodingoption_</td>
 </tr>
 <tr valign="top">
Index: trunk/gsdl/src/recpt/pageaction.cpp
===================================================================
--- trunk/gsdl/src/recpt/pageaction.cpp	(revision 3624)
+++ trunk/gsdl/src/recpt/pageaction.cpp	(revision 3625)
@@ -93,13 +93,4 @@
   }
 
-  // for UNESCO ONLY
-#if 0
-  // the following hack resets the language argument to English if
-  // attempting to display the homepage in a language other than
-  // English or French - we do this because English and French are the
-  // only languages currently supported by the home page
-  if (args["p"] == "home" && args["l"] != "en" && args["l"] != "fr" && args["l"] != "es") args["l"] = "en";
-#endif
-
   return true;
 }
@@ -358,4 +349,86 @@
 }
 
+void pageaction::set_language_encoding_macros(displayclass &disp, cgiargsclass &args,
+					      recptprotolistclass *protos, ColInfoResponse_t *cinfo,
+					      ostream &logout) {
+  // _languageoption_
+  // Create the "interface language" selection box for the preferences
+  // pages.  You can use something like "format PreferenceLanguages
+  // en|fr|zn" from within a collect.cfg file to use only a subset of
+  // the available languages for any given collection (for
+  // collection-specific preferences pages). This facility is kind of
+  // ugly though and should be replaced by something better when the
+  // configuration files are tidied up (as should all the other
+  // "format Preference..." options).
+  text_t &arg_l = args["l"];
+  const recptconf &configinfo = recpt->get_configinfo();
+  // put languages in another map to sort them by longname
+  text_tmap languages;
+  languageinfo_tmap::const_iterator thislang = configinfo.languages.begin();
+  languageinfo_tmap::const_iterator endlang = configinfo.languages.end();
+  while (thislang != endlang) {
+    languages[(*thislang).second.longname] = (*thislang).first;
+    thislang++;
+  }
+  text_tmap::iterator tlang = languages.begin();
+  text_tmap::iterator elang = languages.end();
+
+  text_t languageoption;
+  bool collection_specific = false;
+
+  if (cinfo != NULL) {
+    text_tmap::const_iterator it = cinfo->format.find ("PreferenceLanguages");
+    if ((it != cinfo->format.end()) && (!(*it).second.empty())) {
+      collection_specific = true;
+      text_tset pref_langs;
+      splitchar ((*it).second.begin(), (*it).second.end(), '|', pref_langs);
+      if (pref_langs.size() > 1) {
+	while (tlang != elang) {
+	  if (pref_langs.find((*tlang).second) != pref_langs.end()) {
+	    languageoption += "<option value=\"" + (*tlang).second + "\"";
+	    if ((*tlang).second == arg_l) languageoption += " selected";
+	    languageoption += ">" + (*tlang).first + "\n";
+	  }
+	  tlang ++;
+	}
+      }
+    }
+  }
+
+  if (!collection_specific) {
+    while (tlang != elang) {
+      languageoption += "<option value=\"" + (*tlang).second + "\"";
+      if ((*tlang).second == arg_l) languageoption += " selected";
+      languageoption += ">" + (*tlang).first + "\n";
+      tlang ++;
+    }
+  }
+
+  if (!languageoption.empty()) {
+    languageoption = "<select name=\"l\" onChange=\"updatel();\">\n" + languageoption;
+    languageoption += "</select>\n";
+    disp.setmacro ("languageoption", args["p"], languageoption);
+  }
+
+  // _encodingoption_
+  // create the "encoding" selection box for the preferences page
+  if (configinfo.encodings.size() > 1) {
+    text_t &arg_w = args["w"];
+    text_t encodingoption;
+    text_tmap::const_iterator thisenc = configinfo.encodings.begin();
+    text_tmap::const_iterator endenc = configinfo.encodings.end();
+    while (thisenc != endenc) {
+      encodingoption += "<option value=\"" + (*thisenc).second + "\"";
+      if ((*thisenc).second == arg_w) encodingoption += " selected";
+      encodingoption += ">" + (*thisenc).first + "\n";
+      thisenc ++;
+    }
+
+    encodingoption = "<select name=\"w\" onChange=\"updatew();\">\n" + encodingoption;
+    encodingoption += "</select>\n";
+    disp.setmacro ("encodingoption", args["p"], encodingoption);
+  }
+}
+
 void pageaction::define_internal_macros (displayclass &disp, cgiargsclass &args, 
 					 recptprotolistclass *protos, ostream &logout) {
@@ -379,7 +452,10 @@
   // _PreferencesDocsFromWeb_ set to 1 if corresponding format option is set
 
+
+  // if page is "preferences" or "homepref"
   // _languageoption_      interface languages to select from (dependant on PreferenceLanguages)
 
   // _encodingoption_      encodings to select from
+
 
   // if page is "about"
@@ -470,8 +546,16 @@
     if (status_disabled) disp.setmacro ("textgoadmin", "home", "");
     if (collector_disabled) disp.setmacro ("textgocollector", "home", "");
-  }
-  
-  else if (arg_p == "preferences") {
+
+  } else if (arg_p == "homepref") {
+  
+    // set _languageoption_ and _encodingoption_
+    set_language_encoding_macros(disp, args, protos, cinfo, logout);
+
+  } else if (arg_p == "preferences") {
     if (collectproto == NULL) {return;}
+    
+    // set _languageoption_ and _encodingoption_
+    set_language_encoding_macros(disp, args, protos, cinfo, logout);
+
     // _collectionoption_
 
@@ -514,74 +598,4 @@
       if ((it == cinfo->format.end()) || ((*it).second == "true"))
 	disp.setmacro ("PreferenceDocsFromWeb", "preferences", "1");
-    }
-
-    // _languageoption_
-    // Create the "interface language" selection box for the preferences page.
-    // You can use something like "format PreferenceLanguages en|fr|zn" from within
-    // a collect.cfg file to use only a subset of the available languages for
-    // any given collection. This facility is kind of ugly though and should be
-    // replaced by something better when the configuration files are tidied up (as
-    // should all the other "format Preference..." options).
-    
-    text_t &arg_l = args["l"];
-    const recptconf &configinfo = recpt->get_configinfo();
-    // put languages in another map to sort them by longname
-    text_tmap languages;
-    languageinfo_tmap::const_iterator thislang = configinfo.languages.begin();
-    languageinfo_tmap::const_iterator endlang = configinfo.languages.end();
-    while (thislang != endlang) {
-      languages[(*thislang).second.longname] = (*thislang).first;
-      thislang++;
-    }
-    text_tmap::iterator tlang = languages.begin();
-    text_tmap::iterator elang = languages.end();
-
-    text_t languageoption;
-    it = cinfo->format.find ("PreferenceLanguages");
-    if ((it != cinfo->format.end()) && (!(*it).second.empty())) {
-      text_tset pref_langs;
-      splitchar ((*it).second.begin(), (*it).second.end(), '|', pref_langs);
-      if (pref_langs.size() > 1) {
-	while (tlang != elang) {
-	  if (pref_langs.find((*tlang).second) != pref_langs.end()) {
-	    languageoption += "<option value=\"" + (*tlang).second + "\"";
-	    if ((*tlang).second == arg_l) languageoption += " selected";
-	    languageoption += ">" + (*tlang).first + "\n";
-	  }
-	  tlang ++;
-	}
-      }
-
-    } else {
-      while (tlang != elang) {
-	languageoption += "<option value=\"" + (*tlang).second + "\"";
-	if ((*tlang).second == arg_l) languageoption += " selected";
-	languageoption += ">" + (*tlang).first + "\n";
-	tlang ++;
-      }
-    }
-    if (!languageoption.empty()) {
-      languageoption = "<select name=\"l\" onChange=\"updatel();\">\n" + languageoption;
-      languageoption += "</select>\n";
-      disp.setmacro ("languageoption", "preferences", languageoption);
-    }
-
-    // _encodingoption_
-    // create the "encoding" selection box for the preferences page
-    if (configinfo.encodings.size() > 1) {
-      text_t &arg_w = args["w"];
-      text_t encodingoption;
-      text_tmap::const_iterator thisenc = configinfo.encodings.begin();
-      text_tmap::const_iterator endenc = configinfo.encodings.end();
-      while (thisenc != endenc) {
-	encodingoption += "<option value=\"" + (*thisenc).second + "\"";
-	if ((*thisenc).second == arg_w) encodingoption += " selected";
-	encodingoption += ">" + (*thisenc).first + "\n";
-	thisenc ++;
-      }
-
-      encodingoption = "<select name=\"w\" onChange=\"updatew();\">\n" + encodingoption;
-      encodingoption += "</select>\n";
-      disp.setmacro ("encodingoption", "preferences", encodingoption);
     }
 
Index: trunk/gsdl/src/recpt/pageaction.h
===================================================================
--- trunk/gsdl/src/recpt/pageaction.h	(revision 3624)
+++ trunk/gsdl/src/recpt/pageaction.h	(revision 3625)
@@ -78,4 +78,9 @@
 				   const text_t &packagename, const text_t &filename);
 
+  void set_language_encoding_macros(displayclass &disp, cgiargsclass &args,
+				    recptprotolistclass *protos, ColInfoResponse_t *cinfo,
+				    ostream &logout);
+
+
   bool status_disabled;
   bool collector_disabled;
