diff options
| author | Glenn Morris | 2008-02-08 20:43:16 +0000 |
|---|---|---|
| committer | Glenn Morris | 2008-02-08 20:43:16 +0000 |
| commit | 44ee1bdfe448c47dbf06fe06081cbc0725e0c6af (patch) | |
| tree | 3f47ed22acb780d95921f5311d19fc6607eb1857 | |
| parent | 737e2b960a83eee440d450710a5a43a2feec7baa (diff) | |
| download | emacs-44ee1bdfe448c47dbf06fe06081cbc0725e0c6af.tar.gz emacs-44ee1bdfe448c47dbf06fe06081cbc0725e0c6af.zip | |
(locale-translate): New function, with old code extracted from
set-locale-environment.
(set-locale-environment): Use locale-translate. Set woman-locale.
| -rw-r--r-- | lisp/international/mule-cmds.el | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el index d05971092ee..0621900ce4f 100644 --- a/lisp/international/mule-cmds.el +++ b/lisp/international/mule-cmds.el | |||
| @@ -2422,6 +2422,19 @@ is returned. Thus, for instance, if charset \"ISO8859-2\", | |||
| 2422 | ;; too, for setting things such as calendar holidays, ps-print paper | 2422 | ;; too, for setting things such as calendar holidays, ps-print paper |
| 2423 | ;; size, spelling dictionary. | 2423 | ;; size, spelling dictionary. |
| 2424 | 2424 | ||
| 2425 | (defun locale-translate (locale) | ||
| 2426 | "Expand LOCALE according to `locale-translation-file-name', if possible. | ||
| 2427 | For example, translate \"swedish\" into \"sv_SE.ISO8859-1\"." | ||
| 2428 | (if locale-translation-file-name | ||
| 2429 | (with-temp-buffer | ||
| 2430 | (set-buffer-multibyte nil) | ||
| 2431 | (insert-file-contents locale-translation-file-name) | ||
| 2432 | (if (re-search-forward | ||
| 2433 | (concat "^" (regexp-quote locale) ":?[ \t]+") nil t) | ||
| 2434 | (buffer-substring (point) (line-end-position)) | ||
| 2435 | locale)) | ||
| 2436 | locale)) | ||
| 2437 | |||
| 2425 | (defun set-locale-environment (&optional locale-name frame) | 2438 | (defun set-locale-environment (&optional locale-name frame) |
| 2426 | "Set up multi-lingual environment for using LOCALE-NAME. | 2439 | "Set up multi-lingual environment for using LOCALE-NAME. |
| 2427 | This sets the language environment, the coding system priority, | 2440 | This sets the language environment, the coding system priority, |
| @@ -2491,16 +2504,7 @@ See also `locale-charset-language-names', `locale-language-names', | |||
| 2491 | (setq locale mac-system-locale)) | 2504 | (setq locale mac-system-locale)) |
| 2492 | 2505 | ||
| 2493 | (when locale | 2506 | (when locale |
| 2494 | 2507 | (setq locale (locale-translate locale)) | |
| 2495 | ;; Translate "swedish" into "sv_SE.ISO8859-1", and so on, | ||
| 2496 | ;; using the translation file that many systems have. | ||
| 2497 | (when locale-translation-file-name | ||
| 2498 | (with-temp-buffer | ||
| 2499 | (set-buffer-multibyte nil) | ||
| 2500 | (insert-file-contents locale-translation-file-name) | ||
| 2501 | (when (re-search-forward | ||
| 2502 | (concat "^" (regexp-quote locale) ":?[ \t]+") nil t) | ||
| 2503 | (setq locale (buffer-substring (point) (line-end-position)))))) | ||
| 2504 | 2508 | ||
| 2505 | ;; Leave the system locales alone if the caller did not specify | 2509 | ;; Leave the system locales alone if the caller did not specify |
| 2506 | ;; an explicit locale name, as their defaults are set from | 2510 | ;; an explicit locale name, as their defaults are set from |
| @@ -2508,8 +2512,16 @@ See also `locale-charset-language-names', `locale-language-names', | |||
| 2508 | ;; want to set them to the same value as LC_CTYPE. | 2512 | ;; want to set them to the same value as LC_CTYPE. |
| 2509 | (when locale-name | 2513 | (when locale-name |
| 2510 | (setq system-messages-locale locale) | 2514 | (setq system-messages-locale locale) |
| 2511 | (setq system-time-locale locale)) | 2515 | (setq system-time-locale locale))) |
| 2512 | 2516 | ||
| 2517 | (setq woman-locale | ||
| 2518 | (or system-messages-locale | ||
| 2519 | (let ((msglocale (getenv "LC_MESSAGES"))) | ||
| 2520 | (if (zerop (length msglocale)) | ||
| 2521 | locale | ||
| 2522 | (locale-translate msglocale))))) | ||
| 2523 | |||
| 2524 | (when locale | ||
| 2513 | (setq locale (downcase locale)) | 2525 | (setq locale (downcase locale)) |
| 2514 | 2526 | ||
| 2515 | (let ((language-name | 2527 | (let ((language-name |