[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/09: ui: Fix i18n for diagnostic messages.
From: |
guix-commits |
Subject: |
05/09: ui: Fix i18n for diagnostic messages. |
Date: |
Wed, 10 Apr 2019 06:41:10 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 32813e8440ff15c9389b84b1d7450fe1d3d25bb2
Author: Ludovic Courtès <address@hidden>
Date: Tue Apr 9 23:06:38 2019 +0200
ui: Fix i18n for diagnostic messages.
Until now, we'd pass 'gettext' the "augmented" format string, which
'gettext' would not find in message catalogs. Now we pass it FMT as is,
which is what catalogs contain.
* guix/ui.scm (define-diagnostic)[augmented-format-string]: Remove.
Emit one 'format' call to print the prefix, and a second one to print
the actual message.
---
guix/ui.scm | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/guix/ui.scm b/guix/ui.scm
index c2807b7..c57d206 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -129,28 +129,24 @@
messages."
(define-syntax name
(lambda (x)
- (define (augmented-format-string fmt)
- (string-append "~:[~*~;guix ~a: ~]~a" (syntax->datum fmt)))
-
(syntax-case x ()
((name (underscore fmt) args (... ...))
(and (string? (syntax->datum #'fmt))
(free-identifier=? #'underscore #'G_))
- (with-syntax ((fmt* (augmented-format-string #'fmt))
- (prefix (datum->syntax x prefix)))
- #'(format (guix-warning-port) (gettext fmt*)
- (program-name) (program-name) prefix
+ #'(begin
+ (format (guix-warning-port) "~:[~*~;guix ~a: ~]~a"
+ (program-name) (program-name) prefix)
+ (format (guix-warning-port) (gettext fmt)
args (... ...))))
((name (N-underscore singular plural n) args (... ...))
(and (string? (syntax->datum #'singular))
(string? (syntax->datum #'plural))
(free-identifier=? #'N-underscore #'N_))
- (with-syntax ((s (augmented-format-string #'singular))
- (p (augmented-format-string #'plural))
- (prefix (datum->syntax x prefix)))
- #'(format (guix-warning-port)
- (ngettext s p n %gettext-domain)
- (program-name) (program-name) prefix
+ #'(begin
+ (format (guix-warning-port) "~:[~*~;guix ~a: ~]~a"
+ (program-name) (program-name) prefix)
+ (format (guix-warning-port)
+ (ngettext singular plural n %gettext-domain)
args (... ...))))))))
(define-diagnostic warning "warning: ") ; emit a warning
- branch master updated (6b11da7 -> 9e1e046), guix-commits, 2019/04/10
- 01/09: guix package: Use absolute file names in search path recommendations., guix-commits, 2019/04/10
- 02/09: doc: Adjust desktop instructions for GDM., guix-commits, 2019/04/10
- 05/09: ui: Fix i18n for diagnostic messages.,
guix-commits <=
- 09/09: ui: Colorize diagnostics., guix-commits, 2019/04/10
- 08/09: ui: Diagnostic procedures can display error location., guix-commits, 2019/04/10
- 04/09: Add (guix colors)., guix-commits, 2019/04/10
- 06/09: ui: Make diagnostic message prefix translatable., guix-commits, 2019/04/10
- 03/09: store: 'with-store' expands to a single procedure call., guix-commits, 2019/04/10
- 07/09: ui: Factorize 'print-diagnostic-prefix'., guix-commits, 2019/04/10