Skip to content

Commit 8687b86

Browse files
committed
fix(default-theme): remove use of reactify for search i18n
1 parent 9f1f04e commit 8687b86

File tree

3 files changed

+7
-20
lines changed

3 files changed

+7
-20
lines changed

Diff for: src/client/theme-default/components/VPLocalSearchBox.vue

+2-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
computedAsync,
55
debouncedWatch,
66
onKeyStroke,
7-
reactify,
87
useEventListener,
98
useLocalStorage,
109
useScrollLock,
@@ -23,7 +22,6 @@ import {
2322
onMounted,
2423
ref,
2524
shallowRef,
26-
toRef,
2725
watch,
2826
watchEffect,
2927
type Ref
@@ -32,7 +30,7 @@ import type { ModalTranslations } from '../../../../types/local-search'
3230
import { pathToFile } from '../../app/utils'
3331
import { useData } from '../composables/data'
3432
import { LRUCache } from '../support/lru'
35-
import { createTranslate } from '../support/translation'
33+
import { createSearchTranslate } from '../support/translation'
3634
3735
const emit = defineEmits<{
3836
(e: 'close'): void
@@ -361,10 +359,7 @@ const defaultTranslations: { modal: ModalTranslations } = {
361359
}
362360
}
363361
364-
const $t = reactify(createTranslate)(
365-
toRef(() => theme.value.search?.options),
366-
defaultTranslations
367-
)
362+
const $t = createSearchTranslate(defaultTranslations)
368363
369364
// Back
370365

Diff for: src/client/theme-default/components/VPNavBarSearchButton.vue

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
<script lang="ts" setup>
2-
import { reactify } from '@vueuse/core'
3-
import { toRef } from 'vue'
42
import type { ButtonTranslations } from '../../../../types/local-search'
5-
import { useData } from '../composables/data'
6-
import { createTranslate } from '../support/translation'
7-
8-
const { theme } = useData()
3+
import { createSearchTranslate } from '../support/translation'
94
105
// Button-Translations
116
const defaultTranslations: { button: ButtonTranslations } = {
@@ -15,10 +10,7 @@ const defaultTranslations: { button: ButtonTranslations } = {
1510
}
1611
}
1712
18-
const $t = reactify(createTranslate)(
19-
toRef(() => theme.value.search?.options),
20-
defaultTranslations
21-
)
13+
const $t = createSearchTranslate(defaultTranslations)
2214
</script>
2315

2416
<template>

Diff for: src/client/theme-default/support/translation.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import { useData } from '../composables/data'
33
/**
44
* @param themeObject Can be an object with `translations` and `locales` properties
55
*/
6-
export function createTranslate(
7-
themeObject: any,
6+
export function createSearchTranslate(
87
defaultTranslations: Record<string, any>
98
): (key: string) => string {
10-
const { localeIndex } = useData()
9+
const { localeIndex, theme } = useData()
1110

1211
function translate(key: string): string {
1312
const keyPath = key.split('.')
13+
const themeObject = theme.value.search?.options
1414

1515
const isObject = themeObject && typeof themeObject === 'object'
1616
const locales =

0 commit comments

Comments
 (0)