File tree 3 files changed +7
-20
lines changed
3 files changed +7
-20
lines changed Original file line number Diff line number Diff line change 4
4
computedAsync ,
5
5
debouncedWatch ,
6
6
onKeyStroke ,
7
- reactify ,
8
7
useEventListener ,
9
8
useLocalStorage ,
10
9
useScrollLock ,
@@ -23,7 +22,6 @@ import {
23
22
onMounted ,
24
23
ref ,
25
24
shallowRef ,
26
- toRef ,
27
25
watch ,
28
26
watchEffect ,
29
27
type Ref
@@ -32,7 +30,7 @@ import type { ModalTranslations } from '../../../../types/local-search'
32
30
import { pathToFile } from ' ../../app/utils'
33
31
import { useData } from ' ../composables/data'
34
32
import { LRUCache } from ' ../support/lru'
35
- import { createTranslate } from ' ../support/translation'
33
+ import { createSearchTranslate } from ' ../support/translation'
36
34
37
35
const emit = defineEmits <{
38
36
(e : ' close' ): void
@@ -361,10 +359,7 @@ const defaultTranslations: { modal: ModalTranslations } = {
361
359
}
362
360
}
363
361
364
- const $t = reactify (createTranslate )(
365
- toRef (() => theme .value .search ?.options ),
366
- defaultTranslations
367
- )
362
+ const $t = createSearchTranslate (defaultTranslations )
368
363
369
364
// Back
370
365
Original file line number Diff line number Diff line change 1
1
<script lang="ts" setup>
2
- import { reactify } from ' @vueuse/core'
3
- import { toRef } from ' vue'
4
2
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'
9
4
10
5
// Button-Translations
11
6
const defaultTranslations: { button: ButtonTranslations } = {
@@ -15,10 +10,7 @@ const defaultTranslations: { button: ButtonTranslations } = {
15
10
}
16
11
}
17
12
18
- const $t = reactify (createTranslate )(
19
- toRef (() => theme .value .search ?.options ),
20
- defaultTranslations
21
- )
13
+ const $t = createSearchTranslate (defaultTranslations )
22
14
</script >
23
15
24
16
<template >
Original file line number Diff line number Diff line change @@ -3,14 +3,14 @@ import { useData } from '../composables/data'
3
3
/**
4
4
* @param themeObject Can be an object with `translations` and `locales` properties
5
5
*/
6
- export function createTranslate (
7
- themeObject : any ,
6
+ export function createSearchTranslate (
8
7
defaultTranslations : Record < string , any >
9
8
) : ( key : string ) => string {
10
- const { localeIndex } = useData ( )
9
+ const { localeIndex, theme } = useData ( )
11
10
12
11
function translate ( key : string ) : string {
13
12
const keyPath = key . split ( '.' )
13
+ const themeObject = theme . value . search ?. options
14
14
15
15
const isObject = themeObject && typeof themeObject === 'object'
16
16
const locales =
You can’t perform that action at this time.
0 commit comments