Add language selector dropdown

Squashed commit of the following:

commit ba58528214
Author: HackerNCoder <hackerncoder@encryptionin.space>
Date:   Sun Oct 30 19:53:42 2022 +0100

    fixup! Finish lang selector

commit dcfddda5c5
Author: HackerNCoder <hackerncoder@encryptionin.space>
Date:   Sun Oct 30 19:41:32 2022 +0100

    fix dropdown-toggle css

commit 1803c12658
Author: HackerNCoder <hackerncoder@encryptionin.space>
Date:   Sun Oct 30 19:39:25 2022 +0100

    Finish lang selector

commit ec774b7a52
Author: HackerNCoder <hackerncoder@encryptionin.space>
Date:   Sun Oct 30 19:34:19 2022 +0100

    Attempt to add missing langs

commit d1a779749d
Author: HackerNCoder <hackerncoder@encryptionin.space>
Date:   Sun Oct 30 19:05:31 2022 +0100

    testing

commit 2cb2610d24
Author: HackerNCoder <hackerncoder@encryptionin.space>
Date:   Sun Oct 30 19:01:18 2022 +0100

    Revert "testing"

    This reverts commit 7201ebbf5f.

commit 7201ebbf5f
Author: HackerNCoder <hackerncoder@encryptionin.space>
Date:   Sun Oct 30 18:59:23 2022 +0100

    testing

commit d9b29adf6b
Author: HackerNCoder <hackerncoder@encryptionin.space>
Date:   Sun Oct 30 18:53:46 2022 +0100

    testing

commit e3a2634048
Author: HackerNCoder <hackerncoder@encryptionin.space>
Date:   Sun Oct 30 18:52:29 2022 +0100

    fix test

commit 1227a793cd
Author: HackerNCoder <hackerncoder@encryptionin.space>
Date:   Sun Oct 30 18:51:24 2022 +0100

    testing

commit 510e7d80c6
Author: HackerNCoder <hackerncoder@encryptionin.space>
Date:   Sun Oct 30 18:37:07 2022 +0100

    Attempt to add language selector
This commit is contained in:
HackerNCoder 2022-10-30 19:54:09 +01:00
parent 5ccab6f646
commit b8ec7f9680
6 changed files with 211 additions and 5 deletions

View file

@ -11717,3 +11717,125 @@ body {
width: 400px; width: 400px;
margin-left: -100px; 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;
}

View file

@ -1,5 +1,5 @@
content = en content = en
translations = fr,pl,id translations = de,es,es_419,fr,id,pl,pt,pt_BR,ru
i18npath = i18n i18npath = i18n
translate_paragraphwise = False translate_paragraphwise = False
url_prefix = https://queerscriptors.org/ url_prefix = https://queerscriptors.org/

39
databags/alternatives.ini Normal file
View file

@ -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/

View file

@ -5,5 +5,6 @@
{{ _("Menu") }} {{ _("Menu") }}
<i class="fas fa-bars"></i> <i class="fas fa-bars"></i>
</button> #} </button> #}
{% include 'lang-selector.html' %}
</div> </div>
</nav> </nav>

View file

@ -0,0 +1,13 @@
{% set alts = bag('alternatives').items() %}
<div class="btn-group dropdown pull-right">
<button type="button" class="btn dropdown-toggle btn-block my-3 my-sm-0" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ bag('alternatives', this.alt, 'language') }}
</button>
<div class="dropdown-menu">
{% for id, item in bag('alternatives').items() %}
{% if this.alt != id %}
<a class="dropdown-item" href="{{ this.path|url(alt=id) }}">{{ item.language }}</a>
{% endif %}
{% endfor %}
</div>
</div>

View file

@ -10,17 +10,48 @@ primary = yes
url_prefix = / url_prefix = /
locale = en 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] [alternatives.fr]
name = French name = French
url_prefix = /fr/ url_prefix = /fr/
locale = fr locale = fr
[alternatives.id]
name = Indonesian
url_prefix = /id/
locale = id
[alternatives.pl] [alternatives.pl]
name = Polish name = Polish
url_prefix = /pl/ url_prefix = /pl/
locale = pl locale = pl
[alternatives.id] [alternatives.pt]
name = Indonesian name = Portuguese
url_prefix = /id/ url_prefix = /pt/
locale = id locale = pt
[alternatives.pt_BR]
name = Portuguese Brazil
url_prefix = /pt_BR/
locale = pt_BR
[alternatives.ru]
name = Russian
url_prefix = /ru/
locale = ru