From: Vadim V. Z. <vv...@us...> - 2005-12-11 14:21:12
|
Update of /cvsroot/maxima/maxima/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30459/src Modified Files: init-cl.lisp Log Message: New configuration variable *maxima-lang-subdir* This is name of sub-directory where Maxima looks for localized documentation and possible other language specific data. This is not absolute path but rather sub-directory of default (English) documentation directory. Function (set-locale) sets *maxima-lang-subdir* according to current user locale. Environment variable MAXIMA_LANG_SUBDIR overrides this setting. Index: init-cl.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/src/init-cl.lisp,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- init-cl.lisp 2 Dec 2005 06:50:34 -0000 1.51 +++ init-cl.lisp 11 Dec 2005 14:21:03 -0000 1.52 @@ -26,6 +26,7 @@ (defvar *maxima-layout-autotools*) (defvar *maxima-userdir*) (defvar *maxima-tempdir*) +(defvar *maxima-lang-subdir*) (defun print-directories () (format t "maxima-prefix=~a~%" *maxima-prefix*) @@ -42,6 +43,7 @@ (format t "maxima-layout-autotools=~a~%" *maxima-layout-autotools*) (format t "maxima-userdir=~a~%" *maxima-userdir*) (format t "maxima-tempdir=~a~%" *maxima-tempdir*) + (format t "maxima-lang-subpdir=~a~%" *maxima-lang-subdir*) ($quit)) (defvar *maxima-lispname* #+clisp "clisp" @@ -189,6 +191,36 @@ "/tmp"))) (maxima-parse-dirstring base-dir))) +(defun set-locale () + (let (locale language territory codeset) + (unless (setq *maxima-lang-subdir* (maxima-getenv "MAXIMA_LANG_SUBDIR")) + (setq locale (or (maxima-getenv "LC_ALL") + (maxima-getenv "LC_MESSAGES") + (maxima-getenv "LANG"))) + (cond + ((null locale) + (setq *maxima-lang-subdir* nil)) + ((zl-member locale '("C" "POSIX" "c" "posix")) + (setq *maxima-lang-subdir* nil)) + (t (when (eql (position #\. locale) 5) + (setq codeset (subseq locale 6))) + (when (eql (position #\_ locale) 2) + (setq territory (string-upcase (subseq locale 3 5)))) + (setq language (string-downcase (subseq locale 0 2))) + ;; Set *maxima-lang-subdir* only for known languages. + ;; Extend procedure below as soon as new translation + ;; is available. + (cond + ;; English + ;; no subdir (default direcrory) + ((equal language "en") + (setq *maxima-lang-subdir* nil)) + ;; Latin-1 aka iso-8859-1 languages + ;; subdir = two-char language code + ((zl-member language '("es" "pt")) + (setq *maxima-lang-subdir* language)) + (t (setq *maxima-lang-subdir* nil))) ))))) + (defun set-pathnames () (let ((maxima-prefix-env (maxima-getenv "MAXIMA_PREFIX")) (maxima-layout-autotools-env (maxima-getenv "MAXIMA_LAYOUT_AUTOTOOLS")) @@ -454,6 +486,7 @@ (catch 'to-lisp (set-pathnames) + (set-locale) (setf (values input-stream batch-flag) (process-maxima-args input-stream batch-flag)) (progn |