Skip to content
Snippets Groups Projects
Commit 54b372cb authored by Daniel Kochmański's avatar Daniel Kochmański
Browse files

cosmetic: move with-language

parent 2f8ec334
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,17 @@
"Controlls translation resulution time - maybe be either :run-time
or :load-time")
;; utilities
(defmacro with-language (name (dict miss m-fn) &body body)
"Conveniance macro which creates lexical invironment composed of
macro symbols which resolve to language list."
(let ((lang-entry (gensym)))
`(symbol-macrolet ((,lang-entry (getf *translations* ,name))
(,dict (first ,lang-entry))
(,miss (second ,lang-entry))
(,m-fn (third ,lang-entry)))
,@body)))
;; creation
(defun define-language (name &rest translations)
"Define language NAME with provided TRANSLATIONS
......@@ -30,16 +41,6 @@ corresponding objects."
"{" str "}"))))
(apply #'add-translations name translations))
(defmacro with-language (name (dict miss m-fn) &body body)
"Conveniance macro which creates lexical invironment composed of
macro symbols which resolve to language list."
(let ((lang-entry (gensym)))
`(symbol-macrolet ((,lang-entry (getf *translations* ,name))
(,dict (first ,lang-entry))
(,miss (second ,lang-entry))
(,m-fn (third ,lang-entry)))
,@body)))
(defun ensure-language (name &optional cerror-p)
"If NAME isn't NIL and language doesn't exist - define it. If
CERROR-P non-NIL, then signal a condition if it doesn't exist,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment