Baseline support for translations! :D
It’s not using gettext or anything, just a simple system I cooked up for having the translations hard-coded in, side-by-side. … it’s easier for me this way when writing, and it’ll make things easier later on, during distribution :P
This commit is contained in:
parent
b617e92aba
commit
495ed87f09
|
@ -21,7 +21,8 @@
|
||||||
(:nicknames :fsa.dia :dialogue :💬)
|
(:nicknames :fsa.dia :dialogue :💬)
|
||||||
(:use :cl)
|
(:use :cl)
|
||||||
(:export #:dialogue-state
|
(:export #:dialogue-state
|
||||||
#:start-dialogue #:face #:say #:mumble #:move))
|
#:start-dialogue #:face #:say #:mumble #:move
|
||||||
|
:normal-face :talking-face))
|
||||||
|
|
||||||
(in-package :flora-search-aurora.dialogue)
|
(in-package :flora-search-aurora.dialogue)
|
||||||
|
|
||||||
|
@ -56,20 +57,22 @@ If not, have some tea on me: I’m paying. =w="
|
||||||
(list :speaker speaker :face face)))
|
(list :speaker speaker :face face)))
|
||||||
|
|
||||||
|
|
||||||
(defun say (speaker text)
|
(defun say (speaker &rest text)
|
||||||
(list
|
(list
|
||||||
(list :speaker speaker :text text :face 'talking-face :progress 0)
|
(list :speaker speaker :face 'talking-face :progress 0
|
||||||
|
:text (or (getf text (…:system-language)) (getf text :en)))
|
||||||
(car (face speaker 'normal-face))))
|
(car (face speaker 'normal-face))))
|
||||||
|
|
||||||
|
|
||||||
(defun mumble (speaker text)
|
(defun mumble (speaker &rest text)
|
||||||
(list
|
(list
|
||||||
(list :speaker speaker :text text :progress 0)))
|
(list :speaker speaker :progress 0
|
||||||
|
:text (or (getf text (…:system-language)) (getf text :en)))))
|
||||||
|
|
||||||
|
|
||||||
(defun move (speaker world-coords)
|
(defun move (speaker world-coords &key (delay .05))
|
||||||
(list
|
(list
|
||||||
(list :speaker speaker :coords world-coords)))
|
(list :speaker speaker :coords world-coords :delay delay)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -140,7 +143,8 @@ coordinates listed in the DIALOGUE’s :COORDS property. … If applicable, ofc.
|
||||||
('t 0))
|
('t 0))
|
||||||
:y (cond ((< (getf target-coords :y) (getf speaker-coords :y)) -1)
|
:y (cond ((< (getf target-coords :y) (getf speaker-coords :y)) -1)
|
||||||
((> (getf target-coords :y) (getf speaker-coords :y)) 1)
|
((> (getf target-coords :y) (getf speaker-coords :y)) 1)
|
||||||
('t 0))))
|
('t 0)))
|
||||||
|
(sleep (or (getf dialogue :delay) 0)))
|
||||||
finished-moving-p))
|
finished-moving-p))
|
||||||
|
|
||||||
|
|
||||||
|
@ -279,8 +283,8 @@ and max-row; for use with RENDER-STRING. Like so:
|
||||||
;; … Worst-case scenario, just do whatever’ll fit :w:”
|
;; … Worst-case scenario, just do whatever’ll fit :w:”
|
||||||
(optimal-text-placement-vertically text coords :width width :height height
|
(optimal-text-placement-vertically text coords :width width :height height
|
||||||
:downp (not playerp))
|
:downp (not playerp))
|
||||||
(optimal-text-palcement-horizontally text coords :width width :height height
|
(optimal-text-placement-horizontally text coords :width width :height height
|
||||||
:rightp (not leftp)))))
|
:rightp (not leftp)))))
|
||||||
|
|
||||||
|
|
||||||
(defun render-dialogue-block (matrix map dialogue)
|
(defun render-dialogue-block (matrix map dialogue)
|
||||||
|
|
|
@ -38,17 +38,25 @@
|
||||||
|
|
||||||
(in-package :flora-search-aurora)
|
(in-package :flora-search-aurora)
|
||||||
|
|
||||||
|
|
||||||
(defun literary-girl-dialogue-2 (map)
|
(defun literary-girl-dialogue-2 (map)
|
||||||
(print "OWO"))
|
(print "OWO"))
|
||||||
|
|
||||||
|
|
||||||
(defun literary-girl-dialogue (map)
|
(defun literary-girl-dialogue (map)
|
||||||
(lambda (matrix &key (map map)
|
(let
|
||||||
(dialogue (💬:start-dialogue
|
((dialogue
|
||||||
(💬:say "literary-girl" "Blah blah, testing. A multi-lined one. For real! jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj akls djlaks jdlaksj dlakjsd")
|
(💬:start-dialogue
|
||||||
(💬:say "player" "ktp ktp jes jes?")
|
(💬:mumble "literary-girl" :en "...")
|
||||||
(💬:move "player" '(:x 30 :y 10)))))
|
(💬:say "player" :eo "Kielas apud la mar'?"
|
||||||
(🌍:overworld-state-draw matrix map)
|
:en "How's the view?")
|
||||||
(💬:dialogue-state matrix :map map :dialogue dialogue)))
|
(💬:face "player" "<.<")
|
||||||
|
(💬:say "literary-girl" :eo "Kielas apud la ruinoj de via viv'?"
|
||||||
|
:en "How's your trainwreck of a life?")
|
||||||
|
(💬:face "player" '💬:normal-face))))
|
||||||
|
(lambda (matrix &key (map map) (dialogue dialogue))
|
||||||
|
(🌍:overworld-state-draw matrix map)
|
||||||
|
(💬:dialogue-state matrix :map map :dialogue dialogue))))
|
||||||
|
|
||||||
|
|
||||||
(defun state-loop
|
(defun state-loop
|
||||||
|
@ -109,6 +117,8 @@ with STATE-LOOP."
|
||||||
((label . "QUIT") (return . nil))))
|
((label . "QUIT") (return . nil))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(defun main ()
|
(defun main ()
|
||||||
"A pathetic fascimile of a main loop. What does it do? WHAST DOES TI DODOO?"
|
"A pathetic fascimile of a main loop. What does it do? WHAST DOES TI DODOO?"
|
||||||
(cl-charms:with-curses ()
|
(cl-charms:with-curses ()
|
||||||
|
|
11
util.lisp
11
util.lisp
|
@ -20,7 +20,7 @@
|
||||||
(defpackage :flora-search-aurora.util
|
(defpackage :flora-search-aurora.util
|
||||||
(:nicknames :fsa.ut :util :…)
|
(:nicknames :fsa.ut :util :…)
|
||||||
(:use :cl :assoc-utils)
|
(:use :cl :assoc-utils)
|
||||||
(:export #:split-string-by-length #:plist= #:at-least #:at-most))
|
(:export #:split-string-by-length #:plist= #:at-least #:at-most #:system-language))
|
||||||
|
|
||||||
(in-package :flora-search-aurora.util)
|
(in-package :flora-search-aurora.util)
|
||||||
|
|
||||||
|
@ -69,3 +69,12 @@ minimum returns your more pitiful of moments."
|
||||||
(if (> num maximum)
|
(if (> num maximum)
|
||||||
maximum
|
maximum
|
||||||
num))
|
num))
|
||||||
|
|
||||||
|
|
||||||
|
(defun system-language ()
|
||||||
|
"Return the system language, if among the supported; otherwise, EN-glish."
|
||||||
|
(let ((lang (subseq (uiop:getenv "LANG") 0 2)))
|
||||||
|
(cond
|
||||||
|
((string-equal lang "eo") :eo)
|
||||||
|
((string-equal lang "en") :en)
|
||||||
|
('t :en))))
|
||||||
|
|
Ŝarĝante…
Reference in New Issue