gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Mon Jan 16 11:24:29 EST 2023


Updated	 via  https://github.com/Gnucash/gnucash/commit/580efe09 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/645cc946 (commit)
	from  https://github.com/Gnucash/gnucash/commit/ccc8b44b (commit)



commit 580efe091c74137fac1835301419ee8301bfb3a9
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Wed Aug 17 07:45:09 2022 +0800

    Bug 797725 - Untranslatable string "For Period Covering ~a to ~a"

diff --git a/gnucash/report/reports/standard/account-summary.scm b/gnucash/report/reports/standard/account-summary.scm
index cd4259e0a..08b56252c 100644
--- a/gnucash/report/reports/standard/account-summary.scm
+++ b/gnucash/report/reports/standard/account-summary.scm
@@ -318,14 +318,17 @@
          (exchange-fn (gnc:case-exchange-fn price-source report-commodity to-date)))
 
     (gnc:html-document-set-title!
-     doc (string-append
-          company-name " " report-title " "
-          (if sx?
-              ;; Translators: This is part of the report title, which is capitalzed in English, but not all other languages
-              (format #f (G_ "For Period Covering ~a to ~a")
-                      (qof-print-date from-date)
-                      (qof-print-date to-date))
-              (qof-print-date to-date))))
+     doc
+     (if sx?
+         (gnc:format (G_ "${company-name} ${report-title} For Period Covering ${start} to ${end}")
+                     'company-name company-name
+                     'report-title report-title
+                     'start (qof-print-date from-date)
+                     'end (qof-print-date to-date))
+         (gnc:format (G_ "${company-name} ${report-title} ${date}")
+                     'company-name company-name
+                     'report-title report-title
+                     'date (qof-print-date to-date))))
 
     (if (null? accounts)
 
diff --git a/gnucash/report/reports/standard/equity-statement.scm b/gnucash/report/reports/standard/equity-statement.scm
index 8661214eb..302bb7542 100644
--- a/gnucash/report/reports/standard/equity-statement.scm
+++ b/gnucash/report/reports/standard/equity-statement.scm
@@ -298,12 +298,11 @@
       (gnc:account-get-comm-balance-at-date account end-date #f))
 
     (gnc:html-document-set-title! 
-     doc (format #f
-		  (string-append "~a ~a "
-				 (G_ "For Period Covering ~a to ~a"))
-		  company-name report-title
-                  (qof-print-date start-date-printable)
-                  (qof-print-date end-date)))
+     doc (gnc:format (G_ "${company-name} ${report-title} For Period Covering ${start} to ${end}")
+                     'company-name company-name
+                     'report-title report-title
+                     'start (qof-print-date start-date-printable)
+                     'end (qof-print-date end-date)))
     
     (if (null? accounts)
 	
diff --git a/gnucash/report/reports/standard/income-statement.scm b/gnucash/report/reports/standard/income-statement.scm
index ebc53a9cd..85662ef77 100644
--- a/gnucash/report/reports/standard/income-statement.scm
+++ b/gnucash/report/reports/standard/income-statement.scm
@@ -403,10 +403,11 @@
       (gnc:html-table-append-ruler! table (* 2 tree-depth)))
 
     (gnc:html-document-set-title!
-     doc (format #f (string-append "~a ~a " (G_ "For Period Covering ~a to ~a"))
-                  company-name report-title
-                  (qof-print-date start-date-printable)
-                  (qof-print-date end-date)))
+     doc (gnc:format (G_ "${company-name} ${report-title} For Period Covering ${start} to ${end}")
+                     'company-name company-name
+                     'report-title report-title
+                     'start (qof-print-date start-date-printable)
+                     'end (qof-print-date end-date)))
 
     (if (null? accounts)
 
diff --git a/gnucash/report/reports/standard/trial-balance.scm b/gnucash/report/reports/standard/trial-balance.scm
index c3c543ae3..e6032db91 100644
--- a/gnucash/report/reports/standard/trial-balance.scm
+++ b/gnucash/report/reports/standard/trial-balance.scm
@@ -399,15 +399,17 @@
          (period-for (string-append " " (G_ "for Period"))))
 
     (gnc:html-document-set-title!
-     doc (if (eq? report-variant 'current)
-             (format #f "~a ~a ~a"
-                     company-name report-title
-                     (qof-print-date end-date))
-             (format #f (string-append "~a ~a "
-                                       (G_ "For Period Covering ~a to ~a"))
-                     company-name report-title
-                     (qof-print-date start-date-printable)
-                     (qof-print-date end-date))))
+     doc
+     (if (eq? report-variant 'current)
+         (gnc:format (G_ "${company-name} ${report-title} ${date}")
+                     'company-name company-name
+                     'report-title report-title
+                     'date (qof-print-date end-date))
+         (gnc:format (G_ "${company-name} ${report-title} For Period Covering ${start} to ${end}")
+                     'company-name company-name
+                     'report-title report-title
+                     'start (qof-print-date start-date-printable)
+                     'end (qof-print-date end-date))))
 
     (if (null? accounts)
 

commit 645cc9461dddd95c0b417191da6f72218947e197
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Wed Aug 17 09:20:37 2022 +0800

    [core-utils] modify gnc:format to accept -
    
    this allows use of varnames such as ${report-title}

diff --git a/bindings/guile/core-utils.scm b/bindings/guile/core-utils.scm
index d1bc46af6..dfe98fc5a 100644
--- a/bindings/guile/core-utils.scm
+++ b/bindings/guile/core-utils.scm
@@ -111,7 +111,7 @@
 (set-exception-printer! 'unbound-variable print-unbound-variable-error)
 
 ;; format.
-(define %regex (make-regexp "[$][{]([[:alnum:]]+)[}]"))
+(define %regex (make-regexp "[$][{]([[:alnum:]\\-]+)[}]"))
 (define (gnc:format str . bindings)
   (define hash (make-hash-table))
   (define (substitute m)
diff --git a/bindings/guile/test/test-core-utils.scm b/bindings/guile/test/test-core-utils.scm
index c36734c18..0910cae05 100644
--- a/bindings/guile/test/test-core-utils.scm
+++ b/bindings/guile/test/test-core-utils.scm
@@ -30,6 +30,10 @@
     "basic test"
     (gnc:format "basic ${job}" 'job "test"))
 
+  (test-equal "one substitution with hyphen"
+    "master chief"
+    (gnc:format "master ${job-title}" 'job-title "chief"))
+
   (test-equal "two substitutions out of order"
     "basic test"
     (gnc:format "${difficulty} ${job}" 'job "test" 'difficulty "basic"))



Summary of changes:
 bindings/guile/core-utils.scm                        |  2 +-
 bindings/guile/test/test-core-utils.scm              |  4 ++++
 gnucash/report/reports/standard/account-summary.scm  | 19 +++++++++++--------
 gnucash/report/reports/standard/equity-statement.scm | 11 +++++------
 gnucash/report/reports/standard/income-statement.scm |  9 +++++----
 gnucash/report/reports/standard/trial-balance.scm    | 20 +++++++++++---------
 6 files changed, 37 insertions(+), 28 deletions(-)



More information about the gnucash-changes mailing list