Add indications for no translations available in the lint warnings page
Signed-off-by: Christopher Baines <mail@cbaines.net>
This commit is contained in:
parent
d442d408ee
commit
bd3aa98620
3 changed files with 38 additions and 5 deletions
|
|
@ -16,12 +16,16 @@
|
||||||
;;; <http://www.gnu.org/licenses/>.
|
;;; <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
(define-module (guix-data-service model lint-warning)
|
(define-module (guix-data-service model lint-warning)
|
||||||
|
#:use-module (ice-9 match)
|
||||||
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (squee)
|
#:use-module (squee)
|
||||||
#:use-module (guix-data-service model utils)
|
#:use-module (guix-data-service model utils)
|
||||||
#:export (lint-warnings-data->lint-warning-ids
|
#:export (lint-warnings-data->lint-warning-ids
|
||||||
insert-guix-revision-lint-warnings
|
insert-guix-revision-lint-warnings
|
||||||
lint-warnings-for-guix-revision
|
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
|
(define (lint-warnings-data->lint-warning-ids
|
||||||
conn
|
conn
|
||||||
|
|
@ -206,3 +210,13 @@ WHERE packages.id IN (
|
||||||
(exec-query conn
|
(exec-query conn
|
||||||
query
|
query
|
||||||
(list commit-hash name version locale)))
|
(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))
|
||||||
|
|
|
||||||
|
|
@ -1071,7 +1071,9 @@
|
||||||
#:locale locale
|
#:locale locale
|
||||||
#:package-query package-query
|
#:package-query package-query
|
||||||
#:linters linters
|
#: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
|
(case (most-appropriate-mime-type
|
||||||
'(application/json text/html)
|
'(application/json text/html)
|
||||||
mime-types)
|
mime-types)
|
||||||
|
|
@ -1113,6 +1115,7 @@
|
||||||
git-repositories
|
git-repositories
|
||||||
lint-checker-options
|
lint-checker-options
|
||||||
lint-warnings-locale-options
|
lint-warnings-locale-options
|
||||||
|
any-translated-lint-warnings?
|
||||||
#:path-base path-base
|
#:path-base path-base
|
||||||
#:header-text header-text
|
#:header-text header-text
|
||||||
#:header-link header-link)
|
#:header-link header-link)
|
||||||
|
|
|
||||||
|
|
@ -1848,6 +1848,7 @@ figure {
|
||||||
git-repositories
|
git-repositories
|
||||||
lint-checker-options
|
lint-checker-options
|
||||||
lint-warnings-locale-options
|
lint-warnings-locale-options
|
||||||
|
any-translated-lint-warnings?
|
||||||
#:key path-base
|
#:key path-base
|
||||||
header-text header-link)
|
header-text header-link)
|
||||||
(define field-options
|
(define field-options
|
||||||
|
|
@ -1886,7 +1887,10 @@ figure {
|
||||||
#:options lint-warnings-locale-options
|
#:options lint-warnings-locale-options
|
||||||
#:allow-selecting-multiple-options #f
|
#:allow-selecting-multiple-options #f
|
||||||
#:help-text
|
#:help-text
|
||||||
"Language")
|
(if any-translated-lint-warnings?
|
||||||
|
"Language"
|
||||||
|
'((span (@ (class "text-danger"))
|
||||||
|
"No translations available in this page"))))
|
||||||
,(form-horizontal-control
|
,(form-horizontal-control
|
||||||
"Package query" query-parameters
|
"Package query" query-parameters
|
||||||
#:help-text
|
#:help-text
|
||||||
|
|
@ -1961,10 +1965,22 @@ figure {
|
||||||
`((td (span (@ (style "font-family: monospace; display: block;"))
|
`((td (span (@ (style "font-family: monospace; display: block;"))
|
||||||
,lint-checker-name)
|
,lint-checker-name)
|
||||||
(p (@ (style "font-size: small; margin: 6px 0 0px;"))
|
(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)
|
,@(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)
|
,@(if (member "location" fields)
|
||||||
`((td
|
`((td
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue