Split up in qt.gui & cleanup name prefix.
src/i18n.lisp
Sun Jan 10 09:52:49 CET 2010 Tobias Rautenkranz <tobias@rautenkranz.ch>
* Split up in qt.gui & cleanup name prefix.
--- old-qt.gui/src/i18n.lisp 2014-10-30 07:41:42.000000000 +0100
+++ new-qt.gui/src/i18n.lisp 1970-01-01 01:00:00.000000000 +0100
@@ -1,57 +0,0 @@
-(in-package :cl-smoke.qt-impl)
-
-(defun qt:tr (message &optional context)
- "Returns the translated MESSAGE for CONTEXT or
-a string STRING-EQUAL to MESSAGE when no translation was found.
-
-Translations can be loaded with WITH-TRANSLATOR."
- (qt:core-application.translate (or context "") message))
-
-(defmacro with-installed-translator (translator &body body)
- `(unwind-protect
- (progn
- (cxx:install-translator (qt:app) ,translator)
- ,@body)
- (cxx:remove-translator (qt:app) ,translator)))
-
-(defmacro qt:with-translator ((base-name &rest paths) &body body)
- "Loads the translations in the BASE-NAME_LANGCODE.qm file;
-searching PATHS.
-
-Must be in a WITH-APP."
- (let ((translator (gensym)))
- `(let ((,translator (make-instance 'qt:translator)))
- (unless
- (find-if #'(lambda (path)
- (cxx:load ,translator
- (format nil "~A_~A" ,base-name
- (cxx:name (qt:locale.system)))
- (namestring path)))
- (list ,@paths))
- (cerror "Ignore" "Loading the translations ~A for ~A failed."
- ,base-name (cxx:name (qt:locale.system))))
- (with-installed-translator ,translator
- ,@body))))
-
-(defmacro qt:with-libqt-translator (&body body)
- "Loads the translations for the Qt library.
-
-Must be in a WITH-APP."
- (let ((translator (gensym)))
- `(let ((,translator (make-instance 'qt:translator)))
- (unless (cxx:load ,translator (format nil "qt_~A"
- (cxx:name (qt:locale.system)))
- (qt:library-info.location qt:library-info.+translations-path+))
- (cerror "Ignore" "Loading the Qt library translations failed."))
- (with-installed-translator ,translator
- ,@body))))
-
-(defun qt:search-file (name &rest paths)
- "Searches the file NAME in PATHS and returns its path."
- (let ((file-path (find-if #'(lambda (path)
- (probe-file (merge-pathnames name path)))
- paths)))
- (unless file-path
- (error "The file ~S not found in the paths ~S" name paths))
- (merge-pathnames name file-path)))
-