[Git][cmucl/cmucl][issue-141-locale] Use LC_MESSAGES for intl::*locale*

Raymond Toy (@rtoy) gitlab at common-lisp.net
Tue Nov 8 22:13:03 UTC 2022



Raymond Toy pushed to branch issue-141-locale at cmucl / cmucl


Commits:
b935fbf1 by Raymond Toy at 2022-11-08T14:12:08-08:00
Use LC_MESSAGES for intl::*locale*

For intl::setlocale, get the information from LC_MESSAGES; that's
really what intl wants to know---the language to use for translations.

To make it clearer, rename os_getlocale to os_get_lc_messages, and do
the corresponding change for unix-get-lc-messages.

Update the translation pot file because the docstring changed.

- - - - -


4 changed files:

- src/code/intl.lisp
- src/code/unix.lisp
- src/i18n/locale/cmucl-unix.pot
- src/lisp/os-common.c


Changes:

=====================================
src/code/intl.lisp
=====================================
@@ -520,7 +520,7 @@
 
 (defun setlocale (&optional locale)
   (setf *locale* (or locale
-		     (unix::unix-getlocale)
+		     (unix::unix-get-lc-messages)
 		     *locale*)))
 
 (defmacro textdomain (domain)


=====================================
src/code/unix.lisp
=====================================
@@ -2900,14 +2900,14 @@
    (alien:extern-alien "os_setlocale"
 		       (function c-call:int))))
 
-(defun unix-getlocale ()
-  _N"Get the current locale.  If we can't, return NIL.  A call to
-  UNIX-SETLOCALE must have been done previously before calling this so
-  that the correct locale is returned."
+(defun unix-get-lc-messages ()
+  _N"Get LC_MESSAGES from the current locale.  If we can't, return
+  NIL.  A call to UNIX-SETLOCALE must have been done previously before
+  calling this so that the correct locale is returned."
   (with-alien ((buf (array c-call:char 256)))
     (let ((result
 	    (alien-funcall
-	     (extern-alien "os_getlocale"
+	     (extern-alien "os_get_lc_messages"
 			   (function c-call:int
 				     (* c-call:char)
 				     c-call:int))


=====================================
src/i18n/locale/cmucl-unix.pot
=====================================
@@ -1430,8 +1430,8 @@ msgstr ""
 
 #: src/code/unix.lisp
 msgid ""
-"Get the current locale.  If we can't, return NIL.  A call to\n"
-"  UNIX-SETLOCALE must have been done previously before calling this so\n"
-"  that the correct locale is returned."
+"Get LC_MESSAGES from the current locale.  If we can't, return\n"
+"  NIL.  A call to UNIX-SETLOCALE must have been done previously before\n"
+"  calling this so that the correct locale is returned."
 msgstr ""
 


=====================================
src/lisp/os-common.c
=====================================
@@ -785,9 +785,9 @@ os_setlocale(void)
 }
 
 int
-os_getlocale(char *buf, int len)
+os_get_lc_messages(char *buf, int len)
 {
-    char *locale = setlocale(LC_ALL, NULL);
+    char *locale = setlocale(LC_MESSAGES, NULL);
     if (locale) {
         strncpy(buf, locale, len - 1);
         buf[len - 1] = '\0';



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/b935fbf1ce1807fcb5323d7e39c5bd06c66c294b

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/b935fbf1ce1807fcb5323d7e39c5bd06c66c294b
You're receiving this email because of your account on gitlab.common-lisp.net.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20221108/db98e070/attachment-0001.html>


More information about the cmucl-cvs mailing list