Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added the actual library.

  • Loading branch information...
commit 2d70b9b0b3b9f6da197d85e7b694763e6e4b4189 1 parent 5b3fe3f
@krzysz00 authored
View
5 cl-gettext.asd
@@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
:serial t
:components ((:file "defpackage")
(:file "gettext-cffi")
-
+ (:file "gettext-loader")
+ (:file "gettext")
)
- :depends-on (:cffi))
+ :depends-on (:cffi :alexandria))
View
22 defpackage.lisp
@@ -21,9 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
(defpackage :cl-gettext
(:nicknames :cl-gettext)
- (:use :cl
- ;; Packages you want to import go here
- )
+ (:use :cl)
(:export
:gettext
:ngettext
@@ -32,5 +30,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
:bind_textdomain_codeset
:setlocale
:localeconv
- ))
+ :init-gettext
+ :_
+ :_noop
+ :LC_CTYPE
+ :LC_NUMERIC
+ :LC_TIME
+ :LC_COLLATE
+ :LC_MONETARY
+ :LC_MESSAGES
+ :LC_ALL
+ :LC_PAPER
+ :LC_NAME
+ :LC_ADDRESS
+ :LC_TELEPHONE
+ :LC_MEASUREMENT
+ :LC_IDENTIFICATION
+ ))
View
26 gettext-cffi.lisp
@@ -109,19 +109,19 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
(__codeset :string))
(defanonenum
- (__LC_CTYPE #.0)
- (__LC_NUMERIC #.1)
- (__LC_TIME #.2)
- (__LC_COLLATE #.3)
- (__LC_MONETARY #.4)
- (__LC_MESSAGES #.5)
- (__LC_ALL #.6)
- (__LC_PAPER #.7)
- (__LC_NAME #.8)
- (__LC_ADDRESS #.9)
- (__LC_TELEPHONE #.10)
- (__LC_MEASUREMENT #.11)
- (__LC_IDENTIFICATION #.12))
+ (LC_CTYPE #.0)
+ (LC_NUMERIC #.1)
+ (LC_TIME #.2)
+ (LC_COLLATE #.3)
+ (LC_MONETARY #.4)
+ (LC_MESSAGES #.5)
+ (LC_ALL #.6)
+ (LC_PAPER #.7)
+ (LC_NAME #.8)
+ (LC_ADDRESS #.9)
+ (LC_TELEPHONE #.10)
+ (LC_MEASUREMENT #.11)
+ (LC_IDENTIFICATION #.12))
(cffi:defcstruct lconv
(decimal_point :string)
View
25 gettext-loader.lisp
@@ -0,0 +1,25 @@
+#|
+cl-gettext - Common Lisp binding to GNU gettext
+Copyright (C) 2011 Krzysztof Drewniak <krzysdrewniak <AT> gmail <DOT> com>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the Lisp Lesser General Public
+License, as published by the Free Software Foundation and Franz Inc.; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lisp
+Lesser General Public License for more details.
+
+You should have received a copy of the Lisp Lesser General Public
+License along with this library (in the file COPYING); if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+|#
+
+(in-package :cl-gettext)
+
+;; (cffi:define-foreign-library gettext
+;; (:unix "libc.so")
+;; (t (:default "libintl")))
+;; (cffi:use-foreign-library gettext)
View
31 gettext.lisp
@@ -0,0 +1,31 @@
+#|
+cl-gettext - Common Lisp binding to GNU gettext
+Copyright (C) 2011 Krzysztof Drewniak <krzysdrewniak <AT> gmail <DOT> com>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the Lisp Lesser General Public
+License, as published by the Free Software Foundation and Franz Inc.; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Lisp
+Lesser General Public License for more details.
+
+You should have received a copy of the Lisp Lesser General Public
+License along with this library (in the file COPYING); if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+|#
+
+(in-package :cl-gettext)
+
+(defun init-gettext (textdomain directory &optional (locales '(LC_ALL)))
+ (loop for i in locales do
+ (setlocale i ""))
+ (bindtextdomain textdomain directory)
+ (textdomain textdomain))
+
+(defmacro _ (string) `(gettext ,string))
+
+(defmacro _noop (string)
+ "Gettext noop" string)
Please sign in to comment.
Something went wrong with that request. Please try again.