@@ -4,16 +4,15 @@ import {
4
4
defineComponent ,
5
5
getCurrentInstance ,
6
6
h ,
7
- inject ,
8
7
isVue2 ,
9
8
} from 'vue-demi'
10
9
import type { ResolvedOptions , SimpleNode } from 'src/types'
11
10
import type { VueComponent } from 'src/types/typesCompat'
12
11
13
12
import { camelize } from '../util/camelize'
14
13
import { getContext } from '../getContext'
15
- import { RootContextSymbol } from '../symbols '
16
- import { assert , warn } from '../util/warn '
14
+ import { warn } from '../util/warn '
15
+ import type { TranslationContext } from '../TranslationContext '
17
16
18
17
function getParentWithFluent (
19
18
instance : VueComponent | null | undefined ,
@@ -31,7 +30,7 @@ function getParentWithFluent(
31
30
// &, &, &.
32
31
const reMarkup = / < | & # ? \w + ; /
33
32
34
- export function createComponent ( options : ResolvedOptions ) {
33
+ export function createComponent ( options : ResolvedOptions , rootContext : TranslationContext ) {
35
34
return defineComponent ( {
36
35
name : options . componentName ,
37
36
props : {
@@ -42,8 +41,6 @@ export function createComponent(options: ResolvedOptions) {
42
41
noTag : { type : Boolean , default : false } ,
43
42
} ,
44
43
setup ( props , { slots, attrs } ) {
45
- const rootContext = inject ( RootContextSymbol )
46
- assert ( rootContext != null , 'i18n component used without installing plugin' )
47
44
const instance = getCurrentInstance ( )
48
45
const parent = getParentWithFluent ( instance ?. proxy )
49
46
const fluent = getContext ( rootContext , parent )
0 commit comments