Skip to content

Commit 14a95e5

Browse files
fix: correct typo in TranslateVNodeSymbol (#1236)
1 parent 125c94b commit 14a95e5

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

packages/vue-i18n-core/src/components/Translation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { h } from 'vue'
22
import { isNumber, isString, isObject } from '@intlify/shared'
3-
import { TransrateVNodeSymbol } from '../symbols'
3+
import { TranslateVNodeSymbol } from '../symbols'
44
import { useI18n } from '../i18n'
55
import { baseFormatProps } from './base'
66
import { assign } from '@intlify/shared'
@@ -118,7 +118,7 @@ export const Translation = /* #__PURE__*/ /* defineComponent */ {
118118
}
119119
const arg = getInterpolateArg(context, keys)
120120
// eslint-disable-next-line @typescript-eslint/no-explicit-any
121-
const children = (i18n as any)[TransrateVNodeSymbol](
121+
const children = (i18n as any)[TranslateVNodeSymbol](
122122
props.keypath,
123123
arg,
124124
options

packages/vue-i18n-core/src/composer.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import { VueDevToolsTimelineEvents } from '@intlify/vue-devtools'
3939
import { I18nWarnCodes, getWarnMessage } from './warnings'
4040
import { I18nErrorCodes, createI18nError } from './errors'
4141
import {
42-
TransrateVNodeSymbol,
42+
TranslateVNodeSymbol,
4343
DatetimePartsSymbol,
4444
NumberPartsSymbol,
4545
EnableEmitter,
@@ -1683,7 +1683,7 @@ export interface Composer<
16831683
* @internal
16841684
*/
16851685
export interface ComposerInternal {
1686-
__transrateVNode(...args: unknown[]): VNodeArrayChildren
1686+
__translateVNode(...args: unknown[]): VNodeArrayChildren
16871687
__numberParts(...args: unknown[]): string | Intl.NumberFormatPart[]
16881688
__datetimeParts(...args: unknown[]): string | Intl.DateTimeFormatPart[]
16891689
__enableEmitter?: (emitter: VueDevToolsEmitter) => void
@@ -2188,8 +2188,8 @@ export function createComposer(options: any = {}, VueI18nLegacy?: any): any {
21882188
type: 'vnode'
21892189
} as MessageProcessor<VNode>
21902190

2191-
// transrateVNode, using for `i18n-t` component
2192-
function transrateVNode(...args: unknown[]): VNodeArrayChildren {
2191+
// translateVNode, using for `i18n-t` component
2192+
function translateVNode(...args: unknown[]): VNodeArrayChildren {
21932193
return wrapWithDeps<VNode, VNodeArrayChildren>(
21942194
context => {
21952195
let ret: unknown
@@ -2208,7 +2208,7 @@ export function createComposer(options: any = {}, VueI18nLegacy?: any): any {
22082208
() => parseTranslateArgs(...args),
22092209
'translate',
22102210
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2211-
root => (root as any)[TransrateVNodeSymbol](...args),
2211+
root => (root as any)[TranslateVNodeSymbol](...args),
22122212
key => [createTextNode(key as string)],
22132213
val => isArray(val)
22142214
)
@@ -2504,7 +2504,7 @@ export function createComposer(options: any = {}, VueI18nLegacy?: any): any {
25042504
;(composer as any).setNumberFormat = setNumberFormat
25052505
;(composer as any).mergeNumberFormat = mergeNumberFormat
25062506
;(composer as any)[InejctWithOption] = options.__injectWithOption
2507-
;(composer as any)[TransrateVNodeSymbol] = transrateVNode
2507+
;(composer as any)[TranslateVNodeSymbol] = translateVNode
25082508
;(composer as any)[DatetimePartsSymbol] = datetimeParts
25092509
;(composer as any)[NumberPartsSymbol] = numberParts
25102510
}

packages/vue-i18n-core/src/symbols.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { makeSymbol } from '@intlify/shared'
22

3-
export const TransrateVNodeSymbol =
4-
/* #__PURE__*/ makeSymbol('__transrateVNode')
3+
export const TranslateVNodeSymbol =
4+
/* #__PURE__*/ makeSymbol('__translateVNode')
55
export const DatetimePartsSymbol = /* #__PURE__*/ makeSymbol('__datetimeParts')
66
export const NumberPartsSymbol = /* #__PURE__*/ makeSymbol('__numberParts')
77
export const EnableEmitter = /* #__PURE__*/ makeSymbol('__enableEmitter')

packages/vue-i18n-core/test/__snapshots__/composer.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`__transrateVNode missing 1`] = `
3+
exports[`__translateVNode missing 1`] = `
44
Array [
55
Object {
66
"__v_isVNode": true,

packages/vue-i18n-core/test/composer.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
VueMessageType
1919
} from '../src/composer'
2020
import {
21-
TransrateVNodeSymbol,
21+
TranslateVNodeSymbol,
2222
NumberPartsSymbol,
2323
DatetimePartsSymbol
2424
} from '../src/symbols'
@@ -1514,7 +1514,7 @@ describe('__i18n', () => {
15141514
})
15151515
})
15161516

1517-
describe('__transrateVNode', () => {
1517+
describe('__translateVNode', () => {
15181518
test('basic', () => {
15191519
const composer = createComposer({
15201520
locale: 'en',
@@ -1525,7 +1525,7 @@ describe('__transrateVNode', () => {
15251525
}
15261526
})
15271527
expect(
1528-
(composer as any)[TransrateVNodeSymbol]('hello', {
1528+
(composer as any)[TranslateVNodeSymbol]('hello', {
15291529
name: createVNode(Text, null, 'kazupon', 0)
15301530
})
15311531
).toMatchObject([
@@ -1543,7 +1543,7 @@ describe('__transrateVNode', () => {
15431543
}
15441544
})
15451545
expect(
1546-
(composer as any)[TransrateVNodeSymbol]('hello', {
1546+
(composer as any)[TranslateVNodeSymbol]('hello', {
15471547
name: createVNode(Text, null, 'kazupon', 0)
15481548
})
15491549
).toMatchSnapshot()

0 commit comments

Comments
 (0)