Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct typo in TranslateVNodeSymbol #1236

Merged
merged 1 commit into from
Nov 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/vue-i18n-core/src/components/Translation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { h } from 'vue'
import { isNumber, isString, isObject } from '@intlify/shared'
import { TransrateVNodeSymbol } from '../symbols'
import { TranslateVNodeSymbol } from '../symbols'
import { useI18n } from '../i18n'
import { baseFormatProps } from './base'
import { assign } from '@intlify/shared'
Expand Down Expand Up @@ -118,7 +118,7 @@ export const Translation = /* #__PURE__*/ /* defineComponent */ {
}
const arg = getInterpolateArg(context, keys)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const children = (i18n as any)[TransrateVNodeSymbol](
const children = (i18n as any)[TranslateVNodeSymbol](
props.keypath,
arg,
options
Expand Down
12 changes: 6 additions & 6 deletions packages/vue-i18n-core/src/composer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { VueDevToolsTimelineEvents } from '@intlify/vue-devtools'
import { I18nWarnCodes, getWarnMessage } from './warnings'
import { I18nErrorCodes, createI18nError } from './errors'
import {
TransrateVNodeSymbol,
TranslateVNodeSymbol,
DatetimePartsSymbol,
NumberPartsSymbol,
EnableEmitter,
Expand Down Expand Up @@ -1683,7 +1683,7 @@ export interface Composer<
* @internal
*/
export interface ComposerInternal {
__transrateVNode(...args: unknown[]): VNodeArrayChildren
__translateVNode(...args: unknown[]): VNodeArrayChildren
__numberParts(...args: unknown[]): string | Intl.NumberFormatPart[]
__datetimeParts(...args: unknown[]): string | Intl.DateTimeFormatPart[]
__enableEmitter?: (emitter: VueDevToolsEmitter) => void
Expand Down Expand Up @@ -2188,8 +2188,8 @@ export function createComposer(options: any = {}, VueI18nLegacy?: any): any {
type: 'vnode'
} as MessageProcessor<VNode>

// transrateVNode, using for `i18n-t` component
function transrateVNode(...args: unknown[]): VNodeArrayChildren {
// translateVNode, using for `i18n-t` component
function translateVNode(...args: unknown[]): VNodeArrayChildren {
return wrapWithDeps<VNode, VNodeArrayChildren>(
context => {
let ret: unknown
Expand All @@ -2208,7 +2208,7 @@ export function createComposer(options: any = {}, VueI18nLegacy?: any): any {
() => parseTranslateArgs(...args),
'translate',
// eslint-disable-next-line @typescript-eslint/no-explicit-any
root => (root as any)[TransrateVNodeSymbol](...args),
root => (root as any)[TranslateVNodeSymbol](...args),
key => [createTextNode(key as string)],
val => isArray(val)
)
Expand Down Expand Up @@ -2504,7 +2504,7 @@ export function createComposer(options: any = {}, VueI18nLegacy?: any): any {
;(composer as any).setNumberFormat = setNumberFormat
;(composer as any).mergeNumberFormat = mergeNumberFormat
;(composer as any)[InejctWithOption] = options.__injectWithOption
;(composer as any)[TransrateVNodeSymbol] = transrateVNode
;(composer as any)[TranslateVNodeSymbol] = translateVNode
;(composer as any)[DatetimePartsSymbol] = datetimeParts
;(composer as any)[NumberPartsSymbol] = numberParts
}
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-i18n-core/src/symbols.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { makeSymbol } from '@intlify/shared'

export const TransrateVNodeSymbol =
/* #__PURE__*/ makeSymbol('__transrateVNode')
export const TranslateVNodeSymbol =
/* #__PURE__*/ makeSymbol('__translateVNode')
export const DatetimePartsSymbol = /* #__PURE__*/ makeSymbol('__datetimeParts')
export const NumberPartsSymbol = /* #__PURE__*/ makeSymbol('__numberParts')
export const EnableEmitter = /* #__PURE__*/ makeSymbol('__enableEmitter')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`__transrateVNode missing 1`] = `
exports[`__translateVNode missing 1`] = `
Array [
Object {
"__v_isVNode": true,
Expand Down
8 changes: 4 additions & 4 deletions packages/vue-i18n-core/test/composer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
VueMessageType
} from '../src/composer'
import {
TransrateVNodeSymbol,
TranslateVNodeSymbol,
NumberPartsSymbol,
DatetimePartsSymbol
} from '../src/symbols'
Expand Down Expand Up @@ -1514,7 +1514,7 @@ describe('__i18n', () => {
})
})

describe('__transrateVNode', () => {
describe('__translateVNode', () => {
test('basic', () => {
const composer = createComposer({
locale: 'en',
Expand All @@ -1525,7 +1525,7 @@ describe('__transrateVNode', () => {
}
})
expect(
(composer as any)[TransrateVNodeSymbol]('hello', {
(composer as any)[TranslateVNodeSymbol]('hello', {
name: createVNode(Text, null, 'kazupon', 0)
})
).toMatchObject([
Expand All @@ -1543,7 +1543,7 @@ describe('__transrateVNode', () => {
}
})
expect(
(composer as any)[TransrateVNodeSymbol]('hello', {
(composer as any)[TranslateVNodeSymbol]('hello', {
name: createVNode(Text, null, 'kazupon', 0)
})
).toMatchSnapshot()
Expand Down