<br>hi!<br><br>i've pulled this to _ajax and i have a few questions and an alternative impl you can find at the end of the mail...<br><br>is the :it.bese.ucw.l10n.tags really needed? i think only one or two tags could be defined in it that could go into <ucw: (unless i'm missing some xml namespace related reason)
<br><br>and about the old <l10n:lookup tag: i had the <ucw:localized tag that you can find below locally in my project. i propose that instead. i think no tag is useful for resources that need arguments, they 99% of the time need more caretaking then a simply <:as-html'ing their return value. some real-world examples for this from my project: (i have a naming convention that functions ending in "<>" in the :lang package are rendering to the yaclml stream)
<br><br>;; locale specific<br>(defresources en<br> (activity-label.finder<> (entity)<br> (<:as-html "Browsing ")<br> (entities<> entity)))
<br><br>;; the rest is not locale specific<br>(defun entities (entity &key capitalize-first-letter)<br> (bind (((values entity-name found) (localize entity))) ;; the localize call here localizes the entity name<br> (setf entity-name (plural-of entity-name))
<br> (values (if capitalize-first-letter<br> (capitalize-first-letter entity-name)<br> entity-name)<br> found)))<br><br>(defun entities<> (entity &key capitalize-first-letter)
<br> (bind (((values str foundp) (entities entity :capitalize-first-letter capitalize-first-letter)))<br> (<:span :class (append* (unless foundp +missing-resource-css-class+) "entity-name")<br> (<:as-html str))))
<br><br><br>and here's the proposed alternative that i'll push unless Maciek or someone has any objections. <br><br>#|<br><br>delete this<br><br>(defpackage :it.bese.ucw.l10n.tags<br> (:nicknames #:<l10n))<br><br>(pushnew (cons "
<a href="http://common-lisp.net/project/ucw/l10n/core">http://common-lisp.net/project/ucw/l10n/core</a>"<br> (find-package :it.bese.ucw.l10n.tags))<br> yaclml:*uri-to-package*<br> :test #'equal)
<br>|#<br><br>(eval-always<br> (export 'it.bese.ucw.tags::localized (find-package :it.bese.ucw.tags))<br> (defparameter +missing-resource-css-class+ "missing-resource"))<br><br>(deftag-macro <ucw:localized (&body forms)
<br> "Just like <:as-html but calls localize on the elements before rendering"<br> `(progn<br> ,@(mapcar (lambda (form)<br> `(bind (((values str foundp) (localize ,form)))<br> (if foundp
<br> (<:as-html str)<br> (<:span :class #.+missing-resource-css-class+<br> (<:as-html str)))))<br> forms)))<br><br>-- <br>- attila
<br><br>"- The truth is that I've been too considerate, and so became unintentionally cruel...<br> - I understand.<br> - No, you don't understand! We don't speak the same language!"<br><br>Ingmar Bergman - Smultronstället (Wild Strawberries)