Index: ephy-embed-prefs.h
===================================================================
RCS file: /cvs/gnome/epiphany/embed/ephy-embed-prefs.h,v
retrieving revision 1.13
diff -u -p -r1.13 ephy-embed-prefs.h
--- ephy-embed-prefs.h	1 Jan 2004 17:58:34 -0000	1.13
+++ ephy-embed-prefs.h	7 Jan 2004 20:25:53 -0000
@@ -3,7 +3,6 @@
 #define CONF_RENDERING_FONT_VAR_SIZE "/apps/epiphany/web/variable_font_size"
 #define CONF_RENDERING_FONT_FIXED_SIZE "/apps/epiphany/web/fixed_font_size"
 #define CONF_RENDERING_FONT_MIN_SIZE "/apps/epiphany/web/minimum_font_size"
-#define CONF_RENDERING_LANGUAGE "/apps/epiphany/web/language"
 #define CONF_RENDERING_USE_OWN_COLORS "/apps/epiphany/web/use_own_colors"
 #define CONF_RENDERING_USE_OWN_FONTS "/apps/epiphany/web/use_own_fonts"
 #define CONF_SECURITY_ALLOW_POPUPS "/apps/epiphany/web/allow_popups"
@@ -25,6 +24,7 @@
 #define CONF_NETWORK_SOCKS_PROXY_PORT "/system/proxy/socks_port"
 #define CONF_NETWORK_PROXY_AUTO_URL "/system/proxy/autoconfig_url"
 #define CONF_NETWORK_PROXY_IGNORE_HOSTS "/system/http_proxy/ignore_hosts"
+#define CONF_RENDERING_LANGUAGE "/desktop/gnome/interface/languages"
 
 /* DEPRECATED, we migrate them */
 #define CONF_RENDERING_FONT_VAR_SIZE_OLD "/apps/epiphany/web/font_var_size"
Index: mozilla/mozilla-notifiers.cpp
===================================================================
RCS file: /cvs/gnome/epiphany/embed/mozilla/mozilla-notifiers.cpp,v
retrieving revision 1.43
diff -u -p -r1.43 mozilla-notifiers.cpp
--- mozilla/mozilla-notifiers.cpp	1 Jan 2004 17:37:54 -0000	1.43
+++ mozilla/mozilla-notifiers.cpp	7 Jan 2004 20:25:53 -0000
@@ -716,104 +716,32 @@ mozilla_allow_popups_notifier(GConfClien
 	mozilla_prefs_set_boolean ("dom.disable_open_during_load", !value);
 }
 
-static char *
-get_system_language ()
-{
-	const GList *sys_langs;
-	const char *lang;
-
-	/**
-	 * This is a comma separated list of language ranges, as specified
-	 * by RFC 2616, 14.4.
-	 * Always include the basic language code last.
-	 *
-	 * Examples:
-	 * "pt"    translation: "pt"
-	 * "pt_BR" translation: "pt-br,pt"
-	 * "zh_CN" translation: "zh-cn,zh"
-	 * "zh_HK" translation: "zh-hk,zh" or maybe "zh-hk,zh-tw,zh"
-	 */
-	lang = _("system-language");
-	
-	if (strncmp (lang, "system-language", 15) != 0)
-	{
-		/* the l10n has it */
-		return g_strdup (lang);
-	}
-	
-	sys_langs = gnome_i18n_get_language_list ("LC_MESSAGES");
-
-	if (sys_langs)
-	{
-		char *lang = (char *)sys_langs->data;
-
-		/* FIXME this probably need to be smarter */
-		/* FIXME this can be up to 8 chars, not just 2 */
-		if (strcmp (lang, "C") != 0)
-		{
-			return g_strndup (lang, 2);
-		}
-	}
-
-	/* fallback to english */
-	return g_strdup ("en");
-}
-
 static void
 mozilla_language_notifier(GConfClient *client,
 			  guint cnxn_id,
 			  GConfEntry *entry,
 			  EphyEmbedSingle *single)
 {
-	GSList *languages, *l, *ulist = NULL;
+	GSList *languages, *l;
 	GString *result;
 
 	languages = eel_gconf_get_string_list (CONF_RENDERING_LANGUAGE);
 
-	result = g_string_new ("");
-
-	/* substitute the system language */
-	l = g_slist_find_custom (languages, "system", (GCompareFunc) strcmp);
-	if (l != NULL)
+	/* first normalize the entries: make them all-lowercase (mozilla does this),
+	 * and replace _ by - as required by the specification for Accept-Language:
+	 */
+	for (l = languages; l != NULL; l = l->next)
 	{
-		char *sys_lang;
-		int index;
+		char *lang = g_ascii_strdown ((char *) l->data, -1);
 
-		index = g_slist_position (languages, l);
 		g_free (l->data);
-		languages = g_slist_delete_link (languages, l);
-
-		sys_lang = get_system_language ();
-
-		if (sys_lang)
-		{
-			char **s;
-			int i = 0;
-
-			s = g_strsplit (sys_lang, ",", -1);
-			while (s[i] != NULL)
-			{
-				languages = g_slist_insert (languages, g_strdup (s[i]), index);
-
-				index ++;
-				i++;
-			}
-
-			g_strfreev (s);
-		}		
+		l->data = g_strdelimit (lang, "_", '-');
 	}
 
-	/* now make a list of unique entries */
-	for (l = languages; l != NULL; l = l->next)
-	{
-		if (g_slist_find_custom (ulist, l->data, (GCompareFunc) strcmp) == NULL)
-		{
-			ulist = g_slist_prepend (ulist, l->data);
-		}
-	}
-	ulist = g_slist_reverse (ulist);
+	/* now concatenate the strings */
+	result = g_string_sized_new (64);
 
-	for (l = ulist; l != NULL; l = l->next)
+	for (l = languages; l != NULL; l = l->next)
 	{
 		g_string_append (result, (char *)l->data);
 
@@ -826,7 +754,6 @@ mozilla_language_notifier(GConfClient *c
 
 	g_slist_foreach (languages, (GFunc) g_free, NULL);
 	g_slist_free (languages);
-	g_slist_free (ulist);
 }
 
 static void
