1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-23 23:21:00 +01:00

Added aria labels to language and version selector

This commit is contained in:
squidfunk 2021-06-06 15:11:04 +02:00
parent 2a5ba14ebe
commit 11fcf4f0ab
16 changed files with 41 additions and 20 deletions

View File

@ -30,18 +30,23 @@ assignees: ''
"search.config.separator": "[\s\-]+",
"search.placeholder": "Search",
"search.reset": "Clear",
"search.result.initializer": "Initializing search",
"search.result.placeholder": "Type to start searching",
"search.result.none": "No matching documents",
"search.result.one": "1 matching document",
"search.result.other": "# matching documents",
"search.result.more.one": "1 more on this page",
"search.result.more.other": "# more on this page",
"search.result.term.missing": "Missing",
"select.language.title": "Select language",
"select.version.title": "Select version",
"skip.link.title": "Skip to content",
"source.link.title": "Go to repository",
"source.file.date.updated": "Last update",
"source.file.date.created": "Created",
"tabs.title": "Tabs",
"toc.title": "Table of contents"
"toc.title": "Table of contents",
"top.title": "Back to top"
}[key] }}{% endmacro %}
```

View File

@ -214,7 +214,8 @@
"search.result.other",
"search.result.more.one",
"search.result.more.other",
"search.result.term.missing"
"search.result.term.missing",
"select.version.title"
] -%}
{%- set _ = translations.update({ key: lang.t(key) }) -%}
{%- endfor -%}
@ -223,7 +224,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.f8da964b.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.76f349be.min.js' | url }}"></script>
{% for path in config["extra_javascript"] %}
<script src="{{ path | url }}"></script>
{% endfor %}

View File

@ -15,5 +15,5 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
//# sourceMappingURL=bundle.7a44c2b0.min.js.map
//# sourceMappingURL=bundle.f989075e.min.js.map

View File

@ -35,5 +35,5 @@
{% endblock %}
{% block scripts %}
{{ super() }}
<script src="{{ 'overrides/assets/javascripts/bundle.7a44c2b0.min.js' | url }}"></script>
<script src="{{ 'overrides/assets/javascripts/bundle.f989075e.min.js' | url }}"></script>
{% endblock %}

View File

@ -45,7 +45,7 @@
<div class="md-header__option">
<div class="md-select">
{% set icon = config.theme.icon.alternate or "material/translate" %}
<button class="md-header__button md-icon" aria-label="{{ lang.t('language.select') }}">
<button class="md-header__button md-icon" aria-label="{{ lang.t('select.language.title') }}">
{% include ".icons/" ~ icon ~ ".svg" %}
</button>
<div class="md-select__inner">

View File

@ -20,6 +20,8 @@
"search.result.more.one": "1 weiteres Suchergebnis auf dieser Seite",
"search.result.more.other": "# weitere Suchergebnisse auf dieser Seite",
"search.result.term.missing": "Es fehlt",
"select.language.title": "Sprache wechseln",
"select.version.title": "Version auswählen",
"skip.link.title": "Zum Inhalt",
"source.link.title": "Quellcode",
"source.revision.date": "Letztes Update",

View File

@ -11,7 +11,6 @@
"footer.next": "Next",
"footer.title": "Footer",
"header.title": "Header",
"language.select": "Select language",
"meta.comments": "Comments",
"meta.source": "Source",
"nav.title": "Navigation",
@ -28,6 +27,8 @@
"search.result.more.one": "1 more on this page",
"search.result.more.other": "# more on this page",
"search.result.term.missing": "Missing",
"select.language.title": "Select language",
"select.version.title": "Select version",
"skip.link.title": "Skip to content",
"source.link.title": "Go to repository",
"source.revision.date": "Last update",

View File

@ -57,6 +57,7 @@ export type Translation =
| "search.result.more.one" /* 1 more on this page */
| "search.result.more.other" /* # more on this page */
| "search.result.term.missing" /* Missing */
| "select.version.title" /* Version selector */
/**
* Translations

View File

@ -20,7 +20,7 @@
* IN THE SOFTWARE.
*/
import { configuration } from "~/_"
import { configuration, translation } from "~/_"
import { h } from "~/utilities"
/* ----------------------------------------------------------------------------
@ -85,7 +85,10 @@ export function renderVersionSelector(versions: Version[]): HTMLElement {
/* Render version selector */
return (
<div class="md-version">
<button class="md-version__current">
<button
class="md-version__current"
aria-label={translation("select.version.title")}
>
{active.title}
</button>
<ul class="md-version__list">

View File

@ -386,7 +386,8 @@
"search.result.other",
"search.result.more.one",
"search.result.more.other",
"search.result.term.missing"
"search.result.term.missing",
"select.version.title"
] -%}
{%- set _ = translations.update({ key: lang.t(key) }) -%}
{%- endfor -%}

View File

@ -103,7 +103,10 @@
<div class="md-header__option"></form>
<div class="md-select">
{% set icon = config.theme.icon.alternate or "material/translate" %}
<button class="md-header__button md-icon" aria-label="{{ lang.t('language.select') }}"">
<button
class="md-header__button md-icon"
aria-label="{{ lang.t('select.language.title') }}"
>
{% include ".icons/" ~ icon ~ ".svg" %}
</button>
<div class="md-select__inner">

View File

@ -40,10 +40,13 @@
"search.result.more.one": "1 weiteres Suchergebnis auf dieser Seite",
"search.result.more.other": "# weitere Suchergebnisse auf dieser Seite",
"search.result.term.missing": "Es fehlt",
"select.language.title": "Sprache wechseln",
"select.version.title": "Version auswählen",
"skip.link.title": "Zum Inhalt",
"source.link.title": "Quellcode",
"source.revision.date": "Letztes Update",
"source.file.date.updated": "Letztes Update",
"source.file.date.created": "Erstellt",
"toc.title": "Inhaltsverzeichnis"
"toc.title": "Inhaltsverzeichnis",
"top.title": "Zurück zum Seitenanfang"
}[key] }}{% endmacro %}

View File

@ -31,7 +31,6 @@
"footer.next": "Next",
"footer.title": "Footer",
"header.title": "Header",
"language.select": "Select language",
"meta.comments": "Comments",
"meta.source": "Source",
"nav.title": "Navigation",
@ -48,6 +47,8 @@
"search.result.more.one": "1 more on this page",
"search.result.more.other": "# more on this page",
"search.result.term.missing": "Missing",
"select.language.title": "Select language",
"select.version.title": "Select version",
"skip.link.title": "Skip to content",
"source.link.title": "Go to repository",
"source.revision.date": "Last update",