Skip to content

Commit

Permalink
fix: make local search work in combination with vue-i18n (#3559)
Browse files Browse the repository at this point in the history
  • Loading branch information
sirxemic committed Feb 7, 2024
1 parent fb380e6 commit 6624bb7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
24 changes: 12 additions & 12 deletions src/client/theme-default/components/VPLocalSearchBox.vue
Expand Up @@ -362,7 +362,7 @@ const defaultTranslations: { modal: ModalTranslations } = {
}
}
const $t = createSearchTranslate(defaultTranslations)
const translate = createSearchTranslate(defaultTranslations)
// Back
Expand Down Expand Up @@ -452,7 +452,7 @@ function formMarkRegex(terms: Set<string>) {
<div class="search-actions before">
<button
class="back-button"
:title="$t('modal.backButtonTitle')"
:title="translate('modal.backButtonTitle')"
@click="$emit('close')"
>
<svg
Expand Down Expand Up @@ -486,7 +486,7 @@ function formMarkRegex(terms: Set<string>) {
class="toggle-layout-button"
type="button"
:class="{ 'detailed-list': showDetailedList }"
:title="$t('modal.displayDetails')"
:title="translate('modal.displayDetails')"
@click="
selectedIndex > -1 && (showDetailedList = !showDetailedList)
"
Expand All @@ -512,7 +512,7 @@ function formMarkRegex(terms: Set<string>) {
class="clear-button"
type="reset"
:disabled="disableReset"
:title="$t('modal.resetButtonTitle')"
:title="translate('modal.resetButtonTitle')"
@click="resetSearch"
>
<svg
Expand Down Expand Up @@ -598,14 +598,14 @@ function formMarkRegex(terms: Set<string>) {
v-if="filterText && !results.length && enableNoResults"
class="no-results"
>
{{ $t('modal.noResultsText') }} "<strong>{{ filterText }}</strong
{{ translate('modal.noResultsText') }} "<strong>{{ filterText }}</strong
>"
</li>
</ul>
<div class="search-keyboard-shortcuts">
<span>
<kbd :aria-label="$t('modal.footer.navigateUpKeyAriaLabel')">
<kbd :aria-label="translate('modal.footer.navigateUpKeyAriaLabel')">
<svg width="14" height="14" viewBox="0 0 24 24">
<path
fill="none"
Expand All @@ -617,7 +617,7 @@ function formMarkRegex(terms: Set<string>) {
/>
</svg>
</kbd>
<kbd :aria-label="$t('modal.footer.navigateDownKeyAriaLabel')">
<kbd :aria-label="translate('modal.footer.navigateDownKeyAriaLabel')">
<svg width="14" height="14" viewBox="0 0 24 24">
<path
fill="none"
Expand All @@ -629,10 +629,10 @@ function formMarkRegex(terms: Set<string>) {
/>
</svg>
</kbd>
{{ $t('modal.footer.navigateText') }}
{{ translate('modal.footer.navigateText') }}
</span>
<span>
<kbd :aria-label="$t('modal.footer.selectKeyAriaLabel')">
<kbd :aria-label="translate('modal.footer.selectKeyAriaLabel')">
<svg width="14" height="14" viewBox="0 0 24 24">
<g
fill="none"
Expand All @@ -646,11 +646,11 @@ function formMarkRegex(terms: Set<string>) {
</g>
</svg>
</kbd>
{{ $t('modal.footer.selectText') }}
{{ translate('modal.footer.selectText') }}
</span>
<span>
<kbd :aria-label="$t('modal.footer.closeKeyAriaLabel')">esc</kbd>
{{ $t('modal.footer.closeText') }}
<kbd :aria-label="translate('modal.footer.closeKeyAriaLabel')">esc</kbd>
{{ translate('modal.footer.closeText') }}
</span>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/client/theme-default/components/VPNavBarSearchButton.vue
Expand Up @@ -10,11 +10,11 @@ const defaultTranslations: { button: ButtonTranslations } = {
}
}
const $t = createSearchTranslate(defaultTranslations)
const translate = createSearchTranslate(defaultTranslations)
</script>

<template>
<button type="button" class="DocSearch DocSearch-Button" :aria-label="$t('button.buttonAriaLabel')">
<button type="button" class="DocSearch DocSearch-Button" :aria-label="translate('button.buttonAriaLabel')">
<span class="DocSearch-Button-Container">
<svg
class="DocSearch-Search-Icon"
Expand All @@ -32,7 +32,7 @@ const $t = createSearchTranslate(defaultTranslations)
stroke-linejoin="round"
/>
</svg>
<span class="DocSearch-Button-Placeholder">{{ $t('button.buttonText') }}</span>
<span class="DocSearch-Button-Placeholder">{{ translate('button.buttonText') }}</span>
</span>
<span class="DocSearch-Button-Keys">
<kbd class="DocSearch-Button-Key"></kbd>
Expand Down

0 comments on commit 6624bb7

Please sign in to comment.