>From fd66df6342892eb3aa26ca512224464282ea3643 Mon Sep 17 00:00:00 2001 From: Morgan Smith Date: Thu, 23 Feb 2023 14:58:03 -0500 Subject: [PATCH 4/8] Use G_ for gettext instead of _. This is recommended in the Guile manual as '_' has many special meanings in Guile. * glean/boot.scm: Replace references of _ with G_. * glean/common/base-server.scm: Ditto. * glean/common/components.scm: Ditto. * glean/common/utils.scm: Ditto. * glean/librarian/catalogues.scm: Ditto. * glean/library/library-store.scm: Ditto. * glean/library/set-operations.scm: Ditto. * glean/library/set-tools.scm: Ditto. * glean/maker/engrave.scm: Ditto. * glean/maker/source.scm: Ditto. --- glean/boot.scm | 2 +- glean/common/base-server.scm | 2 +- glean/common/components.scm | 8 ++++---- glean/common/utils.scm | 10 +++++----- glean/librarian/catalogues.scm | 26 +++++++++++++------------- glean/library/library-store.scm | 2 +- glean/library/set-operations.scm | 4 ++-- glean/library/set-tools.scm | 2 +- glean/maker/engrave.scm | 10 +++++----- glean/maker/source.scm | 2 +- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/glean/boot.scm b/glean/boot.scm index cbb465e..dce2fff 100644 --- a/glean/boot.scm +++ b/glean/boot.scm @@ -94,7 +94,7 @@ client or maker) you can run that command followed by the `--help' option.")) (lambda _ (setlocale LC_ALL "")) (lambda args - (warning (_ "failed to install locale: ~a~%") + (warning (G_ "failed to install locale: ~a~%") (strerror (system-error-errno args))))) (textdomain %gettext-domain%) ; Setup gettext (ensure-user-dirs %log-dir% %socket-dir%) ; Create user dirs. diff --git a/glean/common/base-server.scm b/glean/common/base-server.scm index 97fbe71..e6bdbb8 100644 --- a/glean/common/base-server.scm +++ b/glean/common/base-server.scm @@ -53,7 +53,7 @@ SERVER-DISPATCHER should be a procedure of one argument. That argument will normally be a request but has not been parsed yet." ;; Check for existing socket files (when (file-exists? socket-file) - (warning (_ "Encountered an existing socket. + (warning (G_ "Encountered an existing socket. Another instance of this Glean server might be running! Continue? (y/n)")) diff --git a/glean/common/components.scm b/glean/common/components.scm index d654786..3ee8cfb 100644 --- a/glean/common/components.scm +++ b/glean/common/components.scm @@ -344,17 +344,17 @@ simply return result." (if (regexp-match? match) (let* ((ext-name (basename (match:prefix match))) (mod-name (module-name path base-dir))) - (insist (_ "Found component ~s: [add]~%") ext-name) + (insist (G_ "Found component ~s: [add]~%") ext-name) (vhash-cons ext-name (cons mod-name (delay (module-ref (resolve-interface mod-name) 'component))) result)) (begin - (insist (_ "Found non-component ~s: [skip]~%") (basename path)) + (insist (G_ "Found non-component ~s: [skip]~%") (basename path)) result)))) - (insist (_ "Scanning for ~s...~%") pattern) + (insist (G_ "Scanning for ~s...~%") pattern) (component-walk scan-dir ext-so-far leaf)) (define (component-walk scan-dir ext-so-far leaf-proc) @@ -366,7 +366,7 @@ leaf procedure in a file-system-fold starting at SCAN-DIR." (lambda (path stat result) result) ; up (const #f) ; skip (lambda (path stat errno result) ; error - (caution (_ "cannot access `~a': ~a.~%") + (caution (G_ "cannot access `~a': ~a.~%") path (strerror errno)) result) ext-so-far diff --git a/glean/common/utils.scm b/glean/common/utils.scm index d3a915d..044f181 100644 --- a/glean/common/utils.scm +++ b/glean/common/utils.scm @@ -37,7 +37,7 @@ #:use-module (srfi srfi-9) #:use-module (srfi srfi-26) #:export ( - _ + G_ N_ seq flatten @@ -190,10 +190,10 @@ messages." (syntax-case x () ((name (underscore fmt) args (... ...)) (and (string? (syntax->datum #'fmt)) - (free-identifier=? #'underscore #'_)) + (free-identifier=? #'underscore #'G_)) (with-syntax ((fmt* (augmented-format-string #'fmt)) (prefix (datum->syntax x prefix))) - #'(format (glean-warning-port) (gettext fmt*) + #'(format (glean-warning-port) (gettext fmt* %gettext-domain%) (program-name) (program-name) prefix args (... ...)))) ((name (N-underscore singular plural n) args (... ...)) @@ -204,7 +204,7 @@ messages." (p (augmented-format-string #'plural)) (prefix (datum->syntax x prefix))) #'(format (glean-warning-port) - (ngettext s p n %gettext-domain) + (ngettext s p n %gettext-domain%) (program-name) (program-name) prefix args (... ...)))))))) @@ -262,7 +262,7 @@ not log." (apply format port msg) (close-port port))) (lambda (key . args) - (leave (_ "logging failure: ~a.~%") + (leave (G_ "logging failure: ~a.~%") (string-join (caddr args) " ")))) (apply format port msg))))) (cond (verbose (logger (current-output-port))) diff --git a/glean/librarian/catalogues.scm b/glean/librarian/catalogues.scm index 6c044bb..d1e5ffc 100644 --- a/glean/librarian/catalogues.scm +++ b/glean/librarian/catalogues.scm @@ -163,39 +163,39 @@ CAT-DIR: string pointing to the directory in which catalogues are to be (match id ('catalogue-detailer (match context ((cat-id . cat-dir) - (leave (_ "Catalogue '~a' could not be found in ~a.~%") + (leave (G_ "Catalogue '~a' could not be found in ~a.~%") cat-id cat-dir)))) ('catalogue-installer - (leave (_ "A problem occured creating the new catalogue.\n"))) + (leave (G_ "A problem occured creating the new catalogue.\n"))) ('catalogue-lister (match context - ((cat-dir . #f) (leave (_ "No catalogues found at ~a.~%") cat-dir)))) + ((cat-dir . #f) (leave (G_ "No catalogues found at ~a.~%") cat-dir)))) ('current-catalogue-setter - (leave (_ "A problem occured switching to the catalogue.\n"))) + (leave (G_ "A problem occured switching to the catalogue.\n"))) ('current-catalogue-namer - (leave (_ "Unable to establish current catalogue's name.\n"))) + (leave (G_ "Unable to establish current catalogue's name.\n"))) ('discipline-installer (match context (('duplicate . target) - (leave (_ "A discipline with the unique name~%\t'~a' + (leave (G_ "A discipline with the unique name~%\t'~a' already exists in the store.~% Instead of installing the discipline again, you can simply re-activate it. Alternatively, if you know what you are doing, delete the discipline from the store and try again.~%") target)) (_ - (leave (_ "We encountered a problem installing the discipline.~%"))))) + (leave (G_ "We encountered a problem installing the discipline.~%"))))) ('invalid-catalogue-store (match context - ((path) (leave (_ "Invalid catalogue found at ~a.~%") path)))) + ((path) (leave (G_ "Invalid catalogue found at ~a.~%") path)))) ('next-catalogue-counter-maker - (leave (_ "A problem occured creating a new counter."))) + (leave (G_ "A problem occured creating a new counter."))) ('store-name (match context (('missing-discipline . (id)) - (leave (_ "Discipline '~a' could not be loaded. Is it faulty?~%") + (leave (G_ "Discipline '~a' could not be loaded. Is it faulty?~%") id)))) - (_ (leave (_ "An unknown problem identified by '~a' occurred.~%") id)))) + (_ (leave (G_ "An unknown problem identified by '~a' occurred.~%") id)))) (define* (emit-catalogue cat #:key (full? #t)) "Emit a summary of the catalogue CAT, listing CAT's id and the id of each @@ -524,7 +524,7 @@ PATH: string pointing to the leaf currently being handled. STAT: object as returned by (stat). JOURNEY: object summarizing the traversal. " - (warning (_ "We unexpectedly skipped a directory: ~a") path) + (warning (G_ "We unexpectedly skipped a directory: ~a") path) journey) (define (catalogue-error path stat errno journey) @@ -539,7 +539,7 @@ JOURNEY: object summarizing the traversal. " (if (= errno 2) (throw 'unknown-catalogue '()) - (warning (_ "Encountered error while accessing ~a: ~a.~%") path errno)) + (warning (G_ "Encountered error while accessing ~a: ~a.~%") path errno)) journey) (define* (catalogue-system-fold local-enter? local-down init dir diff --git a/glean/library/library-store.scm b/glean/library/library-store.scm index a58551f..adb6a4a 100644 --- a/glean/library/library-store.scm +++ b/glean/library/library-store.scm @@ -443,7 +443,7 @@ that provide content for the library. These modules are then parsed using (lambda (path stat result) result) ; up (const #f) ; skip (lambda (path stat errno result) ; error - (error (_ "cannot access `~a': ~a~%") + (error (G_ "cannot access `~a': ~a~%") path (strerror errno)) result) '() catalogue-dir stat)) diff --git a/glean/library/set-operations.scm b/glean/library/set-operations.scm index 6e72b95..f97184d 100644 --- a/glean/library/set-operations.scm +++ b/glean/library/set-operations.scm @@ -120,13 +120,13 @@ identified by DAG." ;; As DAG was matched after crossing 0 generations, the first entry will ;; carry information how to upgrade from DAG to current version. ((0 . utree) - (inform (_ "We have a simple upgrade scenario.~%")) + (inform (G_ "We have a simple upgrade scenario.~%")) (make-upgrade-map set `((old ,dag) (new ,new-dag)) 0 (expand-ancestry-tree utree htree))) ;; Complicated: we have to cross several generations, and must build a ;; composite upgrade tree. ((generations . utree) - (insist (_ "We have not implemented multi-generation upgrades yet.~%")) + (insist (G_ "We have not implemented multi-generation upgrades yet.~%")) (throw 'glean-fixme-error "DERIVE-UPGRADE-MAP: not supported.")) (otherwise (throw 'glean-logic-error diff --git a/glean/library/set-tools.scm b/glean/library/set-tools.scm index d28e6bd..cf927b4 100644 --- a/glean/library/set-tools.scm +++ b/glean/library/set-tools.scm @@ -76,7 +76,7 @@ already known disciplines need to be shifted to use a new structure." (string-join `(,(object->string lxp) ,(set-version set) ,(object->string (set-child-lexps set lxp))) "-")) - (_ (throw 'glean-type-error "SHALLOW-HASH: incorrect types" lxp set)))) + (G_ (throw 'glean-type-error "SHALLOW-HASH: incorrect types" lxp set)))) (define (deep-hash discipline) "Return the hash which is the result of recursively turning each element in diff --git a/glean/maker/engrave.scm b/glean/maker/engrave.scm index c83a2e0..7c6c7e4 100644 --- a/glean/maker/engrave.scm +++ b/glean/maker/engrave.scm @@ -80,7 +80,7 @@ (if print (with-output-to-port (current-output-port) (ancestry new old)) (with-output-to-file (cdr filenames) (ancestry new old)))) - (otherwise (report-error (_ "Engraving bombed! ~a.~%") otherwise))))) + (otherwise (report-error (G_ "Engraving bombed! ~a.~%") otherwise))))) (define (parse-input input) (match input @@ -95,11 +95,11 @@ file-name-separator-string %mkr-discipline%)) ((file-exists? total))) - (advice (_ "Engraving '~a'.~%") abs-input) + (advice (G_ "Engraving '~a'.~%") abs-input) (cons abs-input (string-append abs-input file-name-separator-string %mkr-ancestry%))) - (leave (_ "~a is not a directory, does not exist or does not + (leave (G_ "~a is not a directory, does not exist or does not contain a file named '~a'.~%") input %mkr-discipline%))) (#t (or (and-let* ((abs-input (getcwd)) @@ -107,12 +107,12 @@ contain a file named '~a'.~%") input %mkr-discipline%))) file-name-separator-string %mkr-discipline%)) ((file-exists? total))) - (advice (_ "Engraving '~a'.~%") + (advice (G_ "Engraving '~a'.~%") abs-input) (cons abs-input (string-append abs-input file-name-separator-string %mkr-ancestry%))) - (report-error (_ "The current directory does not contain a file + (report-error (G_ "The current directory does not contain a file named '~a'.~%") %mkr-discipline%))) (_ (error "ENGRAVE -- Unexpected INPUT" input)))) diff --git a/glean/maker/source.scm b/glean/maker/source.scm index 4968801..8b4c184 100644 --- a/glean/maker/source.scm +++ b/glean/maker/source.scm @@ -65,7 +65,7 @@ discipline named NAME." (define* (emit-error id #:optional (context #f)) (match id ('file-exists - (part-ways (_ "‘~a‘ already exists — not doing anything. + (part-ways (G_ "‘~a‘ already exists — not doing anything. Use `--force' if you want to overwrite it.\n") context)))) -- 2.39.1