Changeset 3283

Show
Ignore:
Timestamp:
06/17/08 11:14:07 (7 months ago)
Author:
ksprotte
Message:

better naming for dictionary

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/projects/bos/web/multi-language-dictionary.lisp

    r3275 r3283  
    11(in-package :bos.web) 
    22 
    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) 
    55 
    66(defmethod dictionary-entry ((key string) (language website-language)) 
    77  (load-dictionary-if-needed) 
    8   (cdr (assoc language (gethash key *multi-language-dictionary*)))) 
     8  (cdr (assoc language (gethash key *dictionary*)))) 
    99 
    1010(defmethod dictionary-entry ((key string) (code string)) 
     
    1313 
    1414(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*)))) 
    1616    (if it 
    1717        (rplacd it value) 
    18         (push (cons language value) (gethash key *multi-language-dictionary*))))) 
     18        (push (cons language value) (gethash key *dictionary*))))) 
    1919 
    2020(defun dictionary-xml-path (language) 
     
    5252                 (error "Error while loading ~a:~%~a" 
    5353                        (enough-namestring xml-path *website-directory*) c))))) 
    54     (clrhash *multi-language-dictionary*) 
     54    (clrhash *dictionary*) 
    5555    (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*)) 
    5858 
    5959(defun load-dictionary-if-needed () 
     
    6161         (xml-paths (mapcar #'dictionary-xml-path languages)))     
    6262    (when (> (dictionary-xml-files-last-write-date xml-paths) 
    63              *multi-language-dictionary-last-read*) 
     63             *dictionary-last-read*) 
    6464      (load-dictionary languages xml-paths)))) 
    6565