Language specific submit button content
This commit is contained in:
parent
c41acbadbd
commit
c0f98b1d34
2 changed files with 13 additions and 1 deletions
|
@ -110,6 +110,11 @@ Returns two values:
|
|||
(values (string-downcase input-type-keyword) (rest choices))
|
||||
(values nil choices))))
|
||||
|
||||
(defun submit-lang (lang)
|
||||
(cond ((string= "de" lang) "Absenden")
|
||||
((string= "en" lang) "Submit")
|
||||
((string= "fr" lang) "Soumettre")))
|
||||
|
||||
(defmacro questionnaire (action &rest questions)
|
||||
"This macro generates an HTML form composed of multiple questions, each
|
||||
rendered using the `question` macro.
|
||||
|
@ -139,4 +144,4 @@ Example:
|
|||
`(question ,ask
|
||||
(:group ,group :type ,input-type)
|
||||
,@remaining-choices)))))
|
||||
(btn-primary (:type "submit") "Submit"))))
|
||||
(btn-primary (:type "submit") (submit-lang ,spinneret:*html-lang*)))))
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
:question
|
||||
:resolve-input-type
|
||||
:resolve-input-and-choices
|
||||
::submit-lang
|
||||
:questionnaire))
|
||||
|
||||
(in-package :cl-sbt/tests/questionnaire)
|
||||
|
@ -28,3 +29,9 @@
|
|||
(resolve-input-and-choices '("A" "B"))
|
||||
(ok (null type))
|
||||
(ok (equal choices '("A" "B"))))))
|
||||
|
||||
(deftest test-submit-btn-translation
|
||||
(testing "Submit button content is shown in a specific language"
|
||||
(ok (string= "Absenden" (submit-lang "de")))
|
||||
(ok (string= "Soumettre" (submit-lang "fr")))
|
||||
(ok (string= "Submit" (submit-lang "en")))))
|
||||
|
|
Loading…
Add table
Reference in a new issue