Changeset 3283
- Timestamp:
- 06/17/08 11:14:07 (7 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/projects/bos/web/multi-language-dictionary.lisp
r3275 r3283 1 1 (in-package :bos.web) 2 2 3 (defvar * multi-language-dictionary* (make-hash-table :test #'equal))4 (defvar * multi-language-dictionary-last-read* 0)3 (defvar *dictionary* (make-hash-table :test #'equal)) 4 (defvar *dictionary-last-read* 0) 5 5 6 6 (defmethod dictionary-entry ((key string) (language website-language)) 7 7 (load-dictionary-if-needed) 8 (cdr (assoc language (gethash key * multi-language-dictionary*))))8 (cdr (assoc language (gethash key *dictionary*)))) 9 9 10 10 (defmethod dictionary-entry ((key string) (code string)) … … 13 13 14 14 (defmethod (setf dictionary-entry) ((value string) (key string) (language website-language)) 15 (let ((it (assoc language (gethash key * multi-language-dictionary*))))15 (let ((it (assoc language (gethash key *dictionary*)))) 16 16 (if it 17 17 (rplacd it value) 18 (push (cons language value) (gethash key * multi-language-dictionary*)))))18 (push (cons language value) (gethash key *dictionary*))))) 19 19 20 20 (defun dictionary-xml-path (language) … … 52 52 (error "Error while loading ~a:~%~a" 53 53 (enough-namestring xml-path *website-directory*) c))))) 54 (clrhash * multi-language-dictionary*)54 (clrhash *dictionary*) 55 55 (mapc #'load-language languages xml-paths) 56 (setf * multi-language-dictionary-last-read* (get-universal-time))57 * multi-language-dictionary*))56 (setf *dictionary-last-read* (get-universal-time)) 57 *dictionary*)) 58 58 59 59 (defun load-dictionary-if-needed () … … 61 61 (xml-paths (mapcar #'dictionary-xml-path languages))) 62 62 (when (> (dictionary-xml-files-last-write-date xml-paths) 63 * multi-language-dictionary-last-read*)63 *dictionary-last-read*) 64 64 (load-dictionary languages xml-paths)))) 65 65
