From fa026af058a9f52e61bf13d65091c3ba0b107f58 Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Mon, 12 Feb 2001 23:15:23 +0000 Subject: [PATCH] Bill Gribble's fix for report i18n. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3645 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 6 ++ src/scm/html-style-info.scm | 7 ++- src/scm/qif-import/qif-to-gnc.scm | 21 +------ src/scm/report.scm | 19 +++--- src/scm/report/account-summary.scm | 20 +++---- src/scm/report/average-balance.scm | 70 +++++++++++----------- src/scm/report/pnl.scm | 30 +++++----- src/scm/report/stylesheet-fancy.scm | 92 ++++++++++++++--------------- src/scm/report/stylesheet-plain.scm | 38 ++++++------ 9 files changed, 149 insertions(+), 154 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3883cb8287..ceb63c2c8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2001-02-12 Bill Gribble + * src/scm/html-style-info.scm: minor fixes to html style + compile + + * various in src/scm: fixes for i18n .. use (N_ instead of (_ + where appropriate. + * src/engine/gnc-numeric.{c,h}, src/scm/gnc-numeric.scm: add support for a new auto-denom type, GNC_DENOM_SIGFIGS(x), where x is the number of "significant figures" you want in the output. diff --git a/src/scm/html-style-info.scm b/src/scm/html-style-info.scm index a7f9684a16..cda12f2aa0 100644 --- a/src/scm/html-style-info.scm +++ b/src/scm/html-style-info.scm @@ -329,8 +329,8 @@ #t) (begin (kvt-fold key-merger #f (gnc:html-style-table-primary next)) - (if (not (null? (cdr antecedents))) - (compile-worker (cdr antecedents)) + (if (not (null? (cdr table-list))) + (compile-worker (cdr table-list)) #t))))) ;; make the compiled kvt table (gnc:html-style-table-set-compiled! table (make-kvtable)) @@ -340,7 +340,8 @@ (kvt-fold key-merger #f (gnc:html-style-table-primary table)) ;; now merge in the antecedents - (compile-worker antecedents)) + (if (not (null? antecedents)) + (compile-worker antecedents))) (define (gnc:html-style-table-uncompile table) diff --git a/src/scm/qif-import/qif-to-gnc.scm b/src/scm/qif-import/qif-to-gnc.scm index b8c381bd7f..787aaff3e1 100644 --- a/src/scm/qif-import/qif-to-gnc.scm +++ b/src/scm/qif-import/qif-to-gnc.scm @@ -170,24 +170,9 @@ qif-acct-map qif-cat-map qif-memo-map stock-map default-currency-name) - (define (dumper key . args) - (let ((stack (make-stack #t dumper))) - (display-backtrace stack (current-error-port)) - (apply display-error stack (current-error-port) args) - (throw 'ignore))) - - (catch - 'ignore - (lambda () - (lazy-catch #t - (lambda () (qif-import:qif-to-gnc-unsafe - qif-files-list - qif-acct-map qif-cat-map - qif-memo-map stock-map - default-currency-name)) - dumper)) - (lambda (key . args) - #f))) + (gnc:backtrace-if-exception + qif-import:qif-to-gnc-unsafe + qif-acct-map qif-cat-map qif-memo-map stock-map default-currency-name)) (define (qif-import:qif-to-gnc-unsafe qif-files-list qif-acct-map qif-cat-map qif-memo-map diff --git a/src/scm/report.scm b/src/scm/report.scm index 826bd6662e..8985cf3d56 100644 --- a/src/scm/report.scm +++ b/src/scm/report.scm @@ -125,15 +125,16 @@ (let ((generator (gnc:report-template-options-generator report-template)) (stylesheet (gnc:make-multichoice-option - (_ "General") (_ "Stylesheet") "0a" - (_ "Select a stylesheet for the report.") - (string->symbol (_ "Default")) + (N_ "General") (N_ "Stylesheet") "0a" + (N_ "Select a stylesheet for the report.") + (string->symbol (N_ "Default")) (map (lambda (ss) (vector (string->symbol (gnc:html-style-sheet-name ss)) (gnc:html-style-sheet-name ss) - (string-append (gnc:html-style-sheet-name ss) " Stylesheet"))) + (string-append (gnc:html-style-sheet-name ss) + (_ " Stylesheet")))) (gnc:get-html-style-sheets))))) (if (procedure? generator) (let ((options (generator))) @@ -230,7 +231,7 @@ retval)) -(define (gnc:report-run id) +(define (gnc:backtrace-if-exception proc . args) (define (dumper key . args) (let ((stack (make-stack #t dumper))) (display-backtrace stack (current-error-port)) @@ -241,11 +242,13 @@ 'ignore (lambda () (lazy-catch #t - (lambda () (gnc:report-run-unsafe id)) + (lambda () (apply proc args)) dumper)) (lambda (key . args) #f))) +(define (gnc:report-run id) + (gnc:backtrace-if-exception gnc:report-run-unsafe id)) (define (gnc:report-run-unsafe id) (let ((report (gnc:find-report id)) @@ -255,7 +258,6 @@ (gnc:report-ctext report)) ;; if there's clean cached text, return it (begin - (display "using cached text.\n") (gnc:report-ctext report)) ;; otherwise, rerun the report @@ -267,7 +269,8 @@ (symbol->string (gnc:option-value (gnc:lookup-option (gnc:report-options report) - (_ "General") (_ "Stylesheet"))))) + (N_ "General") + (N_ "Stylesheet"))))) (stylesheet (gnc:html-style-sheet-find stylesheet-name)) (doc (renderer report)) diff --git a/src/scm/report/account-summary.scm b/src/scm/report/account-summary.scm index abe882ba83..ec1df8ce01 100644 --- a/src/scm/report/account-summary.scm +++ b/src/scm/report/account-summary.scm @@ -35,14 +35,14 @@ ;; first define all option's names such that typos etc. are no longer ;; possible. -(let ((pagename-general (_ "General")) - (optname-date (_ "Date")) - (optname-display-depth (_ "Account Display Depth")) - (optname-show-subaccounts (_ "Always show sub-accounts")) - (optname-accounts (_ "Account")) - (optname-include-subbalances (_ "Include Sub-Account balances")) - (optname-show-foreign (_ "Show Foreign Currencies")) - (optname-report-currency (_ "Report's currency"))) +(let ((pagename-general (N_ "General")) + (optname-date (N_ "Date")) + (optname-display-depth (N_ "Account Display Depth")) + (optname-show-subaccounts (N_ "Always show sub-accounts")) + (optname-accounts (N_ "Account")) + (optname-include-subbalances (N_ "Include Sub-Account balances")) + (optname-show-foreign (N_ "Show Foreign Currencies")) + (optname-report-currency (N_ "Report's currency"))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; options generator @@ -107,7 +107,7 @@ (doc (gnc:make-html-document)) (txt (gnc:make-html-text))) - (gnc:html-document-set-title! doc "Account Summary") + (gnc:html-document-set-title! doc (_ "Account Summary")) (if (not (null? accounts)) ;; if no max. tree depth is given we have to find the ;; maximum existing depth @@ -158,6 +158,6 @@ (gnc:define-report 'version 1 - 'name (_ "Account Summary") + 'name (N_ "Account Summary") 'options-generator accsum-options-generator 'renderer accsum-renderer)) diff --git a/src/scm/report/average-balance.scm b/src/scm/report/average-balance.scm index e4978a4aed..f67fb51221 100644 --- a/src/scm/report/average-balance.scm +++ b/src/scm/report/average-balance.scm @@ -27,8 +27,8 @@ ;; From date (register-option (gnc:make-date-option - (_ "General") (_ "From") - "a" (_ "Report Items from this date") + (N_ "General") (N_ "From") + "a" (N_ "Report Items from this date") (lambda () (let ((bdtime (localtime (current-time)))) (set-tm:sec bdtime 0) @@ -43,8 +43,8 @@ ;; to-date (register-option (gnc:make-date-option - (_ "General") (_ "To") - "c" (_ "Report items up to and including this date") + (N_ "General") (N_ "To") + "c" (N_ "Report items up to and including this date") (lambda () (let ((bdtime (localtime (current-time)))) (set-tm:sec bdtime 59) @@ -56,8 +56,8 @@ ;; account(s) to do report on (register-option (gnc:make-account-list-option - (_ "General") (_ "Accounts") - "d" (_ "Do transaction report on this account") + (N_ "General") (N_ "Accounts") + "d" (N_ "Do transaction report on this account") (lambda () (let ((current-accounts (gnc:get-current-accounts))) (cond ((not (null? current-accounts)) current-accounts) @@ -67,8 +67,8 @@ (register-option (gnc:make-multichoice-option - (_ "General") (_ "Step Size") - "b" (_ "The amount of time between data points") 'WeekDelta + (N_ "General") (N_ "Step Size") + "b" (N_ "The amount of time between data points") 'WeekDelta (list #(DayDelta "Day" "Day") #(WeekDelta "Week" "Week") #(TwoWeekDelta "2Week" "Two Week") @@ -78,41 +78,41 @@ (register-option (gnc:make-simple-boolean-option - (_ "General") (_ "Sub-Accounts") - "e" (_ "Include sub-accounts of all selected accounts") #f)) + (N_ "General") (N_ "Sub-Accounts") + "e" (N_ "Include sub-accounts of all selected accounts") #f)) (register-option (gnc:make-list-option - (_ "Output") (_ "Plot Type") - "a" (_ "The type of graph to generate") (list 'AvgBalPlot) + (N_ "Output") (N_ "Plot Type") + "a" (N_ "The type of graph to generate") (list 'AvgBalPlot) (list (list->vector - (list 'AvgBalPlot (_ "Average") (_ "Average Balance"))) + (list 'AvgBalPlot (N_ "Average") (N_ "Average Balance"))) (list->vector - (list 'GainPlot (_ "Net Gain") (_ "Net Gain"))) + (list 'GainPlot (N_ "Net Gain") (N_ "Net Gain"))) (list->vector - (list 'GLPlot (_ "Gain/Loss") (_ "Gain And Loss")))))) + (list 'GLPlot (N_ "Gain/Loss") (N_ "Gain And Loss")))))) (register-option (gnc:make-number-range-option - (_ "Output") (_ "Plot Width") - "b" (_ "Width of plot in pixels.") 400 + (N_ "Output") (N_ "Plot Width") + "b" (N_ "Width of plot in pixels.") 400 100 1000 0 1)) (register-option (gnc:make-number-range-option - (_ "Output") (_ "Plot Height") - "b" (_ "Height of plot in pixels.") 400 + (N_ "Output") (N_ "Plot Height") + "b" (N_ "Height of plot in pixels.") 400 100 1000 0 1)) (register-option (gnc:make-simple-boolean-option - (_ "Output") (_ "Show plot") - "b" (_ "Display a graph of the selected data.") #t)) + (N_ "Output") (N_ "Show plot") + "b" (N_ "Display a graph of the selected data.") #t)) (register-option (gnc:make-simple-boolean-option - (_ "Output") (_ "Show table") - "b" (_ "Display a table of the selected data.") #f)) + (N_ "Output") (N_ "Show table") + "b" (N_ "Display a table of the selected data.") #f)) options)) @@ -234,20 +234,20 @@ (gnc:option-value (gnc:lookup-option (gnc:report-options report-obj) sec value)))) (begindate (gnc:date-option-absolute-time - (opt-val (_ "General") (_ "From")))) + (opt-val (N_ "General") (N_ "From")))) (enddate (gnc:timepair-end-day-time (gnc:date-option-absolute-time - (opt-val (_ "General") (_ "To"))))) - (stepsize (eval (opt-val (_ "General") (_ "Step Size")))) - (accounts (opt-val (_ "General") (_ "Accounts"))) - (dosubs? (opt-val (_ "General") (_ "Sub-Accounts"))) - (plot-type (opt-val (_ "Output") (_ "Plot Type"))) - (show-plot? (opt-val (_ "Output") (_ "Show plot"))) - (show-table? (opt-val (_ "Output") (_ "Show table"))) + (opt-val (N_ "General") (N_ "To"))))) + (stepsize (eval (opt-val (N_ "General") (N_ "Step Size")))) + (accounts (opt-val (N_ "General") (N_ "Accounts"))) + (dosubs? (opt-val (N_ "General") (N_ "Sub-Accounts"))) + (plot-type (opt-val (N_ "Output") (N_ "Plot Type"))) + (show-plot? (opt-val (N_ "Output") (N_ "Show plot"))) + (show-table? (opt-val (N_ "Output") (N_ "Show table"))) (document (gnc:make-html-document)) (startbal 0.0)) - (gnc:html-document-set-title! document (_ "Average Balance")) + (gnc:html-document-set-title! document (N_ "Average Balance")) (if (not (null? accounts)) (let ((query (gnc:malloc-query)) @@ -303,8 +303,8 @@ ;; plot comes first. (if show-plot? (let ((barchart (gnc:make-html-barchart)) - (width (opt-val (_ "Output") (_ "Plot Width"))) - (height (opt-val (_ "Output") (_ "Plot Height"))) + (width (opt-val (N_ "Output") (N_ "Plot Width"))) + (height (opt-val (N_ "Output") (N_ "Plot Height"))) (col-labels '()) (col-colors '())) (if (memq 'AvgBalPlot plot-type) @@ -395,7 +395,7 @@ (gnc:define-report 'version 1 - 'name (_ "Average Balance Tracker") + 'name (N_ "Average Balance") 'options-generator options-generator 'renderer renderer)) diff --git a/src/scm/report/pnl.scm b/src/scm/report/pnl.scm index e86be111fe..9fab6d2dd1 100644 --- a/src/scm/report/pnl.scm +++ b/src/scm/report/pnl.scm @@ -31,20 +31,20 @@ ;; first define all option's names so that they are properly defined ;; in *one* place. -(let* ((pagename-general (_ "General")) - (optname-from-date (_ "From")) - (optname-to-date (_ "To")) - - (pagename-accounts (_ "Accounts")) - (optname-display-depth (_ "Account Display Depth")) - (optname-show-subaccounts (_ "Always show sub-accounts")) - (optname-accounts (_ "Account")) - (optname-include-subbalances (_ "Include Sub-Account balances")) - -;; (pagename-currencies (_ "Currencies")) too little options :) - (pagename-currencies pagename-general) - (optname-show-foreign (_ "Show Foreign Currencies")) - (optname-report-currency (_ "Report's currency"))) +(let* ((pagename-general (N_ "General")) + (optname-from-date (N_ "From")) + (optname-to-date (N_ "To")) + + (pagename-accounts (N_ "Accounts")) + (optname-display-depth (N_ "Account Display Depth")) + (optname-show-subaccounts (N_ "Always show sub-accounts")) + (optname-accounts (N_ "Account")) + (optname-include-subbalances (N_ "Include Sub-Account balances")) + +;; (pagename-currencies (N_ "Currencies")) too little options :) + (pagename-currencies pagename-general) + (optname-show-foreign (N_ "Show Foreign Currencies")) + (optname-report-currency (N_ "Report's currency"))) ;; options generator (define (pnl-options-generator) @@ -170,6 +170,6 @@ (gnc:define-report 'version 1 - 'name (_ "Profit And Loss") + 'name (N_ "Profit And Loss") 'options-generator pnl-options-generator 'renderer pnl-renderer)) diff --git a/src/scm/report/stylesheet-fancy.scm b/src/scm/report/stylesheet-fancy.scm index 4939566929..140a04f98f 100644 --- a/src/scm/report/stylesheet-fancy.scm +++ b/src/scm/report/stylesheet-fancy.scm @@ -36,84 +36,84 @@ (gnc:register-option options opt)))) (opt-register (gnc:make-string-option - (_ "General") - (_ "Preparer") "a" - (_ "Name of person preparing the report") + (N_ "General") + (N_ "Preparer") "a" + (N_ "Name of person preparing the report") "")) (opt-register (gnc:make-string-option - (_ "General") - (_ "Prepared for") "b" - (_ "Name of organization or company prepared for") + (N_ "General") + (N_ "Prepared for") "b" + (N_ "Name of organization or company prepared for") "")) (opt-register (gnc:make-simple-boolean-option - (_ "General") - (_ "Show preparer info") "c" - (_ "Name of organization or company") + (N_ "General") + (N_ "Show preparer info") "c" + (N_ "Name of organization or company") #f)) (opt-register (gnc:make-simple-boolean-option - (_ "General") - (_ "Enable Links") "c" - (_ "Enable hyperlinks in reports") + (N_ "General") + (N_ "Enable Links") "c" + (N_ "Enable hyperlinks in reports") #t)) (opt-register (gnc:make-pixmap-option - (_ "Images") - (_ "Background Tile") "a" (_ "Background tile for reports.") + (N_ "Images") + (N_ "Background Tile") "a" (N_ "Background tile for reports.") "")) (opt-register (gnc:make-pixmap-option - (_ "Images") - (_ "Heading Banner") "b" (_ "Banner for top of report.") + (N_ "Images") + (N_ "Heading Banner") "b" (N_ "Banner for top of report.") "")) (opt-register (gnc:make-pixmap-option - (_ "Images") - (_ "Logo") "c" (_ "Company logo image.") + (N_ "Images") + (N_ "Logo") "c" (N_ "Company logo image.") "")) (opt-register (gnc:make-color-option - (_ "Colors") - (_ "Background Color") "a" (_ "General background color for report.") + (N_ "Colors") + (N_ "Background Color") "a" (N_ "General background color for report.") (list #xff #x88 #xff 0) 255 #f)) (opt-register (gnc:make-color-option - (_ "Colors") - (_ "Text Color") "b" (_ "Normal body text color.") + (N_ "Colors") + (N_ "Text Color") "b" (N_ "Normal body text color.") (list #x00 #x00 #x00 0) 255 #f)) (opt-register (gnc:make-color-option - (_ "Colors") - (_ "Link Color") "c" (_ "Link text color.") + (N_ "Colors") + (N_ "Link Color") "c" (N_ "Link text color.") (list #x00 #xff #xff 0) 255 #f)) (opt-register (gnc:make-color-option - (_ "Colors") - (_ "Table Cell Color") "c" (_ "Default background for table cells.") + (N_ "Colors") + (N_ "Table Cell Color") "c" (N_ "Default background for table cells.") (list #xff #x00 #xff 0) 255 #f)) (opt-register (gnc:make-number-range-option - (_ "Tables") - (_ "Table cell spacing") "a" (_ "Space between table cells") + (N_ "Tables") + (N_ "Table cell spacing") "a" (N_ "Space between table cells") 1 0 20 0 1)) (opt-register (gnc:make-number-range-option - (_ "Tables") - (_ "Table cell padding") "b" (_ "Space between table cells") + (N_ "Tables") + (N_ "Table cell padding") "b" (N_ "Space between table cells") 1 0 20 0 1)) (opt-register (gnc:make-number-range-option - (_ "Tables") - (_ "Table border width") "c" (_ "Bevel depth on tables") + (N_ "Tables") + (N_ "Table border width") "c" (N_ "Bevel depth on tables") 1 0 20 0 1)) options)) @@ -127,20 +127,20 @@ (lambda (section name) (gnc:color-option->html (gnc:lookup-option options section name)))) - (preparer (opt-val (_ "General") (_ "Preparer"))) - (prepared-for (opt-val (_ "General") (_ "Prepared for"))) - (show-preparer? (opt-val (_ "General") (_ "Show preparer info"))) - (links? (opt-val (_ "General") (_ "Enable Links"))) - (bgcolor (color-val (_ "Colors") (_ "Background Color"))) - (textcolor (color-val (_ "Colors") (_ "Text Color"))) - (linkcolor (color-val (_ "Colors") (_ "Link Color"))) - (cellcolor (color-val (_ "Colors") (_ "Table Cell Color"))) - (bgpixmap (opt-val (_ "Images") (_ "Background Tile"))) - (headpixmap (opt-val (_ "Images") (_ "Heading Banner"))) - (logopixmap (opt-val (_ "Images") (_ "Logo"))) - (spacing (opt-val (_ "Tables") (_ "Table cell spacing"))) - (padding (opt-val (_ "Tables") (_ "Table cell padding"))) - (border (opt-val (_ "Tables") (_ "Table border width")))) + (preparer (opt-val (N_ "General") (N_ "Preparer"))) + (prepared-for (opt-val (N_ "General") (N_ "Prepared for"))) + (show-preparer? (opt-val (N_ "General") (N_ "Show preparer info"))) + (links? (opt-val (N_ "General") (N_ "Enable Links"))) + (bgcolor (color-val (N_ "Colors") (N_ "Background Color"))) + (textcolor (color-val (N_ "Colors") (N_ "Text Color"))) + (linkcolor (color-val (N_ "Colors") (N_ "Link Color"))) + (cellcolor (color-val (N_ "Colors") (N_ "Table Cell Color"))) + (bgpixmap (opt-val (N_ "Images") (N_ "Background Tile"))) + (headpixmap (opt-val (N_ "Images") (N_ "Heading Banner"))) + (logopixmap (opt-val (N_ "Images") (N_ "Logo"))) + (spacing (opt-val (N_ "Tables") (N_ "Table cell spacing"))) + (padding (opt-val (N_ "Tables") (N_ "Table cell padding"))) + (border (opt-val (N_ "Tables") (N_ "Table border width")))) (gnc:html-document-set-style! ssdoc "body" diff --git a/src/scm/report/stylesheet-plain.scm b/src/scm/report/stylesheet-plain.scm index b305f1445d..a57e4e3018 100644 --- a/src/scm/report/stylesheet-plain.scm +++ b/src/scm/report/stylesheet-plain.scm @@ -35,34 +35,34 @@ (gnc:register-option options opt)))) (opt-register (gnc:make-color-option - (_ "General") - (_ "Background Color") "a" (_ "Background color for reports.") + (N_ "General") + (N_ "Background Color") "a" (N_ "Background color for reports.") (list #xff #xff #xff 0) 255 #f)) (opt-register (gnc:make-pixmap-option - (_ "General") - (_ "Background Pixmap") "b" (_ "Background tile for reports.") + (N_ "General") + (N_ "Background Pixmap") "b" (N_ "Background tile for reports.") "")) (opt-register (gnc:make-simple-boolean-option - (_ "General") - (_ "Enable Links") "c" (_ "Enable hyperlinks in reports.") + (N_ "General") + (N_ "Enable Links") "c" (N_ "Enable hyperlinks in reports.") #t)) (opt-register (gnc:make-number-range-option - (_ "Tables") - (_ "Table cell spacing") "c" (_ "Space between table cells") + (N_ "Tables") + (N_ "Table cell spacing") "c" (N_ "Space between table cells") 1 0 20 0 1)) (opt-register (gnc:make-number-range-option - (_ "Tables") - (_ "Table cell padding") "d" (_ "Space between table cells") + (N_ "Tables") + (N_ "Table cell padding") "d" (N_ "Space between table cells") 1 0 20 0 1)) (opt-register (gnc:make-number-range-option - (_ "Tables") - (_ "Table border width") "e" (_ "Bevel depth on tables") + (N_ "Tables") + (N_ "Table border width") "e" (N_ "Bevel depth on tables") 0 0 20 0 1)) options)) @@ -75,13 +75,13 @@ (bgcolor (gnc:color-option->html (gnc:lookup-option options - (_ "General") - (_ "Background Color")))) - (bgpixmap (opt-val (_ "General") (_ "Background Pixmap"))) - (links? (opt-val (_ "General") (_ "Enable Links"))) - (spacing (opt-val (_ "Tables") (_ "Table cell spacing"))) - (padding (opt-val (_ "Tables") (_ "Table cell padding"))) - (border (opt-val (_ "Tables") (_ "Table border width")))) + (N_ "General") + (N_ "Background Color")))) + (bgpixmap (opt-val (N_ "General") (N_ "Background Pixmap"))) + (links? (opt-val (N_ "General") (N_ "Enable Links"))) + (spacing (opt-val (N_ "Tables") (N_ "Table cell spacing"))) + (padding (opt-val (N_ "Tables") (N_ "Table cell padding"))) + (border (opt-val (N_ "Tables") (N_ "Table border width")))) (gnc:html-document-set-style!