this string-downcase made us spend some more debugging time (all credit to @fstamour).
Shall we remove it?
Or, maybe, there could be a set-locale interface between us and djula:*current-language* that does the right thing (a downcase too?). fstamour came up with these helpers in our i18n.lisp:
(defun list-loaded-locales ()
"Get the list of locales loaded in gettext's cache."
(remove-duplicates
(mapcar #'first
(alexandria:hash-table-keysfunction
gettext::*catalog-cache*))
:test #'string=))
(defun set-locale (locale)
"Setf gettext:*current-locale* and djula:*current-language* if LOCALE seems valid."
;; It is valid to set the locale to nil.
(when (and locale
(not (member locale (list-loaded-locales)
:test 'string=)))
(error "Locale not valid or not available: ~s" locale))
(setf *current-locale* locale
djula:*current-language* locale))
Currently:
this
string-downcase
made us spend some more debugging time (all credit to @fstamour).Shall we remove it?
Or, maybe, there could be a
set-locale
interface between us anddjula:*current-language*
that does the right thing (a downcase too?). fstamour came up with these helpers in our i18n.lisp: