Bill Nottingham 918e2e9
commit 2515ab983f2c4cb4e7e1e9bc405cb427833148d8
Bill Nottingham 918e2e9
Author: Geert Janssens <janssens-geert@telenet.be>
Bill Nottingham 918e2e9
Date:   Mon Mar 21 15:10:12 2011 +0000
Bill Nottingham 918e2e9
Bill Nottingham 918e2e9
    [PATCH 4/4] Bug #615168: N_ in the root module
Bill Nottingham 918e2e9
    
Bill Nottingham 918e2e9
    * src/app-utils/app-utils.scm:
Bill Nottingham 918e2e9
    * src/app-utils/c-interface.scm: Make N_ available to all of Gnucash. A
Bill Nottingham 918e2e9
      hack, but a correct hack that permits the Scheme code to be compiled.
Bill Nottingham 918e2e9
    
Bill Nottingham 918e2e9
    Patch by Andy Wingo.
Bill Nottingham 918e2e9
    
Bill Nottingham 918e2e9
    git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20438 57a11ea4-9604-0410-9ed3-97b8803252fd
Bill Nottingham 918e2e9
Bill Nottingham 918e2e9
diff --git a/src/app-utils/app-utils.scm b/src/app-utils/app-utils.scm
Bill Nottingham 918e2e9
index 2c64b12..3b00d50 100644
Bill Nottingham 918e2e9
--- a/src/app-utils/app-utils.scm
Bill Nottingham 918e2e9
+++ b/src/app-utils/app-utils.scm
Bill Nottingham 918e2e9
@@ -273,6 +273,22 @@
Bill Nottingham 918e2e9
 (define gnc:*kvp-option-path* (list KVP-OPTION-PATH))
Bill Nottingham 918e2e9
 (export gnc:*kvp-option-path*)
Bill Nottingham 918e2e9
 
Bill Nottingham 918e2e9
+;; gettext functions
Bill Nottingham 918e2e9
+(define gnc:gettext gnc-gettext-helper)
Bill Nottingham 918e2e9
+(define gnc:_ gnc:gettext)
Bill Nottingham 918e2e9
+(define _ gnc:gettext)
Bill Nottingham 918e2e9
+(define-syntax N_
Bill Nottingham 918e2e9
+  (syntax-rules ()
Bill Nottingham 918e2e9
+    ((_ x) x)))
Bill Nottingham 918e2e9
+
Bill Nottingham 918e2e9
+;; A lot of Gnucash's code uses procedural interfaces to load modules.
Bill Nottingham 918e2e9
+;; This normally works, for procedures -- but for values that need to be
Bill Nottingham 918e2e9
+;; known at expand time, like macros, it doesn't work (in Guile 2.0 at
Bill Nottingham 918e2e9
+;; least). So instead of auditing all the code, since N_ is really the
Bill Nottingham 918e2e9
+;; only Gnucash-defined macro in use, the surgical solution is just to
Bill Nottingham 918e2e9
+;; make N_ available everywhere.
Bill Nottingham 918e2e9
+(module-define! the-root-module 'N_ (module-ref (current-module) 'N_))
Bill Nottingham 918e2e9
+
Bill Nottingham 918e2e9
 (load-from-path "c-interface.scm")
Bill Nottingham 918e2e9
 (load-from-path "config-var.scm")
Bill Nottingham 918e2e9
 (load-from-path "options.scm")
Bill Nottingham 918e2e9
diff --git a/src/app-utils/c-interface.scm b/src/app-utils/c-interface.scm
Bill Nottingham 918e2e9
index 548e3bb..0f912a3 100644
Bill Nottingham 918e2e9
--- a/src/app-utils/c-interface.scm
Bill Nottingham 918e2e9
+++ b/src/app-utils/c-interface.scm
Bill Nottingham 918e2e9
@@ -37,15 +37,6 @@
Bill Nottingham 918e2e9
    (call-with-output-string write-error)))
Bill Nottingham 918e2e9
 
Bill Nottingham 918e2e9
 
Bill Nottingham 918e2e9
-;; gettext functions
Bill Nottingham 918e2e9
-(define gnc:gettext gnc-gettext-helper)
Bill Nottingham 918e2e9
-(define gnc:_ gnc:gettext)
Bill Nottingham 918e2e9
-(define _ gnc:gettext)
Bill Nottingham 918e2e9
-(define-syntax N_
Bill Nottingham 918e2e9
-  (syntax-rules ()
Bill Nottingham 918e2e9
-    ((_ x) x)))
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
-
Bill Nottingham 918e2e9
 ;; This database can be used to store and retrieve translatable
Bill Nottingham 918e2e9
 ;; strings. Strings that are returned by the lookup function are
Bill Nottingham 918e2e9
 ;; translated with gettext.