CMUCL commit: intl-branch src/code (intl.lisp)

Raymond Toy rtoy at common-lisp.net
Mon Feb 8 19:36:21 CET 2010


    Date: Monday, February 8, 2010 @ 13:36:21
  Author: rtoy
    Path: /project/cmucl/cvsroot/src/code
     Tag: intl-branch

Modified: intl.lisp

o Change the domain from "libintl" to "cmucl".
o Document that the comment reader handles "TRANSLATORS: " in a
  comment as translator comments that are written to the pot file.
o Change DUMP-POT-FILES to include a new keyword parameter to specify
  the output directory.  Each domain is written to a file in that
  directory. 


-----------+
 intl.lisp |   48 ++++++++++++++++++++++++++++++------------------
 1 file changed, 30 insertions(+), 18 deletions(-)


Index: src/code/intl.lisp
diff -u src/code/intl.lisp:1.1.2.1 src/code/intl.lisp:1.1.2.2
--- src/code/intl.lisp:1.1.2.1	Sun Feb  7 21:49:49 2010
+++ src/code/intl.lisp	Mon Feb  8 13:36:20 2010
@@ -1,6 +1,6 @@
 ;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Package: INTL -*-
 
-;;; $Revision: 1.1.2.1 $
+;;; $Revision: 1.1.2.2 $
 ;;; Copyright 1999-2010 Paul Foley (mycroft at actrix.gen.nz)
 ;;;
 ;;; Permission is hereby granted, free of charge, to any person obtaining
@@ -23,12 +23,12 @@
 ;;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 ;;; USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 ;;; DAMAGE.
-#+CMU (ext:file-comment "$Header: /project/cmucl/cvsroot/src/code/Attic/intl.lisp,v 1.1.2.1 2010-02-08 02:49:49 rtoy Exp $")
+(ext:file-comment "$Header: /project/cmucl/cvsroot/src/code/Attic/intl.lisp,v 1.1.2.2 2010-02-08 18:36:20 rtoy Exp $")
 
 (in-package "INTL")
 
 (eval-when (:compile-toplevel :execute)
-  (defparameter intl::*default-domain* "libintl")
+  (defparameter intl::*default-domain* "cmucl")
   (unless (and (fboundp 'intl:read-translatable-string)
 	       (eq (get-macro-character #\_)
 		   (fdefinition 'intl:read-translatable-string)))
@@ -587,6 +587,9 @@
        (let ((fn (get-macro-character #\_ nil)))
 	 (if fn (funcall fn stream #\_) '_)))))
 
+;; Process comments as usual, but look for lines that begin with
+;; "TRANSLATORS: ".  These lines are saved and written out as a
+;; translator comment for the next translatable string.
 #-runtime
 (defun read-comment (stream char)
   (declare (optimize (speed 0) (space 3) #-gcl (debug 0))
@@ -659,8 +662,10 @@
   t)
 
 
+;; Dump the translatable strings.  The output is written to a file in
+;; the directory OUTPUT-DIRECTORY and its name is the domain.
 #-runtime
-(defun dump-pot-files (&key copyright)
+(defun dump-pot-files (&key copyright output-directory)
   (declare (optimize (speed 0) (space 3) #-gcl (debug 1)))
   (labels ((b (key data)
 	     (format t "~@[~{~&#. ~A~}~%~]" (delete nil (car data)))
@@ -741,20 +746,27 @@
 		 (when i (write-char #\\ nil) (write-char (char string i) nil))
 		 (setq start (if i (1+ i) end)))))
 	   (a (domain hash)
-	     (format t "~&#@ ~A~2%" domain)
-	     (format t "~&# SOME DESCRIPTIVE TITLE~%")
-	     (format t "~@[~&# Copyright (C) YEAR ~A~%~]" copyright)
-	     (format t "~&# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR~%")
-	     (format t "~&#~%#, fuzzy~%msgid \"\"~%msgstr \"\"~%")
-	     (format t "~&\"Project-Id-Version: PACKAGE VERSION\\n\"~%")
-	     (format t "~&\"Report-Msgid-Bugs-To: \\n\"~%")
-	     (format t "~&\"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\\n\"~%")
-	     (format t "~&\"Last-Translator: FULL NAME <EMAIL at ADDRESS>\\n\"~%")
-	     (format t "~&\"Language-Team: LANGUAGE <LL at li.org>\\n\"~%")
-	     (format t "~&\"MIME-Version: 1.0\\n\"~%")
-	     (format t "~&\"Content-Type: text/plain; charset=UTF-8\\n\"~%")
-	     (format t "~&\"Content-Transfer-Encoding: 8bit\\n\"~2%")
-	     (maphash #'b hash)))
+	     (with-open-file (*standard-output*
+			      (merge-pathnames (make-pathname :name domain
+							      :type "pot")
+					       output-directory)
+			      :direction :output
+			      :if-exists :new-version
+			      :external-format :utf8)
+	       (format t "~&#@ ~A~2%" domain)
+	       (format t "~&# SOME DESCRIPTIVE TITLE~%")
+	       (format t "~@[~&# Copyright (C) YEAR ~A~%~]" copyright)
+	       (format t "~&# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR~%")
+	       (format t "~&#~%#, fuzzy~%msgid \"\"~%msgstr \"\"~%")
+	       (format t "~&\"Project-Id-Version: PACKAGE VERSION\\n\"~%")
+	       (format t "~&\"Report-Msgid-Bugs-To: \\n\"~%")
+	       (format t "~&\"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\\n\"~%")
+	       (format t "~&\"Last-Translator: FULL NAME <EMAIL at ADDRESS>\\n\"~%")
+	       (format t "~&\"Language-Team: LANGUAGE <LL at li.org>\\n\"~%")
+	       (format t "~&\"MIME-Version: 1.0\\n\"~%")
+	       (format t "~&\"Content-Type: text/plain; charset=UTF-8\\n\"~%")
+	       (format t "~&\"Content-Transfer-Encoding: 8bit\\n\"~2%")
+	       (maphash #'b hash))))
     (maphash #'a *translations*)
     #+(or)
     (clrhash *translations*))



More information about the cmucl-commit mailing list