Commit cf39ea6a authored by Callum McKenzie's avatar Callum McKenzie

Further changes to allow for better translations for aisleriot

parent d174d4ae
2003-05-20 Callum McKenzie <callum@physics.otago.ac.nz>
* Makefile.am: Removed the code to generate SCHEME_GAMES.h, we
don't need it anymore.
* cscmi.c (cscm_init): gettext -> _
* *.scm: Changed all the "gettext" calls to "_" so we don't have
to alter intltools.
2003-05-18 Callum McKenzie <callum@physics.otago.ac.nz>
* Makefile.am: Arranged for the autogeneration of SCHEME_GAMES.h
......
......@@ -136,14 +136,3 @@ sys_DATA = $(sys_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
CLEANFILES = $(sys_DATA)
SCHEME_GAMES.h: $(types_DATA)
-echo "/* This is an automatically generated file, please do not edit it. " >SCHEME_GAMES.h
-echo " *" >> SCHEME_GAMES.h
-echo " * This file is never compiled and is merely a repository of" >> SCHEME_GAMES.h
-echo " * strings extracted from the *.scm files in a form easily" >>SCHEME_GAMES.h
-echo " * digestible by xgettext. No, this isn't a good way to do it. */" >> SCHEME_GAMES.h
-echo "" >>SCHEME_GAMES.h
-echo "char only_a_place_holder[] = {" >>SCHEME_GAMES.h
-perl -ne 'foreach (/\(gettext\W*("[^"]*")\W*\)/g) { print "N_($$_),\n"; }' *.scm >>SCHEME_GAMES.h
-echo "};" >>SCHEME_GAMES.h
......@@ -66,22 +66,22 @@
(define (get-base-string)
(cond ((and (> BASE-VAL 1)
(< BASE-VAL 11))
(string-append (gettext "Base Card: ") (number->string BASE-VAL)))
(string-append (_"Base Card: ") (number->string BASE-VAL)))
((= BASE-VAL 1)
(gettext "Base Card: Ace"))
(_"Base Card: Ace"))
((= BASE-VAL 11)
(gettext "Base Card: Jack"))
(_"Base Card: Jack"))
((= BASE-VAL 12)
(gettext "Base Card: Queen"))
(_"Base Card: Queen"))
((= BASE-VAL 13)
(gettext "Base Card: King"))
(_"Base Card: King"))
(#t #f)))
(define (get-stock-no-string)
(if (> (length (get-cards 0)) 1)
(string-append (gettext "Stock left: ")
(string-append (_"Stock left: ")
(number->string (length (get-cards 0))))
(string-append (gettext "Stock left: 0"))))
(string-append (_"Stock left: 0"))))
(define (check-straight-descending-list card-list)
(or (< (length card-list) 2)
......@@ -202,7 +202,7 @@
BASE-VAL))
(list 2
(get-name (get-top-card slot))
(gettext "an empty foundation pile")))
(_"an empty foundation pile")))
((and (not (empty-slot? slot))
(check-dc slot 1 #t))
(list 1
......@@ -246,13 +246,13 @@
(define (dealable?)
(and (not (empty-slot? 0))
(list 0 (gettext "Deal more cards"))))
(list 0 (_"Deal more cards"))))
(define (get-hint)
(or (check-to-foundation? 5)
(check-to-tableau? 5 6)
(dealable?)
(list 0 (gettext "Try rearranging the cards"))))
(list 0 (_"Try rearranging the cards"))))
(define (get-options)
#f)
......
......@@ -50,7 +50,7 @@
(set-statusbar-message (get-stock-no-string)))
(define (get-stock-no-string)
(string-append (gettext "Stock left: ")
(string-append (_"Stock left: ")
(number->string (length (get-cards 0)))))
(define (button-pressed slot-id card-list)
......@@ -112,7 +112,7 @@
(define (dealable?)
(and (not (empty-slot? 0))
(list 0 (gettext "Deal another round"))))
(list 0 (_"Deal another round"))))
(define (get-hint)
(or (movable? 5 1)
......
......@@ -150,7 +150,7 @@
(empty-slot? t-slot))
(foundation-possible? (+ 1 t-slot) 0))
((= (get-value (get-top-card t-slot)) ace)
(list 2 (get-name (get-top-card t-slot)) (gettext "an empty foundation")))
(list 2 (get-name (get-top-card t-slot)) (_"an empty foundation")))
((and (not (empty-slot? f-slot))
(= (get-suit (get-top-card t-slot))
(get-suit (get-top-card f-slot)))
......@@ -191,7 +191,7 @@
(define (get-hint)
(or (foundation-possible? 4 0)
(tableau-moves? 4 5)
(list 0 (gettext "Try rearranging the cards"))))
(list 0 (_"Try rearranging the cards"))))
(define (get-options)
#f)
......
......@@ -184,7 +184,7 @@
(= f-slot 8))
(check-to-foundations? (+ 1 slot) 0))
((= (get-value (get-top-card slot)) ace)
(list 2 (get-name (get-top-card slot)) (gettext "an empty Foundation")))
(list 2 (get-name (get-top-card slot)) (_"an empty Foundation")))
((and (not (empty-slot? f-slot))
(= (get-suit (get-top-card slot))
(get-suit (get-top-card f-slot)))
......@@ -239,7 +239,7 @@
(check-for-king (get-cards slot) free-reserves slot))
(list 2
(check-for-king (get-cards slot) free-reserves slot)
(gettext "an empty Tableau")))
(_"an empty Tableau")))
((and (not (= slot t-slot))
(not (empty-slot? t-slot))
(= (get-suit (get-top-card slot))
......@@ -255,7 +255,7 @@
(define (check-for-empty-reserve)
(and (> free-reserves 0)
(list 0 (gettext "Move something on to an empty reserve"))))
(list 0 (_"Move something on to an empty reserve"))))
(define (get-hint)
(or (check-to-foundations? 2 0)
......
......@@ -186,7 +186,7 @@
(define (get-hint)
(or (check-to-foundation 0)
(list 0 (gettext "Try rearranging the cards"))))
(list 0 (_"Try rearranging the cards"))))
(define (get-options)
#f)
......
......@@ -51,7 +51,7 @@
(set-statusbar-message (get-stock-no-string)))
(define (get-stock-no-string)
(string-append (gettext "Stock left: ")
(string-append (_"Stock left: ")
(number->string (length (get-cards 0)))))
(define (button-pressed slot-id card-list)
......
......@@ -83,7 +83,7 @@
(set-statusbar-message (get-stock-no-string)))
(define (get-stock-no-string)
(string-append (gettext "Stock left: ")
(string-append (_"Stock left: ")
(number->string (length (get-cards 0)))))
(define (check-for-kings slot-id)
......@@ -196,7 +196,7 @@
(= (get-value (get-top-card slot-id)) ace))
(list 2
(get-name (get-top-card slot-id))
(gettext "an empty Foundation pile")))
(_"an empty Foundation pile")))
((and (not (empty-slot? foundation-id))
(= (+ 1 (get-value (get-top-card foundation-id)))
(get-value (get-top-card slot-id))))
......@@ -271,7 +271,7 @@
(define (dealable?)
(and (not (empty-slot? 0))
(list 0 (gettext "Deal another round"))))
(list 0 (_"Deal another round"))))
(define (get-hint)
(or (check-to-foundations 1)
......
......@@ -74,7 +74,7 @@
(set-statusbar-message (get-stock-no-string)))
(define (get-stock-no-string)
(string-append (gettext "Stock left: ")
(string-append (_"Stock left: ")
(number->string (length (get-cards 16)))))
(define (button-pressed slot-id card-list)
......@@ -178,7 +178,7 @@
(define (find-match cards)
(and (not (null? cards))
(if (= 10 (get-value (car cards)))
(list 2 (get-name (car cards)) (gettext "itself")) ; yuk..
(list 2 (get-name (car cards)) (_"itself")) ; yuk..
(let ((match (find-card-val-in-list?
(cdr cards)
(- 10 (get-value (car cards))))))
......@@ -192,22 +192,22 @@
(empty-slot? 3)
(empty-slot? 12)
(empty-slot? 15))
(gettext "an empty corner slot")))
(_"an empty corner slot")))
((= (get-value card) queen)
(or (and (or (empty-slot? 1)
(empty-slot? 2))
(gettext "an empty top slot"))
(_"an empty top slot"))
(and (or (empty-slot? 13)
(empty-slot? 14))
(gettext "an empty bottom slot"))))
(_"an empty bottom slot"))))
((= (get-value card) jack)
(or (and (or (empty-slot? 4)
(empty-slot? 8))
(gettext "an empty left slot"))
(_"an empty left slot"))
(and (or (empty-slot? 7)
(empty-slot? 11))
(gettext "an empty right slot"))))
(#t (gettext "an empty slot"))))
(_"an empty right slot"))))
(#t (_"an empty slot"))))
(define (game-over)
(give-status-message)
......@@ -225,7 +225,7 @@
(list 2 (get-name (get-top-card 17))
(placeable? (get-top-card 17))))
(find-match (list-cards 0)))
(list 0 (gettext "Deal a new card from the deck"))))
(list 0 (_"Deal a new card from the deck"))))
(define (get-options) #f)
......
......@@ -68,29 +68,29 @@
(get-redeals-string))))
(define (get-stock-no-string)
(string-append (gettext "Stock left: ")
(string-append (_"Stock left: ")
(number->string (length (get-cards 0)))))
(define (get-reserve-no-string)
(string-append (gettext "Reserve left: ")
(string-append (_"Reserve left: ")
(number->string (length (get-cards 6)))))
(define (get-base-string)
(cond ((and (> BASE-VAL 1)
(< BASE-VAL 11))
(string-append (gettext "Base Card: ") (number->string BASE-VAL)))
(string-append (_"Base Card: ") (number->string BASE-VAL)))
((= BASE-VAL 1)
(gettext "Base Card: Ace"))
(_"Base Card: Ace"))
((= BASE-VAL 11)
(gettext "Base Card: Jack"))
(_"Base Card: Jack"))
((= BASE-VAL 12)
(gettext "Base Card: Queen"))
(_"Base Card: Queen"))
((= BASE-VAL 13)
(gettext "Base Card: King"))
(_"Base Card: King"))
(#t #f)))
(define (get-redeals-string)
(string-append (gettext "Redeals left: ")
(string-append (_"Redeals left: ")
(number->string (- 2 FLIP-COUNTER))))
(define (button-pressed slot-id card-list)
......@@ -230,17 +230,17 @@
(define (deal-possible?)
(if (not (empty-slot? 0))
(list 0 (gettext "Deal a new card from the deck"))
(list 0 (_"Deal a new card from the deck"))
(if (and (< FLIP-COUNTER 2)
(not (empty-slot? 1)))
(list 0 (gettext "Move waste back to stock"))
(list 0 (_"Move waste back to stock"))
#f)))
(define (move-up? card slot)
(or (if (empty-slot? slot)
(if (= (get-value card)
BASE-VAL)
(list 1 (get-name card) (gettext "empty slot on foundation"))
(list 1 (get-name card) (_"empty slot on foundation"))
#f)
(and (= (get-suit card)
(get-suit (get-top-card slot)))
......@@ -262,7 +262,7 @@
(define (tabled card slot)
(or (if (empty-slot? slot)
(list 1 (get-name card) (gettext "empty space on tableau"))
(list 1 (get-name card) (_"empty space on tableau"))
(and (eq? (is-black? card)
(is-red? (get-top-card slot)))
(or (and (= (get-value card) king)
......@@ -311,7 +311,7 @@
(to-tableau? '(6 1))
(move-column? '(7 8 9 10))
(deal-possible?)
(list 0 (gettext "Try rearranging the cards"))))
(list 0 (_"Try rearranging the cards"))))
(define (get-options) #f)
......
......@@ -89,15 +89,15 @@
(define (get-base-string)
(cond ((and (> BASE-VAL 1)
(< BASE-VAL 11))
(string-append (gettext "Base Card: ") (number->string BASE-VAL)))
(string-append (_"Base Card: ") (number->string BASE-VAL)))
((= BASE-VAL 1)
(gettext "Base Card: Ace"))
(_"Base Card: Ace"))
((= BASE-VAL 11)
(gettext "Base Card: Jack"))
(_"Base Card: Jack"))
((= BASE-VAL 12)
(gettext "Base Card: Queen"))
(_"Base Card: Queen"))
((= BASE-VAL 13)
(gettext "Base Card: King"))
(_"Base Card: King"))
(#t #f)))
(define (button-pressed slot-id card-list)
......@@ -194,7 +194,7 @@
(cond ((= slot 14)
#f)
((not base-set?)
(list 0 (gettext "Move a card to the Foundation")))
(list 0 (_"Move a card to the Foundation")))
((or (empty-slot? slot)
(= slot 3)
(= slot 6)
......@@ -207,7 +207,7 @@
BASE-VAL))
(list 2
(get-name (get-top-card slot))
(gettext "an empty Foundation")))
(_"an empty Foundation")))
((and (not (empty-slot? f-slot))
(= (get-suit (get-top-card f-slot))
(get-suit (get-top-card slot)))
......@@ -262,7 +262,7 @@
(empty-slot? 10)
(empty-slot? 11)
(empty-slot? 13))
(list 0 (gettext "Move something into the empty Tableau slot"))))
(list 0 (_"Move something into the empty Tableau slot"))))
(define (get-hint)
(or (to-foundations? 0 3)
......
......@@ -214,18 +214,18 @@
(define (get-hint)
(list 0
(nth-item
(list (gettext "Just because a crosswalk looks like a hopscotch board doesn't mean it is one")
(gettext "Look both ways before you cross the street")
(gettext "Have you read the help file?")
(gettext "Odessa is a better game. Really.")
(gettext "Tourniquets are not recommended unless in the direst emergency")
(gettext "I could sure use a backrub right about now...")
(gettext "Monitors won't give you Vitamin D -- but sunlight will...")
(gettext "If you're ever lost and alone in the woods, hug a tree")
(gettext "Fishing wire makes bad dental floss")
(gettext "Consistency is key")
(gettext "When without a stapler, a staple and a ruler will work")
(gettext "Never blow in a dog's ear"))
(list (_"Just because a crosswalk looks like a hopscotch board doesn't mean it is one")
(_"Look both ways before you cross the street")
(_"Have you read the help file?")
(_"Odessa is a better game. Really.")
(_"Tourniquets are not recommended unless in the direst emergency")
(_"I could sure use a backrub right about now...")
(_"Monitors won't give you Vitamin D -- but sunlight will...")
(_"If you're ever lost and alone in the woods, hug a tree")
(_"Fishing wire makes bad dental floss")
(_"Consistency is key")
(_"When without a stapler, a staple and a ruler will work")
(_"Never blow in a dog's ear"))
(random 12))))
(define (get-options) #f)
......
......@@ -39,7 +39,7 @@
(set-statusbar-message (get-stock-no-string)))
(define (get-stock-no-string)
(string-append (gettext "Stock left: ")
(string-append (_"Stock left: ")
(number->string (length (get-cards 0)))))
(define (button-pressed slot-id card-list)
......
......@@ -311,6 +311,6 @@ void cscm_init ()
gh_new_procedure0_0("get-timeout", scm_get_timeout);
gh_new_procedure1_0("set-timeout!", scm_set_timeout);
gh_new_procedure1_0("add-to-score!", scm_add_to_score);
gh_new_procedure("gettext", scm_gettext, 1, 0, 0);
gh_new_procedure("_", scm_gettext, 1, 0, 0);
eval_installed_file ("sol.scm");
}
......@@ -265,7 +265,7 @@
#f)
((and (empty-slot? slot)
(possible-move-off? 0))
(list 2 (get-name (possible-move-off? 0)) (gettext "an empty slot")))
(list 2 (get-name (possible-move-off? 0)) (_"an empty slot")))
(#t (check-for-empties (+ 1 slot)))))
(define (start-foundation slot)
......@@ -274,7 +274,7 @@
#f)
((and (not (empty-slot? slot))
(= (get-suit (get-top-card slot)) diamond))
(list 2 (get-name (get-top-card slot)) (gettext "the foundation pile")))
(list 2 (get-name (get-top-card slot)) (_"the foundation pile")))
(#t (start-foundation (+ 1 slot)))))
(define (any-empty? slot)
......@@ -317,7 +317,7 @@
#f)
((and (not (empty-slot? slot))
(check-a-tab-slot (get-cards slot)))
(list 2 (get-name (check-a-tab-slot (get-cards slot))) (gettext "an empty slot")))
(list 2 (get-name (check-a-tab-slot (get-cards slot))) (_"an empty slot")))
(#t (check-tableau-suit-changes (+ 1 slot)))))
(define (get-hint)
......
......@@ -64,11 +64,11 @@
(get-redeals-string))))
(define (get-stock-no-string)
(string-append (gettext "Stock left: ")
(string-append (_"Stock left: ")
(number->string (length (get-cards 0)))))
(define (get-redeals-string)
(string-append (gettext "Redeals left: ")
(string-append (_"Redeals left: ")
(number->string (- 2 FLIP-COUNTER))))
(define (check-kings slot-list)
......
......@@ -83,29 +83,29 @@
(get-redeals-string))))
(define (get-stock-no-string)
(string-append (gettext "Stock left: ")
(string-append (_"Stock left: ")
(number->string (length (get-cards 0)))))
(define (get-reserve-no-string)
(string-append (gettext "Reserve left: ")
(string-append (_"Reserve left: ")
(number->string (length (get-cards 10)))))
(define (get-base-string)
(cond ((and (> BASE-VAL 1)
(< BASE-VAL 11))
(string-append (gettext "Base Card: ") (number->string BASE-VAL)))
(string-append (_"Base Card: ") (number->string BASE-VAL)))
((= BASE-VAL 1)
(gettext "Base Card: Ace"))
(_"Base Card: Ace"))
((= BASE-VAL 11)
(gettext "Base Card: Jack"))
(_"Base Card: Jack"))
((= BASE-VAL 12)
(gettext "Base Card: Queen"))
(_"Base Card: Queen"))
((= BASE-VAL 13)
(gettext "Base Card: King"))
(_"Base Card: King"))
(#t #f)))
(define (get-redeals-string)
(string-append (gettext "Redeals left: ")
(string-append (_"Redeals left: ")
(number->string (- 2 FLIP-COUNTER))))
(define (button-pressed slot-id card-list)
......@@ -262,7 +262,7 @@
(if (and (not (empty-slot? slot))
(is-visible? (get-top-card slot)))
(cond ((= (get-value (get-top-card slot)) BASE-VAL)
(list 3 (get-name (get-top-card slot)) (gettext "to an empty foundation")))
(list 3 (get-name (get-top-card slot)) (_"to an empty foundation")))
((check-a-foundation slot 2)
(list 1
(get-name (get-top-card slot))
......@@ -295,7 +295,7 @@
(not (= slot 10)))
(if (empty-slot? 1)
#f
(list 2 (get-name (get-top-card 1)) (gettext "an empty slot on tableau")))
(list 2 (get-name (get-top-card 1)) (_"an empty slot on tableau")))
(if (< slot 14)
(check-empty-slot (+ 1 slot))
#f)))
......@@ -327,10 +327,10 @@
(define (dealable?)
(if (not (empty-slot? 0))
(list 0 (gettext "Deal a card"))
(list 0 (_"Deal a card"))
(if (and (not (empty-slot? 1))
(< FLIP-COUNTER 2))
(list 0 (gettext "Move waste back to stock"))
(list 0 (_"Move waste back to stock"))
#f)))
(define (get-hint)
......
......@@ -53,7 +53,7 @@
(set-statusbar-message (string-append (get-stock-no-string))))
(define (get-stock-no-string)
(string-append (gettext "Stock left: ")
(string-append (_"Stock left: ")
(number->string (length (get-cards 0)))))
(define (button-pressed slot-id card-list)
......@@ -184,7 +184,7 @@
(= (get-value (get-top-card slot)) ace))
(list 2
(get-name (get-top-card slot))
(gettext "an empty Foundation")))
(_"an empty Foundation")))
((and (not (empty-slot? f-slot))
(= (get-suit (get-top-card f-slot))
(get-suit (get-top-card slot)))
......@@ -220,12 +220,12 @@
#f)
((empty-slot? slot)
(and (kings-avail 5)
(list 0 (gettext "Move a King on to the empty Tableau slot"))))
(list 0 (_"Move a King on to the empty Tableau slot"))))
(#t (fill-empties (+ 1 slot)))))
(define (dealable?)
(and (not (empty-slot? 0))
(list 0 (gettext "Deal more cards"))))
(list 0 (_"Deal more cards"))))
(define (get-hint)
(or (to-foundations? 5 1)
......
......@@ -171,7 +171,7 @@
(= f-slot 4))
(check-to-foundations? (+ 1 slot) 0))
((= (get-value (get-top-card slot)) ace)
(list 2 (get-name (get-top-card slot)) (gettext "an empty Foundation")))
(list 2 (get-name (get-top-card slot)) (_"an empty Foundation")))
((and (not (empty-slot? f-slot))
(= (get-suit (get-top-card slot))
(get-suit (get-top-card f-slot)))
......@@ -224,7 +224,7 @@
(check-for-king (get-cards slot) free-reserves slot))
(list 2
(check-for-king (get-cards slot) free-reserves slot)
(gettext "an empty Tableau")))
(_"an empty Tableau")))
((and (not (= slot t-slot))
(not (empty-slot? t-slot))
(= (get-suit (get-top-card slot))
......@@ -240,7 +240,7 @@
(define (check-for-empty-reserve)
(and (> free-reserves 0)
(list 0 (gettext "Move something on to an empty reserve"))))
(list 0 (_"Move something on to an empty reserve"))))
(define (get-hint)
(or (check-to-foundations? 4 0)
......
......@@ -95,7 +95,7 @@
(set-statusbar-message (get-stock-no-string)))
(define (get-stock-no-string)
(string-append (gettext "Stock left: ")
(string-append (_"Stock left: ")
(number->string (length (get-cards 0)))))
(define (button-pressed slot-id card-list)
......@@ -344,7 +344,7 @@
(define (dealable?)
(if (not (empty-slot? 0))
(list 0 (gettext "Deal a card"))
(list 0 (_"Deal a card"))
#f))
(define (get-hint)
......
......@@ -93,7 +93,7 @@
(set-statusbar-message (get-stock-no-string)))
(define (get-stock-no-string)
(string-append (gettext "Stock left: ")
(string-append (_"Stock left: ")
(number->string (length (get-cards 0)))))
(define (button-pressed slot-id card-list)
......@@ -237,7 +237,7 @@
(define (dealable?)
(and (not (empty-slot? 0))
(list 0 (gettext "Deal a card"))))
(list 0 (_"Deal a card"))))
(define (get-hint)
(or (playable? 2)
......
......@@ -39,7 +39,7 @@
(set-statusbar-message (get-stock-no-string)))
(define (get-stock-no-string)
(string-append (gettext "Stock left: ")
(string-append (_"Stock left: ")
(number->string (length (get-cards 0)))))
(define (button-pressed slot-id card-list)
......@@ -124,7 +124,7 @@
(define (dealable?)
(and (not (empty-slot? 0))
(list 0 (gettext "Deal another round"))))
(list 0 (_"Deal another round"))))
(define (removable?)
(and (not (empty-slot? 1))
......@@ -135,18 +135,18 @@
(get-value (get-top-card 2))
(get-value (get-top-card 3))
(get-value (get-top-card 4)))
(list 0 (string-append (gettext "Remove the ")
(list 0 (string-append (_"Remove the ")
(cond ((= (get-value (get-top-card 1)) 1)
(gettext "aces"))
(_"aces"))
((= (get-value (get-top-card 1)) 11)
(gettext "jacks"))
(_"jacks"))
((= (get-value (get-top-card 1)) 12)
(gettext "queens"))
(_"queens"))
((= (get-value (get-top-card 1)) 13)
(gettext "kings"))
(_"kings"))
(#t
(string-append (number->string (get-value (get-top-card 1)))
(gettext "'s"))))))))
(_"'s"))))))))
(define (move-leftable? slot1 slot2)
(cond ((= slot1 4)
......@@ -166,7 +166,7 @@
(or (removable?)
(move-leftable? 1 2)
(dealable?)