forcing of English :)



glibc has a much newer locale.alias file, listing new locales.  English is
no longer listed, however.  In the case that the locale.alias file is
removed, or a locale is removed, and English is not there, there is no way
to get back to good ol' "C".  I've attached a hackish patch to ensure that
English is always in the list, which solves the problem...

-- 
Ryan Murray, (rmurray cyberhqz com, rmurray debian org, rmurray stormix com)
Programmer, Stormix Technologies Inc., Debian Developer
The opinions expressed here are my own.
diff -ruN gdm-2.0beta4.orig/gui/gdmlogin.c gdm-2.0beta4/gui/gdmlogin.c
--- gdm-2.0beta4.orig/gui/gdmlogin.c	Sun Jun 18 18:00:36 2000
+++ gdm-2.0beta4/gui/gdmlogin.c	Sun Jun 18 17:51:22 2000
@@ -713,6 +713,7 @@
     FILE *langlist;
     char curline[256];
     char *ctmp, *ctmp1, *ctmp2;
+    BOOL english = 0;
 
     if (!menu)
 	return;
@@ -752,8 +753,7 @@
 
     langlist = fopen (GdmLocaleFile, "r");
 
-    if (!langlist)
-	return;
+    if (langlist) {
         
     while (fgets (curline, sizeof (curline), langlist)) {
 
@@ -773,6 +773,10 @@
 	*ctmp = '\0';
 	curline[0] = toupper (curline[0]);
 	
+	if ( !strcmp( curline, "English" ) ) {
+		english = 1;
+	}
+
 	item = gtk_radio_menu_item_new_with_label (languages, curline);
 	languages = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
 
@@ -790,6 +794,20 @@
     }
     
     fclose (langlist);
+    }
+
+	/*
+	 * This should maybe include more name checks than "English" (POSIX,
+	 * "C", etc...), but it's better than nothing.
+	 * It allows a user to always have a sane locale in the menu,
+	 * however, if all others were removed for some reason, or English
+	 * isn't in the installed list.
+	 */
+    if ( !english ) {
+	item = gtk_radio_menu_item_new_with_label (languages, "English" );
+	languages = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
+	gtk_menu_append (GTK_MENU (ammenu), item);
+    }
 }
 
 

Attachment: pgpKJpeglGHKU.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]