guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: ui: Change 'P_' to return the empty string when passed the empty


From: Ludovic Courtès
Subject: 01/01: ui: Change 'P_' to return the empty string when passed the empty string.
Date: Sun, 06 Sep 2015 13:52:11 +0000

civodul pushed a commit to branch master
in repository guix.

commit a5c0d8bc557affbcb58a4d2cb0059604e0cb89fa
Author: Ludovic Courtès <address@hidden>
Date:   Sun Sep 6 15:47:06 2015 +0200

    ui: Change 'P_' to return the empty string when passed the empty string.
    
    Reported by Mathieu Lirzin <address@hidden>
    at <https://lists.gnu.org/archive/html/guix-devel/2015-09/msg00111.html>.
    
    * guix/ui.scm (P_): Check whether MSGID is empty, and return it if it is.
---
 guix/ui.scm |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index 8de8e3c..2f75754 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -99,7 +99,15 @@
 
 (define _ (cut gettext <> %gettext-domain))
 (define N_ (cut ngettext <> <> <> %gettext-domain))
-(define P_ (cut gettext <> %package-text-domain))
+
+(define (P_ msgid)
+  "Return the translation of the package description or synopsis MSGID."
+  ;; Descriptions/synopses might occasionally be empty strings, even if that
+  ;; is something we try to avoid.  Since (gettext "") can return a non-empty
+  ;; string, explicitly check for that case.
+  (if (string-null? msgid)
+      msgid
+      (gettext msgid %package-text-domain)))
 
 (define-syntax-rule (define-diagnostic name prefix)
   "Create a diagnostic macro (i.e., NAME), which will prepend PREFIX to all



reply via email to

[Prev in Thread] Current Thread [Next in Thread]