Add indications for no translations available in the packages page
Signed-off-by: Christopher Baines <mail@cbaines.net>
This commit is contained in:
parent
7d85372acc
commit
f16fdb44f1
|
@ -32,7 +32,9 @@
|
|||
select-package-versions-for-revision
|
||||
package-versions-for-branch
|
||||
package-derivations-for-branch
|
||||
package-outputs-for-branch))
|
||||
package-outputs-for-branch
|
||||
|
||||
any-package-synopsis-or-descriptions-translations?))
|
||||
|
||||
(define (select-existing-package-entries package-entries)
|
||||
(string-append "SELECT id, packages.name, packages.version, "
|
||||
|
@ -530,3 +532,11 @@ ORDER BY first_datetime DESC, package_version DESC")
|
|||
output-name
|
||||
system
|
||||
target))))
|
||||
|
||||
(define (any-package-synopsis-or-descriptions-translations? packages locale)
|
||||
(any
|
||||
(match-lambda
|
||||
((name version synopsis synopsis-locale description description-locale _ _ _ _ _)
|
||||
(or (string=? synopsis-locale locale)
|
||||
(string=? description-locale locale))))
|
||||
packages))
|
||||
|
|
|
@ -568,6 +568,7 @@
|
|||
(limit-results (or (assq-ref query-parameters 'limit_results)
|
||||
99999)) ; TODO There shouldn't be a limit
|
||||
(fields (assq-ref query-parameters 'field))
|
||||
(locale (assq-ref query-parameters 'locale))
|
||||
(packages
|
||||
(if search-query
|
||||
(search-packages-in-revision
|
||||
|
@ -587,7 +588,9 @@
|
|||
(show-next-page?
|
||||
(and (not search-query)
|
||||
(>= (length packages)
|
||||
limit-results))))
|
||||
limit-results)))
|
||||
(any-translations? (any-package-synopsis-or-descriptions-translations?
|
||||
packages locale)))
|
||||
(case (most-appropriate-mime-type
|
||||
'(application/json text/html)
|
||||
mime-types)
|
||||
|
@ -638,6 +641,7 @@
|
|||
git-repositories
|
||||
show-next-page?
|
||||
description-and-synopsis-locale-options
|
||||
any-translations?
|
||||
#:path-base path-base
|
||||
#:header-text header-text
|
||||
#:header-link header-link)
|
||||
|
|
|
@ -532,6 +532,7 @@
|
|||
git-repositories
|
||||
show-next-page?
|
||||
locale-options
|
||||
any-translations-available?
|
||||
#:key path-base
|
||||
header-text header-link)
|
||||
(define field-options
|
||||
|
@ -571,7 +572,10 @@
|
|||
#:options locale-options
|
||||
#:allow-selecting-multiple-options #f
|
||||
#:help-text
|
||||
"Language.")
|
||||
(if any-translations-available?
|
||||
"Language."
|
||||
'((span (@ (class "text-danger"))
|
||||
"No translations available in this page."))))
|
||||
,(form-horizontal-control
|
||||
"Search query" query-parameters
|
||||
#:help-text
|
||||
|
@ -632,7 +636,7 @@
|
|||
,@(let ((fields (assq-ref query-parameters 'field)))
|
||||
(map
|
||||
(match-lambda
|
||||
((name version synopsis _ description _ home-page
|
||||
((name version synopsis synopsis-locale description description-locale home-page
|
||||
location-file location-line
|
||||
location-column-number licenses)
|
||||
`(tr
|
||||
|
@ -641,10 +645,20 @@
|
|||
`((td ,version))
|
||||
'())
|
||||
,(if (member "synopsis" fields)
|
||||
`((td ,(stexi->shtml (texi-fragment->stexi synopsis))))
|
||||
`((td ,(stexi->shtml (texi-fragment->stexi synopsis))
|
||||
,(if (string=? synopsis-locale
|
||||
(assq-ref query-parameters 'locale))
|
||||
""
|
||||
'((span (@ (class "text-danger"))
|
||||
"No translation available for synopsis.")))))
|
||||
'())
|
||||
,(if (member "description" fields)
|
||||
`((td ,(stexi->shtml (texi-fragment->stexi description))))
|
||||
`((td ,(stexi->shtml (texi-fragment->stexi description))
|
||||
,(if (string=? description-locale
|
||||
(assq-ref query-parameters 'locale))
|
||||
""
|
||||
'((span (@ (class "text-danger"))
|
||||
"No translation available for description.")))))
|
||||
'())
|
||||
,(if (member "home-page" fields)
|
||||
`((td ,home-page))
|
||||
|
|
Loading…
Reference in New Issue