Raymond Toy pushed to branch issue-141-locale at cmucl / cmucl
Commits:
- 
b935fbf1
by Raymond Toy at 2022-11-08T14:12:08-08:00
4 changed files:
Changes:
| ... | ... | @@ -520,7 +520,7 @@ | 
| 520 | 520 | |
| 521 | 521 |  (defun setlocale (&optional locale)
 | 
| 522 | 522 |    (setf *locale* (or locale
 | 
| 523 | -		     (unix::unix-getlocale)
 | |
| 523 | +		     (unix::unix-get-lc-messages)
 | |
| 524 | 524 |  		     *locale*)))
 | 
| 525 | 525 | |
| 526 | 526 |  (defmacro textdomain (domain)
 | 
| ... | ... | @@ -2900,14 +2900,14 @@ | 
| 2900 | 2900 |     (alien:extern-alien "os_setlocale"
 | 
| 2901 | 2901 |  		       (function c-call:int))))
 | 
| 2902 | 2902 | |
| 2903 | -(defun unix-getlocale ()
 | |
| 2904 | -  _N"Get the current locale.  If we can't, return NIL.  A call to
 | |
| 2905 | -  UNIX-SETLOCALE must have been done previously before calling this so
 | |
| 2906 | -  that the correct locale is returned."
 | |
| 2903 | +(defun unix-get-lc-messages ()
 | |
| 2904 | +  _N"Get LC_MESSAGES from the current locale.  If we can't, return
 | |
| 2905 | +  NIL.  A call to UNIX-SETLOCALE must have been done previously before
 | |
| 2906 | +  calling this so that the correct locale is returned."
 | |
| 2907 | 2907 |    (with-alien ((buf (array c-call:char 256)))
 | 
| 2908 | 2908 |      (let ((result
 | 
| 2909 | 2909 |  	    (alien-funcall
 | 
| 2910 | -	     (extern-alien "os_getlocale"
 | |
| 2910 | +	     (extern-alien "os_get_lc_messages"
 | |
| 2911 | 2911 |  			   (function c-call:int
 | 
| 2912 | 2912 |  				     (* c-call:char)
 | 
| 2913 | 2913 |  				     c-call:int))
 | 
| ... | ... | @@ -1430,8 +1430,8 @@ msgstr "" | 
| 1430 | 1430 | |
| 1431 | 1431 |  #: src/code/unix.lisp
 | 
| 1432 | 1432 |  msgid ""
 | 
| 1433 | -"Get the current locale.  If we can't, return NIL.  A call to\n"
 | |
| 1434 | -"  UNIX-SETLOCALE must have been done previously before calling this so\n"
 | |
| 1435 | -"  that the correct locale is returned."
 | |
| 1433 | +"Get LC_MESSAGES from the current locale.  If we can't, return\n"
 | |
| 1434 | +"  NIL.  A call to UNIX-SETLOCALE must have been done previously before\n"
 | |
| 1435 | +"  calling this so that the correct locale is returned."
 | |
| 1436 | 1436 |  msgstr ""
 | 
| 1437 | 1437 | 
| ... | ... | @@ -785,9 +785,9 @@ os_setlocale(void) | 
| 785 | 785 |  }
 | 
| 786 | 786 | |
| 787 | 787 |  int
 | 
| 788 | -os_getlocale(char *buf, int len)
 | |
| 788 | +os_get_lc_messages(char *buf, int len)
 | |
| 789 | 789 |  {
 | 
| 790 | -    char *locale = setlocale(LC_ALL, NULL);
 | |
| 790 | +    char *locale = setlocale(LC_MESSAGES, NULL);
 | |
| 791 | 791 |      if (locale) {
 | 
| 792 | 792 |          strncpy(buf, locale, len - 1);
 | 
| 793 | 793 |          buf[len - 1] = '\0';
 |