Skip to content
1 change: 1 addition & 0 deletions .codespell-ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,6 @@ doubleclick

# German glossary label
Referenz
passt
pre-selected
jus
9 changes: 7 additions & 2 deletions assets/js/doors/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ if (termFilter && termGrid) {
const clearTerms = document.createElement('button');
clearTerms.type = 'button';
clearTerms.className = 'term-filter-clear';
clearTerms.textContent = 'Clear';
clearTerms.textContent = termFilter.dataset.clear || 'Clear';
clearTerms.hidden = true;
termFilter.after(status, clearTerms);
clearTerms.addEventListener('click', () => { termFilter.value = ''; termFilter.dispatchEvent(new Event('input')); termFilter.focus(); });
Expand All @@ -920,7 +920,12 @@ if (termFilter && termGrid) {
// data-term holds the term's name and its other names.
terms.forEach((term) => { term.hidden = !foldTerm(term.dataset.term || term.textContent).includes(query); });
const shown = terms.filter((term) => !term.hidden).length;
status.textContent = !query ? '' : shown ? `${shown} ${shown === 1 ? 'term' : 'terms'}` : 'No matching terms.';
// The page language's plural category picks the wording: Arabic has forms for 1, 2, 3–10, 11–99 and 100 and more.
const words = termFilter.dataset;
const category = new Intl.PluralRules(termFilter.closest('[lang]')?.lang || 'en').select(shown);
const wording = {one: words.single, two: words.two, few: words.few, many: words.many, other: words.other}[category]
|| (shown === 1 ? words.single : words.many) || '%d terms';
status.textContent = !query ? '' : shown ? wording.replace('%d', shown) : words.none || 'No matching terms.';
clearTerms.hidden = !query;
});
// On a phone the list moves up, into a disclosure right after the definition, keeping the same label as desktop.
Expand Down
17 changes: 9 additions & 8 deletions layouts/glossary/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
site.js filters the terms as the search is typed. */}}
{{ $lang := .Params.language | default "english" }}
{{ $labels := dict
"english" (dict "view" "View" "cards" "Cards" "list" "List" "language" "Language" "clear" "Clear" "lede" "Community-written definitions of open scholarship terms, described in Nature Human Behaviour (Parsons et al., 2022). [How to cite the glossary](#about-the-glossary)." "search" "Search %d terms" "placeholder" "Type a term, e.g. replication" "about" "About the glossary project" "letters" "Terms by letter" "none" "No term matches.")
"german" (dict "view" "Ansicht" "cards" "Karten" "list" "Liste" "language" "Sprache" "clear" "Löschen" "search" "%d Begriffe durchsuchen" "placeholder" "Begriff eingeben, z. B. Replikation" "about" "Über das Glossar und wie man es zitiert" "letters" "Begriffe nach Buchstaben" "none" "Kein Begriff passt.")
"arabic" (dict "view" "العرض" "cards" "بطاقات" "list" "قائمة" "language" "اللغة" "clear" "مسح" "search" "ابحث في %d مصطلحًا" "placeholder" "اكتب مصطلحًا" "about" "عن المسرد وكيفية الاستشهاد به" "letters" "المصطلحات حسب الحرف" "updated" "آخر تحديث:" "none" "لا يوجد مصطلح مطابق.")
"turkish" (dict "view" "Görünüm" "cards" "Kartlar" "list" "Liste" "language" "Dil" "clear" "Temizle" "search" "%d terimde ara" "placeholder" "Bir terim yazın" "about" "Sözlük hakkında ve nasıl atıf yapılır" "letters" "Harfe göre terimler" "none" "Eşleşen terim yok.")
"chinese" (dict "view" "显示方式" "cards" "卡片" "list" "列表" "language" "语言" "clear" "清除" "search" "搜索 %d 个术语" "placeholder" "输入术语" "about" "关于本术语表及引用方式" "letters" "按字母排列的术语" "none" "没有匹配的术语。") }}
"english" (dict "view" "View" "cards" "Cards" "list" "List" "language" "Language" "clear" "Clear" "lede" "Community-written definitions of open scholarship terms, described in Nature Human Behaviour (Parsons et al., 2022). [How to cite the glossary](#about-the-glossary)." "search" "Search %d terms" "placeholder" "Type a term, e.g. replication" "about" "About the glossary project" "letters" "Terms by letter" "none" "No term matches." "count" "%s of %s terms")
"german" (dict "view" "Ansicht" "cards" "Karten" "list" "Liste" "language" "Sprache" "clear" "Löschen" "search" "%d Begriffe durchsuchen" "placeholder" "Begriff eingeben, z. B. Replikation" "about" "Über das Glossar und wie man es zitiert" "letters" "Begriffe nach Buchstaben" "none" "Kein Begriff passt." "count" "%s von %s Begriffen")
"arabic" (dict "view" "العرض" "cards" "بطاقات" "list" "قائمة" "language" "اللغة" "clear" "مسح" "search" "ابحث في %d مصطلحًا" "placeholder" "اكتب مصطلحًا" "about" "عن المسرد وكيفية الاستشهاد به" "letters" "المصطلحات حسب الحرف" "updated" "آخر تحديث:" "none" "لا يوجد مصطلح مطابق." "title" "المسرد" "home" "الرئيسية" "breadcrumb" "مسار التنقل" "count" "%s من %s مصطلحًا")
"turkish" (dict "view" "Görünüm" "cards" "Kartlar" "list" "Liste" "language" "Dil" "clear" "Temizle" "search" "%d terimde ara" "placeholder" "Bir terim yazın" "about" "Sözlük hakkında ve nasıl atıf yapılır" "letters" "Harfe göre terimler" "none" "Eşleşen terim yok." "count" "%s / %s terim")
"chinese" (dict "view" "显示方式" "cards" "卡片" "list" "列表" "language" "语言" "clear" "清除" "search" "搜索 %d 个术语" "placeholder" "输入术语" "about" "关于本术语表及引用方式" "letters" "按字母排列的术语" "none" "没有匹配的术语。" "home" "首页" "breadcrumb" "导航路径" "count" "%s / %s 个术语" "updated" "最后更新:") }}
{{ $l := index $labels $lang | default (index $labels "english") }}
{{ $pages := sort (where (where site.RegularPages "Type" "glossary") "File.Dir" .File.Dir) "Params.sort_key" }}
{{/* Hugo's sort already collates Ä with A. German also files them under one letter (DIN 5007); other languages keep
Expand Down Expand Up @@ -40,8 +40,9 @@
<div class="article-layout article-layout-single article-layout-wide glossary-layout glossary-hub">
<article class="reading">
<header class="article-head">
{{ partial "doors/crumbs" (dict "page" .) }}
<h1>{{ .Title }}</h1>
{{/* The Arabic hub's _index.md is titled "Glossary" and ships from main (see the lede below), so its name is set here. */}}
{{ partial "doors/crumbs" (dict "page" . "label" ($l.title | default .Title) "home" $l.home "name" $l.breadcrumb) }}
<h1>{{ $l.title | default .Title }}</h1>
{{/* The lede lives here, not in the _index.md pages: data-processing.yml ships content/glossary/ from main,
so an edit there would not reach the site. */}}
{{ with $l.lede }}<p class="standfirst">{{ . | markdownify }}</p>{{ end }}
Expand All @@ -66,7 +67,7 @@ <h1>{{ .Title }}</h1>
<label for="glossary-search">{{ printf $l.search (len $pages) }}</label>
<div class="glossary-search-row"><input type="search" id="glossary-search" placeholder="{{ $l.placeholder }}" autocomplete="off"><button type="button" class="glossary-clear" hidden>{{ $l.clear }}</button><span class="glossary-view" role="group" aria-label="{{ $l.view }}" hidden><button type="button" data-view="cards" aria-pressed="true">{{ $l.cards }}</button><button type="button" data-view="list" aria-pressed="false">{{ $l.list }}</button></span></div>
<p class="glossary-none" hidden>{{ $l.none }}</p>
<p class="glossary-count" aria-live="polite"></p>
<p class="glossary-count" aria-live="polite" data-format="{{ $l.count | default (index $labels "english").count }}"></p>
</div>
<nav class="glossary-letters" aria-label="{{ $l.letters }}">
{{ range $groups }}<a href="#{{ .id }}">{{ .letter }}</a>{{ end }}
Expand Down
29 changes: 29 additions & 0 deletions layouts/glossary/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
"translation_reviewed_by" "Translation reviewed by"
"reference" "Reference"
"references" "References"
"filter_one" "%d term"
"filter_many" "%d terms"
"filter_none" "No matching terms."
"clear" "Clear"
)
"german" (dict
"list_of_terms" "Liste der Begriffe"
Expand All @@ -38,6 +42,10 @@
"languages" (dict "arabic" "Arabisch" "chinese" "Chinesisch" "english" "Englisch" "turkish" "Türkisch")
"reference" "Referenz"
"references" "Referenzen"
"filter_one" "%d Begriff"
"filter_many" "%d Begriffe"
"filter_none" "Kein Begriff passt."
"clear" "Löschen"
)
"arabic" (dict
"list_of_terms" "قائمة المصطلحات"
Expand All @@ -59,6 +67,13 @@
"also_available_in" "اللغات الأخرى"
"languages" (dict "arabic" "العربية" "chinese" "الصينية" "english" "الإنجليزية" "german" "الألمانية" "turkish" "التركية")
"separator" "، "
"filter_one" "مصطلح واحد"
"filter_two" "مصطلحان"
"filter_few" "%d مصطلحات"
"filter_many" "%d مصطلحًا"
Comment thread
LukasWallrich marked this conversation as resolved.
Resolved
"filter_other" "%d مصطلح"
"filter_none" "لا يوجد مصطلح مطابق."
"clear" "مسح"
)
"turkish" (dict
"list_of_terms" "Terimler listesi"
Expand All @@ -77,6 +92,10 @@
"languages" (dict "arabic" "Arapça" "chinese" "Çince" "english" "İngilizce" "german" "Almanca")
"reference" "Kaynak"
"references" "Kaynakça"
"filter_one" "%d terim"
"filter_many" "%d terim"
"filter_none" "Eşleşen terim yok."
"clear" "Temizle"
)
"chinese" (dict
"list_of_terms" "术语列表"
Expand All @@ -95,6 +114,16 @@
"languages" (dict "arabic" "阿拉伯语" "english" "英语" "german" "德语" "turkish" "土耳其语")
"reference" "参考文献"
"references" "参考文献"
"home" "首页"
"breadcrumb" "导航路径"
"glossary" "术语表"
"also_available_in" "其他语言版本"
"languages" (dict "arabic" "阿拉伯语" "chinese" "中文" "english" "英语" "german" "德语" "turkish" "土耳其语")
Comment thread
LukasWallrich marked this conversation as resolved.
Resolved
"separator" "、"
"filter_one" "%d 个术语"
"filter_many" "%d 个术语"
"filter_none" "没有匹配的术语。"
"clear" "清除"
)
}}

Expand Down
5 changes: 3 additions & 2 deletions layouts/partials/doors/crumbs.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{/* Visible breadcrumbs, separate from the BreadcrumbList in structured-data/breadcrumbs.html.
A page's label and parent come from the main menu when it is there, so renaming a menu
entry renames the trail too. A page outside the menu can name its menu section in front matter
(crumb_parent = "Educational Nexus"). Input: dict with `page` and optional `label` for the last step. */}}
(crumb_parent = "Educational Nexus"). Input: dict with `page`, and optional `label` for the last step, `home` for
the first and `name` for the trail's accessible name (a glossary in another language gives them in that language). */}}
{{ $page := .page }}
{{ $label := .label | default $page.LinkTitle }}
{{ $parent := "" }}
Expand All @@ -25,4 +26,4 @@
{{/* A news category (/category/<term>/) and the list of them (/categories/) have the news list as parent. */}}
{{ if and (not $parent) (in (slice "term" "taxonomy") $page.Kind) (eq (lower $page.Type) "categories") }}{{ with site.GetPage "/post" }}{{ $parent = dict "Name" .LinkTitle "URL" "post/" }}{{ end }}{{ end }}
{{ if not $parent }}{{ with $page.Params.crumb_parent }}{{ $name := . }}{{ range site.Menus.main }}{{ if eq .Name $name }}{{ $parent = . }}{{ end }}{{ end }}{{ end }}{{ end }}
<nav class="crumbs" aria-label="Breadcrumb"><a href="{{ "" | relLangURL }}">Home</a> <span aria-hidden="true">/</span> {{ with $parent }}{{ if ne .Name $label }}{{ if .URL }}<a href="{{ .URL | relLangURL }}">{{ .Name }}</a>{{ else }}{{ .Name }}{{ end }} <span aria-hidden="true">/</span> {{ end }}{{ end }}<span aria-current="page">{{ $label }}</span></nav>
<nav class="crumbs" aria-label="{{ .name | default "Breadcrumb" }}"><a href="{{ "" | relLangURL }}">{{ .home | default "Home" }}</a> <span aria-hidden="true">/</span> {{ with $parent }}{{ if ne .Name $label }}{{ if .URL }}<a href="{{ .URL | relLangURL }}">{{ .Name }}</a>{{ else }}{{ .Name }}{{ end }} <span aria-hidden="true">/</span> {{ end }}{{ end }}<span aria-current="page">{{ $label }}</span></nav>
3 changes: 2 additions & 1 deletion layouts/partials/doors/glossary_terms.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<h2>{{ .labels.list_of_terms }}</h2>
{{ $label := strings.TrimRight ".…" .labels.filter_terms }}
<label class="term-filter-label" for="glossary-search">{{ $label }}</label>
<input type="search" id="glossary-search" class="form-control" autocomplete="off">
{{/* The filter's count, no-match line and clear button in the page's language (site.js). */}}
<input type="search" id="glossary-search" class="form-control" autocomplete="off" data-single="{{ .labels.filter_one | default "%d term" }}" data-many="{{ .labels.filter_many | default "%d terms" }}"{{ with .labels.filter_two }} data-two="{{ . }}"{{ end }}{{ with .labels.filter_few }} data-few="{{ . }}"{{ end }}{{ with .labels.filter_other }} data-other="{{ . }}"{{ end }} data-none="{{ .labels.filter_none | default "No matching terms." }}" data-clear="{{ .labels.clear | default "Clear" }}">
<nav class="term-list" aria-label="{{ .labels.list_of_terms }}">
<ul>
{{/* A term with other names carries them in data-term for the filter; the rest match on their text. */}}
Expand Down
Loading