changeset 23299:00fa89a27438

(locale-translation-file-name): Prefer X-related names to the name used by GNU/Linux sans X. Set to nil if no file found. (command-line): Use locale-translation-file-name if it is not nil, instead of testing for its existence again. regexp-quote the ctype before using it in a regexp. Allow a colon to appear after the ctype in the aliases file, as is done in X11R6.4.
author Paul Eggert <eggert@twinsun.com>
date Tue, 22 Sep 1998 06:12:49 +0000
parents 116f19dd86dc
children 10f889f1c168
files lisp/startup.el
diffstat 1 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/startup.el	Mon Sep 21 19:47:00 1998 +0000
+++ b/lisp/startup.el	Tue Sep 22 06:12:49 1998 +0000
@@ -329,8 +329,19 @@
 		 string)
   :group 'auto-save)
 
-(defvar locale-translation-file-name "/usr/share/locale/locale.alias"
-  "*File name for the system's file of locale-name aliases.")
+(defvar locale-translation-file-name
+  (let ((files '("/usr/lib/X11/locale/locale.alias" ; e.g. X11R6.4
+		 "/usr/X11R6/lib/X11/locale/locale.alias" ; e.g. RedHat 4.2
+		 "/usr/openwin/lib/locale/locale.alias" ; e.g. Solaris 2.6
+		 ;;
+		 ;; The following name appears after the X-related names above,
+		 ;; since the X-related names are what X actually uses.
+		 "/usr/share/locale/locale.alias" ; GNU/Linux sans X
+		 )))
+    (while (and files (not (file-exists-p (car files))))
+      (setq files (cdr files)))
+    (car files))
+  "*File name for the system's file of locale-name aliases, or nil if none.")
 
 (defvar init-file-debug nil)
 
@@ -505,11 +516,12 @@
     ;; Translate "swedish" into "sv_SE.ISO-8859-1", and so on,
     ;; using the translation file that GNU/Linux systems have.
     (and ctype
+	 locale-translation-file-name
 	 (not (string-match iso-8859-n-locale-regexp ctype))
-	 (file-exists-p locale-translation-file-name)
 	 (with-temp-buffer
 	   (insert-file-contents locale-translation-file-name)
-	   (if (re-search-forward (concat "^" ctype "[ \t]+") nil t)
+	   (if (re-search-forward
+		(concat "^" (regexp-quote ctype) ":?[ \t]+") nil t)
 	       (setq ctype (buffer-substring (point)
 					     (progn (end-of-line) (point)))))))
     ;; Now see if the locale specifies an ISO 8859 character set.