From 2a845fe5f12bed7c4d2b0a94bf9b55fd36cfc929 Mon Sep 17 00:00:00 2001 From: Alija Sabic Date: Thu, 2 Mar 2023 10:36:28 +0100 Subject: [PATCH 1/5] Set label for VPFlyout in VPNavBarTranslations according to default theme configuration --- src/client/theme-default/components/VPNavBarTranslations.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/client/theme-default/components/VPNavBarTranslations.vue b/src/client/theme-default/components/VPNavBarTranslations.vue index a184d2840ae6..16e6990b8fc4 100644 --- a/src/client/theme-default/components/VPNavBarTranslations.vue +++ b/src/client/theme-default/components/VPNavBarTranslations.vue @@ -2,8 +2,10 @@ import VPIconLanguages from './icons/VPIconLanguages.vue' import VPFlyout from './VPFlyout.vue' import VPMenuLink from './VPMenuLink.vue' +import { useData } from '../composables/data.js' import { useLangs } from '../composables/langs.js' +const { theme } = useData() const { localeLinks, currentLang } = useLangs({ correspondingLink: true }) @@ -12,6 +14,7 @@ const { localeLinks, currentLang } = useLangs({ correspondingLink: true }) v-if="localeLinks.length && currentLang.label" class="VPNavBarTranslations" :icon="VPIconLanguages" + :label="theme.langMenuAriaLabel || 'Change language'" >

{{ currentLang.label }}

From 85071e46d217a66f05346dbd90e20b442e884064 Mon Sep 17 00:00:00 2001 From: Alija Sabic Date: Mon, 6 Mar 2023 14:01:41 +0100 Subject: [PATCH 2/5] Add langMenuAriaLabel to default theme configuration --- types/default-theme.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/default-theme.d.ts b/types/default-theme.d.ts index abb8e81accd0..29b28081f0ab 100644 --- a/types/default-theme.d.ts +++ b/types/default-theme.d.ts @@ -54,6 +54,13 @@ export namespace DefaultTheme { */ aside?: boolean + /** + * Set custom `aria-label` for language menu button. + * + * @default 'Change language' + */ + langMenuAriaLabel?: string + /** * Info for the edit link. If it's undefined, the edit link feature will * be disabled. From 41b91641ed2f2b8c5c5e5d6482edd257c2a1076e Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Wed, 8 Mar 2023 10:43:19 +0530 Subject: [PATCH 3/5] Update default-theme.d.ts --- types/default-theme.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/default-theme.d.ts b/types/default-theme.d.ts index 29b28081f0ab..7abab0b6fdfe 100644 --- a/types/default-theme.d.ts +++ b/types/default-theme.d.ts @@ -54,13 +54,6 @@ export namespace DefaultTheme { */ aside?: boolean - /** - * Set custom `aria-label` for language menu button. - * - * @default 'Change language' - */ - langMenuAriaLabel?: string - /** * Info for the edit link. If it's undefined, the edit link feature will * be disabled. @@ -105,6 +98,13 @@ export namespace DefaultTheme { */ returnToTopLabel?: string + /** + * Set custom `aria-label` for language menu button. + * + * @default 'Change language' + */ + langMenuLabel?: string + /** * The algolia options. Leave it undefined to disable the search feature. */ From 87704d8cc20a6cfbe4e5504aa57f94f1d1bcfc0b Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Wed, 8 Mar 2023 10:43:46 +0530 Subject: [PATCH 4/5] Update VPNavBarTranslations.vue --- src/client/theme-default/components/VPNavBarTranslations.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/theme-default/components/VPNavBarTranslations.vue b/src/client/theme-default/components/VPNavBarTranslations.vue index 16e6990b8fc4..3531e86387db 100644 --- a/src/client/theme-default/components/VPNavBarTranslations.vue +++ b/src/client/theme-default/components/VPNavBarTranslations.vue @@ -14,7 +14,7 @@ const { localeLinks, currentLang } = useLangs({ correspondingLink: true }) v-if="localeLinks.length && currentLang.label" class="VPNavBarTranslations" :icon="VPIconLanguages" - :label="theme.langMenuAriaLabel || 'Change language'" + :label="theme.langMenuLabel || 'Change language'" >

{{ currentLang.label }}

From 14124f95d900b0d0139680a71b9a21f38d2a156c Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Wed, 8 Mar 2023 10:53:52 +0530 Subject: [PATCH 5/5] add docs --- docs/reference/default-theme-config.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/reference/default-theme-config.md b/docs/reference/default-theme-config.md index 1761158f40d3..6850f5a1dcf1 100644 --- a/docs/reference/default-theme-config.md +++ b/docs/reference/default-theme-config.md @@ -389,4 +389,11 @@ Can be used to customize the sidebar menu label. This label is only displayed in - Type: `string` - Default: `Return to top` -Can be used to customize the label of the returnToTop. This label is only displayed in the mobile view. +Can be used to customize the label of the return to top button. This label is only displayed in the mobile view. + +## langMenuLabel + +- Type: `string` +- Default: `Change language` + +Can be used to customize the aria-label of the language toggle button in navbar. This is only used if you're using [i18n](../guide/i18n).