diff options
author | Danjela lura <danielaluraa@gmail.com> | 2020-04-04 05:02:11 +0200 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-04-04 18:31:26 +0100 |
commit | e514471fc9a541089aa406a19cceec3479926fa1 (patch) | |
tree | 5d333df07d20d9eefbaa7361afcf7745c3c74389 /guix-data-service/web/revision | |
parent | a50bc3342faf3a994ba27e34d05306cc6d460738 (diff) | |
download | data-service-e514471fc9a541089aa406a19cceec3479926fa1.tar data-service-e514471fc9a541089aa406a19cceec3479926fa1.tar.gz |
Add option to change language of lint messages for the revision page
Signed-off-by: Christopher Baines <mail@cbaines.net>
Diffstat (limited to 'guix-data-service/web/revision')
-rw-r--r-- | guix-data-service/web/revision/controller.scm | 17 | ||||
-rw-r--r-- | guix-data-service/web/revision/html.scm | 7 |
2 files changed, 22 insertions, 2 deletions
diff --git a/guix-data-service/web/revision/controller.scm b/guix-data-service/web/revision/controller.scm index 57156a4..d925f14 100644 --- a/guix-data-service/web/revision/controller.scm +++ b/guix-data-service/web/revision/controller.scm @@ -43,6 +43,7 @@ #:use-module (guix-data-service model package-metadata) #:use-module (guix-data-service model lint-checker) #:use-module (guix-data-service model lint-warning) + #:use-module (guix-data-service model lint-warning-message) #:use-module (guix-data-service model guix-revision) #:use-module (guix-data-service model system-test) #:use-module (guix-data-service model nar) @@ -269,7 +270,8 @@ (let ((parsed-query-parameters (parse-query-parameters request - `((package_query ,identity) + `((locale ,identity #:default "en_US.utf8") + (package_query ,identity) (linter ,identity #:multi-value) (message_query ,identity) (field ,identity #:multi-value @@ -916,6 +918,13 @@ name))) (lint-checkers-for-revision conn commit-hash))) + (define lint-warnings-locale-options + (map + (match-lambda + ((locale) + locale)) + (lint-warning-message-locales-for-revision conn commit-hash))) + (if (any-invalid-query-parameters? query-parameters) (case (most-appropriate-mime-type '(application/json text/html) @@ -930,11 +939,13 @@ '() '() lint-checker-options + lint-warnings-locale-options #:path-base path-base #:header-text header-text #:header-link header-link)))) - (let* ((package-query (assq-ref query-parameters 'package_query)) + (let* ((locale (assq-ref query-parameters 'locale)) + (package-query (assq-ref query-parameters 'package_query)) (linters (assq-ref query-parameters 'linter)) (message-query (assq-ref query-parameters 'message_query)) (fields (assq-ref query-parameters 'field)) @@ -943,6 +954,7 @@ commit-hash)) (lint-warnings (lint-warnings-for-guix-revision conn commit-hash + #:locale locale #:package-query package-query #:linters linters #:message-query message-query))) @@ -980,6 +992,7 @@ lint-warnings git-repositories lint-checker-options + lint-warnings-locale-options #: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 b03d59e..9cc8d30 100644 --- a/guix-data-service/web/revision/html.scm +++ b/guix-data-service/web/revision/html.scm @@ -1454,6 +1454,7 @@ figure { lint-warnings git-repositories lint-checker-options + lint-warnings-locale-options #:key path-base header-text header-link) (define field-options @@ -1488,6 +1489,12 @@ figure { (style "padding-bottom: 0") (class "form-horizontal")) ,(form-horizontal-control + "Locale" query-parameters + #:options lint-warnings-locale-options + #:allow-selecting-multiple-options #f + #:help-text + "Language") + ,(form-horizontal-control "Package query" query-parameters #:help-text "Lint warnings where the package name matches the query.") |