mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Register tip-of-the-day strings as translatable.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3034 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
2212f79720
commit
614fcada94
@ -55,6 +55,19 @@
|
||||
(hash-set! string-hash string #t)))
|
||||
strings)))
|
||||
|
||||
(define (expand-newlines string port)
|
||||
(let loop ((chars (string->list string))
|
||||
(accum '()))
|
||||
(cond
|
||||
((null? chars)
|
||||
(write (list->string (reverse accum)) port))
|
||||
((char=? (car chars) #\newline)
|
||||
(write (list->string (reverse accum)) port)
|
||||
(display "\"\\n\"\n " port)
|
||||
(loop (cdr chars) '()))
|
||||
(else
|
||||
(loop (cdr chars) (cons (car chars) accum))))))
|
||||
|
||||
(define (save file)
|
||||
(let ((port (open file (logior O_WRONLY O_CREAT O_TRUNC))))
|
||||
(if port
|
||||
@ -62,7 +75,7 @@
|
||||
(hash-for-each
|
||||
(lambda (string not-used)
|
||||
(display "_(" port)
|
||||
(write string port)
|
||||
(expand-newlines string port)
|
||||
(display ")\n" port))
|
||||
string-hash)
|
||||
(close port)))))
|
||||
|
@ -67,6 +67,11 @@
|
||||
(gnc:config-var-value-get gnc:*tip-file*)
|
||||
(gnc:config-var-value-get gnc:*load-path*)))))
|
||||
(set! gnc:*tip-list* (read in-port))
|
||||
(if (gnc:debugging?)
|
||||
(for-each (lambda (list-strings)
|
||||
(gnc:register-translatable-strings
|
||||
(string-fold list-strings "\n")))
|
||||
gnc:*tip-list*))
|
||||
(if (not (= (length gnc:*tip-list*)
|
||||
(gnc:config-var-value-get gnc:*current-tip-number*)))
|
||||
(begin
|
||||
@ -79,9 +84,10 @@
|
||||
#f))
|
||||
|
||||
(define (gnc:get-current-tip)
|
||||
(string-fold (list-ref gnc:*tip-list*
|
||||
(gnc:_ (string-fold
|
||||
(list-ref gnc:*tip-list*
|
||||
(gnc:config-var-value-get gnc:*current-tip-number*))
|
||||
"\n"))
|
||||
"\n")))
|
||||
|
||||
(define (gnc:increment-tip-number)
|
||||
(let ((new-value (+ (gnc:config-var-value-get gnc:*current-tip-number*) 1)))
|
||||
|
Loading…
Reference in New Issue
Block a user