Commit 010db8db authored by Daniel Kochmański's avatar Daniel Kochmański

cosmetic: example white character fixes

Signed-off-by: 's avatarDaniel Kochmański <daniel@turtleware.eu>
parent 33e9830b
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
ordinary constant strings in his/her application, the user instead ordinary constant strings in his/her application, the user instead
precedes them with =#t=: precedes them with =#t=:
#+BEGIN_SRC common-lisp #+BEGIN_SRC lisp
==> #t"dum dum dum, piję rum" ==> #t"dum dum dum, piję rum"
"la la la, I drink in the spa" "la la la, I drink in the spa"
#+END_SRC #+END_SRC
...@@ -41,8 +41,10 @@ ...@@ -41,8 +41,10 @@
run-time while keeping application innards visually separated from run-time while keeping application innards visually separated from
the messages meant to be presented to user. the messages meant to be presented to user.
#+BEGIN_SRC common-lisp #+BEGIN_SRC lisp
==> (setf translate:*language* nil) ==> (setf translate:*language* nil)
NIL
==> (make-button :label #t"hello") ==> (make-button :label #t"hello")
#<button "hello"> #<button "hello">
#+END_SRC #+END_SRC
...@@ -51,14 +53,17 @@ ...@@ -51,14 +53,17 @@
translation. If no translation exists it will be temporarily translation. If no translation exists it will be temporarily
translated to the same value enclosed in a curly brackets: translated to the same value enclosed in a curly brackets:
#+BEGIN_SRC common-lisp #+BEGIN_SRC lisp
==> (translate:define-language :pl) ==> (translate:define-language :pl)
(#<hash-table 00000000054323c0> NIL #<compiled-function 0000000005fe08c0>) (#<hash-table 00000000054323c0> NIL #<compiled-function 0000000005fe08c0>)
==> (setf translate:*language* :pl) ==> (setf translate:*language* :pl)
:PL :PL
==> (make-label :text #t"Greetings, programs") ==> (make-label :text #t"Greetings, programs")
;;; Warning: phrase "Greetings, programs" isn't defined for language :PL. ;;; Warning: phrase "Greetings, programs" isn't defined for language :PL.
#<label "{Greetings, programs}"> #<label "{Greetings, programs}">
==> (make-label :text #t"Leave the grid") ==> (make-label :text #t"Leave the grid")
;;; Warning: phrase "Leave the grid" isn't defined for language :PL. ;;; Warning: phrase "Leave the grid" isn't defined for language :PL.
#<label "{Leave the grid}"> #<label "{Leave the grid}">
...@@ -92,10 +97,12 @@ ...@@ -92,10 +97,12 @@
;;; Warning: Implicitly creating language PL. ;;; Warning: Implicitly creating language PL.
[PL] hello -> Witaj! [PL] hello -> Witaj!
"Witaj!" "Witaj!"
==> (translate:add-single-translation 'en "hello" "Welcome!") ==> (translate:add-single-translation 'en "hello" "Welcome!")
;;; Warning: Implicitly creating language EN. ;;; Warning: Implicitly creating language EN.
[EN] hello -> Welcome! [EN] hello -> Welcome!
"Welcome!" "Welcome!"
==> (translate:add-single-translation ==> (translate:add-single-translation
'pl "bang" 'pl "bang"
(let ((i 1)) (let ((i 1))
...@@ -124,6 +131,7 @@ ...@@ -124,6 +131,7 @@
[PL] header-pricing -> Cennik [PL] header-pricing -> Cennik
[PL] header-contact -> Kontakt [PL] header-contact -> Kontakt
T T
==> (translate:add-translations 'en ==> (translate:add-translations 'en
"header-about" "About" "header-about" "About"
"header-offer" "Offer" "header-offer" "Offer"
...@@ -180,21 +188,27 @@ ...@@ -180,21 +188,27 @@
calls and they may work not as expected in the context where calls and they may work not as expected in the context where
enclosing macro prevents their evaluation. enclosing macro prevents their evaluation.
#+BEGIN_SRC common-lisp #+BEGIN_SRC lisp
==> (setf translate:*mode* :run-time) ==> (setf translate:*mode* :run-time)
:RUN-TIME :RUN-TIME
==> (setf translate:*language* :en) ==> (setf translate:*language* :en)
:EN :EN
==> (translate:add-single-translation :en "hello" "Hello") ==> (translate:add-single-translation :en "hello" "Hello")
[EN] hello -> Hello [EN] hello -> Hello
==> (translate:add-single-translation :pl "hello" "Cześć") ==> (translate:add-single-translation :pl "hello" "Cześć")
[PL] hello -> Cześć [PL] hello -> Cześć
==> (let ((translate:*language* :en)) ==> (let ((translate:*language* :en))
#t"hello") #t"hello")
"Hello" "Hello"
==> (let ((translate:*language* :pl)) ==> (let ((translate:*language* :pl))
#t"hello") #t"hello")
"Cześć" "Cześć"
==> (quote #t"hello") ==> (quote #t"hello")
(TRANSLATE:TRANSLATE "hello") (TRANSLATE:TRANSLATE "hello")
#+END_SRC #+END_SRC
...@@ -205,32 +219,42 @@ ...@@ -205,32 +219,42 @@
immediately. That also means that changing =TRANSLATE:*LANGUAGE*= immediately. That also means that changing =TRANSLATE:*LANGUAGE*=
in the future won't affect translations resolved earlier. in the future won't affect translations resolved earlier.
#+BEGIN_SRC common-lisp #+BEGIN_SRC lisp
==> (setf translate:*mode* :load-time) ==> (setf translate:*mode* :load-time)
:RUN-TIME :RUN-TIME
==> (setf translate:*language* :en) ==> (setf translate:*language* :en)
:EN :EN
==> (defparameter *my-function-1* ==> (defparameter *my-function-1*
(lambda () #t"hello")) (lambda () #t"hello"))
;;; Warning: phrase "hello" isn't defined for language EN. ;;; Warning: phrase "hello" isn't defined for language EN.
,*MY-FUNCTION-1* *MY-FUNCTION-1*
==> (translate:add-translation :en "hello" "Hello") ==> (translate:add-translation :en "hello" "Hello")
hello -> Hello (EN) hello -> Hello (EN)
==> (translate:add-translation :pl "hello" "Cześć") ==> (translate:add-translation :pl "hello" "Cześć")
hello -> Cześć (PL) hello -> Cześć (PL)
==> (let ((*language* :en)) ==> (let ((*language* :en))
#t"hello") #t"hello")
"Hello" "Hello"
==> (let ((*language* :pl)) ; lexical scope is ignored ==> (let ((*language* :pl)) ; lexical scope is ignored
#t"hello") #t"hello")
"Hello" "Hello"
==> (defparameter *my-function-2* ==> (defparameter *my-function-2*
(lambda () #t"hello")) (lambda () #t"hello"))
,*MY-FUNCTION-2* ,*MY-FUNCTION-2*
==> (funcall *my-function-1*) ; phrase wasn't translated when function was created ==> (funcall *my-function-1*) ; phrase wasn't translated when function was created
"{hello}" "{hello}"
==> (funcall *my-function-2*) ==> (funcall *my-function-2*)
"Hello" "Hello"
==> (quote #t"hello") ==> (quote #t"hello")
"Hello" "Hello"
#+END_SRC #+END_SRC
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment