##// END OF EJS Templates
Localized and neat error reports
Localized and neat error reports

File last commit:

r54:3a4e62f8 default
r54:3a4e62f8 default
Show More
l10n.lisp
23 lines | 843 B | text/x-common-lisp | CommonLispLexer
Localization. Renamed to txt2web
r46
(in-package txt2web)
(defparameter *languages* (list "en" "ru"))
(defparameter *l10n-strings*
(mapcan (lambda (lang)
(cons (intern (string-upcase lang) :keyword)
Localized and neat error reports
r54 (list (apply #'append
(read-code-from-string
(load-src
(concatenate 'string "strings/" lang ".sexp")))))))
Localization. Renamed to txt2web
r46 *languages*))
(defun lformat (target key &rest args)
(let* ((lang (intern (string-upcase (first (system-locale:languages)))
:keyword))
(strings (or (getf *l10n-strings* lang)
Localized and neat error reports
r54 (getf *l10n-strings* :en)))
(string (getf strings key)))
(if string
(apply #'format target string args)
(error "Unknown localization string ~S for language ~S" key lang))))