aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix-data-service/model/package.scm12
-rw-r--r--guix-data-service/web/revision/controller.scm6
-rw-r--r--guix-data-service/web/revision/html.scm22
3 files changed, 34 insertions, 6 deletions
diff --git a/guix-data-service/model/package.scm b/guix-data-service/model/package.scm
index 643148d..43871ec 100644
--- a/guix-data-service/model/package.scm
+++ b/guix-data-service/model/package.scm
@@ -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))
diff --git a/guix-data-service/web/revision/controller.scm b/guix-data-service/web/revision/controller.scm
index e233fe7..a038e5c 100644
--- a/guix-data-service/web/revision/controller.scm
+++ b/guix-data-service/web/revision/controller.scm
@@ -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)
diff --git a/guix-data-service/web/revision/html.scm b/guix-data-service/web/revision/html.scm
index bc1aff7..cf34d5f 100644
--- a/guix-data-service/web/revision/html.scm
+++ b/guix-data-service/web/revision/html.scm
@@ -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))