|
| 1 | +import { |
| 2 | + inBrowser, |
| 3 | + isNumber, |
| 4 | + isPlainObject, |
| 5 | + isString, |
| 6 | + warnOnce |
| 7 | +} from '@intlify/shared' |
1 | 8 | import { watch } from 'vue' |
2 | 9 | import { createI18nError, I18nErrorCodes } from './errors' |
3 | | -import { isString, isPlainObject, isNumber, inBrowser } from '@intlify/shared' |
| 10 | +import { getWarnMessage, I18nWarnCodes } from './warnings' |
4 | 11 |
|
| 12 | +import type { Locale, NamedValue, TranslateOptions } from '@intlify/core-base' |
5 | 13 | import type { |
| 14 | + ComponentInternalInstance, |
6 | 15 | DirectiveBinding, |
7 | 16 | ObjectDirective, |
8 | | - WatchStopHandle, |
9 | | - ComponentInternalInstance |
| 17 | + WatchStopHandle |
10 | 18 | } from 'vue' |
| 19 | +import type { Composer } from './composer' |
11 | 20 | import type { I18n, I18nInternal } from './i18n' |
12 | 21 | import type { VueI18nInternal } from './legacy' |
13 | | -import type { Composer } from './composer' |
14 | | -import type { Locale, TranslateOptions, NamedValue } from '@intlify/core-base' |
15 | 22 |
|
16 | 23 | export type VTDirectiveValue = { |
17 | 24 | path: string |
@@ -80,7 +87,16 @@ function getComposer( |
80 | 87 | */ |
81 | 88 | export type TranslationDirective<T = HTMLElement> = ObjectDirective<T> |
82 | 89 |
|
| 90 | +/** |
| 91 | + * @deprecated will be removed at vue-i18n v12 |
| 92 | + */ |
83 | 93 | export function vTDirective(i18n: I18n): TranslationDirective<HTMLElement> { |
| 94 | + if (__DEV__) { |
| 95 | + warnOnce( |
| 96 | + getWarnMessage(I18nWarnCodes.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE) |
| 97 | + ) |
| 98 | + } |
| 99 | + |
84 | 100 | const _process = (binding: DirectiveBinding): [string, Composer] => { |
85 | 101 | const { instance, value } = binding |
86 | 102 | /* istanbul ignore if */ |
|
0 commit comments