[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
09/09: website: Add language selection dropdown to navbar.
From: |
Florian Pelz |
Subject: |
09/09: website: Add language selection dropdown to navbar. |
Date: |
Fri, 10 Jul 2020 14:38:01 -0400 (EDT) |
pelzflorian pushed a commit to branch wip-i18n
in repository guix-artwork.
commit 2e67128835404a486ab872df2f0298ffcc4087b3
Author: Florian Pelz <pelzflorian@pelzflorian.de>
AuthorDate: Wed Oct 30 12:12:23 2019 +0000
website: Add language selection dropdown to navbar.
* website/apps/base/templates/components.scm (navbar): Add it.
(horizontal-skip): New procedure.
* website/static/base/css/navbar.css: Add CSS for horizontal-skip.
Increase size at which website switches to mobile mode.
---
website/apps/base/templates/components.scm | 30 +++++++++++++++++++++++++++---
website/static/base/css/navbar.css | 6 +++++-
2 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/website/apps/base/templates/components.scm
b/website/apps/base/templates/components.scm
index f8e7214..404d59f 100644
--- a/website/apps/base/templates/components.scm
+++ b/website/apps/base/templates/components.scm
@@ -23,6 +23,7 @@
contact->shtml
horizontal-line
horizontal-separator
+ horizontal-skip
link-more
link-subtle
link-yellow
@@ -180,6 +181,10 @@
`(src ,(guix-url "static/base/img/h-separator-dark.png")))
(alt ""))))
+(define (horizontal-skip)
+ "Return SHTML for a small horizontal space."
+ `(span (@ (class "hskip"))))
+
(define (horizontal-line)
"Return SHTML for a visible separator to be used in a dropdown menu
like a menu item."
@@ -420,13 +425,32 @@ manual.
(C_ "website menu" (menu-item #:label "Contact" #:active-item
active-item #:url (guix-url "contact/")))
(C_ "website menu" (menu-item #:label "Contribute" #:active-item
active-item #:url (guix-url "contribute/")))
(C_ "website menu" (menu-item #:label "Security" #:active-item
active-item #:url (guix-url "security/")))
- (C_ "website menu" (menu-item #:label "Graphics" #:active-item
active-item #:url (guix-url "graphics/")))))))
+ (C_ "website menu" (menu-item #:label "Graphics" #:active-item
active-item #:url (guix-url "graphics/")))))
+ ,(horizontal-skip)
+ ;; Languages dropdown.
+ ,(menu-dropdown #:label (locale-display-name) #:active-item active-item
+ #:items
+ (map-in-order
+ (lambda (ietf-info)
+ (let ((lingua (car ietf-info))
+ (code (cdr ietf-info)))
+ (setlocale LC_ALL (string-append lingua ".utf8"))
+ (let ((out (menu-item #:label (locale-display-name)
+ #:active-item active-item
+ #:url (guix-url (string-append code "/")
+ #:localize #f))))
+ (setlocale LC_ALL "")
+ out)))
+ (sort (delete %current-lingua
+ ietf-tags-file-contents
+ (lambda (a b) (string=? a (car b))))
+ (lambda (a b) string<?))))))
+
;; Menu button.
(a
(@ (class "menu-btn")
- (href ,(guix-url "menu/"))) "")))
-
+ (href ,(guix-url "menu/"))) "")))
(define (page-indicator page-number total-pages)
"Return an SHTML span element in the form 'page X of Y' if there is
diff --git a/website/static/base/css/navbar.css
b/website/static/base/css/navbar.css
index b8bba8a..2274aa1 100644
--- a/website/static/base/css/navbar.css
+++ b/website/static/base/css/navbar.css
@@ -109,6 +109,10 @@ label.menu-item {
background-position: top;
}
+.hskip {
+ padding-left: 10px;
+}
+
.hline {
display: none;
}
@@ -116,7 +120,7 @@ label.menu-item {
-@media screen and (min-width: 900px) {
+@media screen and (min-width: 920px) {
.navbar {
position: relative;
overflow: visible;
- branch wip-i18n created (now 2e67128), Florian Pelz, 2020/07/10
- 01/09: website: Fix building with GUIX_WEB_SITE_ROOT_PATH., Florian Pelz, 2020/07/10
- 02/09: website: Handle GUIX_WEB_SITE_ROOT_PATH not ending in a slash., Florian Pelz, 2020/07/10
- 03/09: website: Refactor GUIX_WEB_SITE_ROOT_PATH handling., Florian Pelz, 2020/07/10
- 04/09: website: Add custom xgettext to extract from nested sexps for i18n., Florian Pelz, 2020/07/10
- 06/09: website: media: Do not localize video page URLs., Florian Pelz, 2020/07/10
- 09/09: website: Add language selection dropdown to navbar.,
Florian Pelz <=
- 07/09: website: nls: Add German translation., Florian Pelz, 2020/07/10
- 05/09: website: apps: Mark all files for translation., Florian Pelz, 2020/07/10
- 08/09: website: navbar: Make dropdowns accessible to keyboard and touch input., Florian Pelz, 2020/07/10