[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
06/07: Add indications for no translations available in the lint warning
From: |
Christopher Baines |
Subject: |
06/07: Add indications for no translations available in the lint warnings page |
Date: |
Fri, 26 Jun 2020 12:55:13 -0400 (EDT) |
cbaines pushed a commit to branch master
in repository data-service.
commit bd3aa98620330f3312f091244ac842750adec4de
Author: Danjela Lura <danielaluraa@gmail.com>
AuthorDate: Wed Jun 24 14:52:45 2020 +0200
Add indications for no translations available in the lint warnings page
Signed-off-by: Christopher Baines <mail@cbaines.net>
---
guix-data-service/model/lint-warning.scm | 16 +++++++++++++++-
guix-data-service/web/revision/controller.scm | 5 ++++-
guix-data-service/web/revision/html.scm | 22 +++++++++++++++++++---
3 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/guix-data-service/model/lint-warning.scm
b/guix-data-service/model/lint-warning.scm
index 6371772..856f3e6 100644
--- a/guix-data-service/model/lint-warning.scm
+++ b/guix-data-service/model/lint-warning.scm
@@ -16,12 +16,16 @@
;;; <http://www.gnu.org/licenses/>.
(define-module (guix-data-service model lint-warning)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
#:use-module (squee)
#:use-module (guix-data-service model utils)
#:export (lint-warnings-data->lint-warning-ids
insert-guix-revision-lint-warnings
lint-warnings-for-guix-revision
- select-lint-warnings-by-revision-package-name-and-version))
+ select-lint-warnings-by-revision-package-name-and-version
+
+ any-translated-lint-warnings?))
(define (lint-warnings-data->lint-warning-ids
conn
@@ -206,3 +210,13 @@ WHERE packages.id IN (
(exec-query conn
query
(list commit-hash name version locale)))
+
+(define (any-translated-lint-warnings? lint-warnings-data locale)
+ (any
+ (match-lambda
+ ((lint-warnings-id lint-checker-name lint-checker-description
+ description-locale network-dependent package-name
+ packages-version file line column message
message-locale)
+ (or (string=? description-locale locale)
+ (string=? message-locale locale))))
+ lint-warnings-data))
diff --git a/guix-data-service/web/revision/controller.scm
b/guix-data-service/web/revision/controller.scm
index 2df5b99..5b6d1bf 100644
--- a/guix-data-service/web/revision/controller.scm
+++ b/guix-data-service/web/revision/controller.scm
@@ -1071,7 +1071,9 @@
#:locale locale
#:package-query package-query
#:linters linters
- #:message-query message-query)))
+ #:message-query message-query))
+ (any-translated-lint-warnings?
+ (any-translated-lint-warnings? lint-warnings locale)))
(case (most-appropriate-mime-type
'(application/json text/html)
mime-types)
@@ -1113,6 +1115,7 @@
git-repositories
lint-checker-options
lint-warnings-locale-options
+ any-translated-lint-warnings?
#:path-base path-base
#:header-text header-text
#:header-link header-link)
diff --git a/guix-data-service/web/revision/html.scm
b/guix-data-service/web/revision/html.scm
index a22c38e..c49624d 100644
--- a/guix-data-service/web/revision/html.scm
+++ b/guix-data-service/web/revision/html.scm
@@ -1848,6 +1848,7 @@ figure {
git-repositories
lint-checker-options
lint-warnings-locale-options
+ any-translated-lint-warnings?
#:key path-base
header-text header-link)
(define field-options
@@ -1886,7 +1887,10 @@ figure {
#:options lint-warnings-locale-options
#:allow-selecting-multiple-options #f
#:help-text
- "Language")
+ (if any-translated-lint-warnings?
+ "Language"
+ '((span (@ (class "text-danger"))
+ "No translations available in this page"))))
,(form-horizontal-control
"Package query" query-parameters
#:help-text
@@ -1961,10 +1965,22 @@ figure {
`((td (span (@ (style "font-family: monospace;
display: block;"))
,lint-checker-name)
(p (@ (style "font-size: small; margin: 6px 0
0px;"))
- ,lint-checker-description)))
+ ,lint-checker-description)
+ ,(if (string=? lint-checker-description-locale
+ (assq-ref query-parameters
'locale))
+ ""
+ '((span (@ (class "text-danger")
+ (style "font-size: small;
display: block;"))
+ "No translation available for lint
checker description.")))))
'())
,@(if (member "message" fields)
- `((td ,message))
+ `((td ,message
+ ,(if (string=? message-locale
+ (assq-ref query-parameters
'locale))
+ ""
+ '((span (@ (class "text-danger")
+ (style "font-size: small;
display: block;"))
+ "\nNo translation available for
lint warning message.")))))
'())
,@(if (member "location" fields)
`((td
- branch master updated (0b48254 -> f60c2ea), Christopher Baines, 2020/06/26
- 01/07: Include locale in the JSON response for the packages page, Christopher Baines, 2020/06/26
- 02/07: Embed the locale option in the URI of the package page, Christopher Baines, 2020/06/26
- 04/07: Include locale in search-packages-in-revision, Christopher Baines, 2020/06/26
- 05/07: Add locale values in the JSON response for the lint warnings page, Christopher Baines, 2020/06/26
- 06/07: Add indications for no translations available in the lint warnings page,
Christopher Baines <=
- 03/07: Add indications for no translations available in the packages page, Christopher Baines, 2020/06/26
- 07/07: Add the packages-translation-availability page, Christopher Baines, 2020/06/26