From b8ec7f9680f2c58fb6269136c1e52292ee425776 Mon Sep 17 00:00:00 2001 From: HackerNCoder Date: Sun, 30 Oct 2022 19:54:09 +0100 Subject: [PATCH] Add language selector dropdown Squashed commit of the following: commit ba585282145d47ba231006835253bac5b16b825f Author: HackerNCoder Date: Sun Oct 30 19:53:42 2022 +0100 fixup! Finish lang selector commit dcfddda5c52e61acc31767e3c1ba580f15ae1bba Author: HackerNCoder Date: Sun Oct 30 19:41:32 2022 +0100 fix dropdown-toggle css commit 1803c12658c61c6fbdbcfc9e0b1d5c21cb9574cf Author: HackerNCoder Date: Sun Oct 30 19:39:25 2022 +0100 Finish lang selector commit ec774b7a5250484112aa1f9fd87ed725c5eda5cd Author: HackerNCoder Date: Sun Oct 30 19:34:19 2022 +0100 Attempt to add missing langs commit d1a779749d45be01d221e08cad7c1077c1a3ba83 Author: HackerNCoder Date: Sun Oct 30 19:05:31 2022 +0100 testing commit 2cb2610d245d9fbd3f472d6b637fc444515ea0e7 Author: HackerNCoder Date: Sun Oct 30 19:01:18 2022 +0100 Revert "testing" This reverts commit 7201ebbf5f8106ac91183db96b86caa540b137d4. commit 7201ebbf5f8106ac91183db96b86caa540b137d4 Author: HackerNCoder Date: Sun Oct 30 18:59:23 2022 +0100 testing commit d9b29adf6b29efe8aecfece2db34967a609457b2 Author: HackerNCoder Date: Sun Oct 30 18:53:46 2022 +0100 testing commit e3a263404873eb5b278430b5163ba7f43d2d9df7 Author: HackerNCoder Date: Sun Oct 30 18:52:29 2022 +0100 fix test commit 1227a793cde105376e0aeb26bb4a2c2ab9284d7d Author: HackerNCoder Date: Sun Oct 30 18:51:24 2022 +0100 testing commit 510e7d80c65a07ecc5f38462e8cd52fcee7a714f Author: HackerNCoder Date: Sun Oct 30 18:37:07 2022 +0100 Attempt to add language selector --- assets/css/styles.css | 122 +++++++++++++++++++++++++++++++++++ configs/i18n.ini | 2 +- databags/alternatives.ini | 39 +++++++++++ templates/header.html | 1 + templates/lang-selector.html | 13 ++++ website.lektorproject | 39 +++++++++-- 6 files changed, 211 insertions(+), 5 deletions(-) create mode 100644 databags/alternatives.ini create mode 100644 templates/lang-selector.html diff --git a/assets/css/styles.css b/assets/css/styles.css index b50d2db..4c7431f 100644 --- a/assets/css/styles.css +++ b/assets/css/styles.css @@ -11717,3 +11717,125 @@ body { width: 400px; margin-left: -100px; } + +.dropdown { + position: relative; +} + +.dropdown-toggle { + padding: 0.375rem 0.75rem; + background-color: white; + color: black; + box-shadow: none !important; +} +.dropdown-toggle::after { + display: inline-block; + width: 0; + height: 0; + margin-left: 0.255em; + vertical-align: 0.255em; + content: ""; + border-top: 0.3em solid; + border-right: 0.3em solid transparent; + border-bottom: 0; + border-left: 0.3em solid transparent; +} +.dropdown-toggle:empty::after { + margin-left: 0; +} +.dropdown-toggle:hover { + border-color: black; +} + +.dropdown-menu { + position: absolute; + top: 100%; + left: 0; + z-index: 1030; + display: none; + float: left; + min-width: 10rem; + padding: 0.5rem 0; + margin: 0 0 0; + font-size: 1rem; + color: #212529; + text-align: left; + list-style: none; + background-color: #FFFFFF; + background-clip: padding-box; + border: 1px solid rgba(0, 0, 0, 0.15); + border-radius: 0.25rem; +} + +.dropup .dropdown-menu { + margin-top: 0; + margin-bottom: 0.125rem; +} +.dropup .dropdown-toggle::after { + display: inline-block; + width: 0; + height: 0; + margin-left: 0.255em; + vertical-align: 0.255em; + content: ""; + border-top: 0; + border-right: 0.3em solid transparent; + border-bottom: 0.3em solid; + border-left: 0.3em solid transparent; +} +.dropup .dropdown-toggle:empty::after { + margin-left: 0; +} + +.dropdown-divider { + height: 0; + margin: 0.5rem 0; + overflow: hidden; + border-top: 1px solid #e9ecef; +} + +.dropdown-item { + display: block; + width: 100%; + padding: 0.25rem 1.5rem; + clear: both; + font-weight: 400; + color: #212529; + text-align: inherit; + white-space: nowrap; + background: none; + border: 0; +} +.dropdown-item:focus, .dropdown-item:hover { + color: #16181b; + text-decoration: none; + background-color: #F8F9FA; +} +.dropdown-item.active, .dropdown-item:active { + color: #FFFFFF; + text-decoration: none; + background-color: #7D4698; +} +.dropdown-item.disabled, .dropdown-item:disabled { + color: #848E97; + background-color: transparent; +} + +.dropdown-menu.show { + display: block; +} + +.dropdown-header { + display: block; + padding: 0.5rem 1.5rem; + margin-bottom: 0; + font-size: 0.875rem; + color: #848E97; + white-space: nowrap; +} + +.dropdown:hover .dropdown-menu { + display: block; + overflow-y: scroll; + max-height: 350px; +} diff --git a/configs/i18n.ini b/configs/i18n.ini index 8fc6742..048dd5c 100644 --- a/configs/i18n.ini +++ b/configs/i18n.ini @@ -1,5 +1,5 @@ content = en -translations = fr,pl,id +translations = de,es,es_419,fr,id,pl,pt,pt_BR,ru i18npath = i18n translate_paragraphwise = False url_prefix = https://queerscriptors.org/ diff --git a/databags/alternatives.ini b/databags/alternatives.ini new file mode 100644 index 0000000..0d02a0f --- /dev/null +++ b/databags/alternatives.ini @@ -0,0 +1,39 @@ +[en] +url = / +language = English (en) + +[de] +url = /de/ +language = Deutsch (de) + +[es] +url = /es/ +language = Español (es) + +[es_419] +url = /es_419/ +language = Español de América (es_419) + +[fr] +language = Français (fr) +url = /fr/ + +[id] +language = Bahasa Indonesia (id) +url = /id/ + +[pl] +language = Polski (pl) +url = /pl/ + +[pt] +language = Português (pt) +url = /pt/ + +[pt-BR] +language = Português Brasil (pt_BR) +url = /pt_BR/ + +[ru] +language = Русский (ru) +url = /ru/ diff --git a/templates/header.html b/templates/header.html index f6e7026..3304ef5 100644 --- a/templates/header.html +++ b/templates/header.html @@ -5,5 +5,6 @@ {{ _("Menu") }} #} + {% include 'lang-selector.html' %} diff --git a/templates/lang-selector.html b/templates/lang-selector.html new file mode 100644 index 0000000..82edd02 --- /dev/null +++ b/templates/lang-selector.html @@ -0,0 +1,13 @@ +{% set alts = bag('alternatives').items() %} + diff --git a/website.lektorproject b/website.lektorproject index 5468505..3ed24d7 100644 --- a/website.lektorproject +++ b/website.lektorproject @@ -10,17 +10,48 @@ primary = yes url_prefix = / locale = en +[alternatives.de] +name = German +url_prefix = /de/ +locale = de + +[alternatives.es] +name = Spanish +url_prefix = /es/ +locale = es + +[alternatives.es_419] +name = LatAmSpanish +url_prefix = /es_419/ +locale = es_419 + [alternatives.fr] name = French url_prefix = /fr/ locale = fr +[alternatives.id] +name = Indonesian +url_prefix = /id/ +locale = id + [alternatives.pl] name = Polish url_prefix = /pl/ locale = pl -[alternatives.id] -name = Indonesian -url_prefix = /id/ -locale = id +[alternatives.pt] +name = Portuguese +url_prefix = /pt/ +locale = pt + +[alternatives.pt_BR] +name = Portuguese Brazil +url_prefix = /pt_BR/ +locale = pt_BR + +[alternatives.ru] +name = Russian +url_prefix = /ru/ +locale = ru +