@@ -2,10 +2,11 @@ import {
2
2
createSimpleExpression ,
3
3
NodeTypes ,
4
4
isText ,
5
+ BindingTypes ,
5
6
createCompoundExpression ,
6
7
TO_DISPLAY_STRING
7
8
} from '@vue/compiler-dom'
8
- import { isNumber , isObject , isString , isSymbol , toDisplayString } from '@intlify/shared'
9
+ import { isNumber , isObject , isString , isSymbol , toDisplayString , hasOwn } from '@intlify/shared'
9
10
import { evaluateValue , parseVTExpression } from './transpiler'
10
11
import { report , ReportCodes } from './report'
11
12
import { createContentBuilder } from './builder'
@@ -367,7 +368,16 @@ function generateTranslationCode(
367
368
}
368
369
369
370
function generateComposableCode ( context : TransformContext , params : TranslationParams ) : string {
370
- const baseCode = `${ context . prefixIdentifiers ? '_ctx.' : '' } t`
371
+ const { prefixIdentifiers, bindingMetadata } = context
372
+ const functionName = 't'
373
+ const type = hasOwn ( bindingMetadata , functionName ) && bindingMetadata [ functionName ]
374
+ // prettier-ignore
375
+ const prefixContext = prefixIdentifiers
376
+ ? type && type . startsWith ( 'setup' ) || type === BindingTypes . LITERAL_CONST
377
+ ? '$setup.'
378
+ : '_ctx.'
379
+ : ''
380
+ const baseCode = `${ prefixContext } ${ functionName } `
371
381
372
382
const builder = createContentBuilder ( )
373
383
builder . push ( `${ baseCode } (` )
0 commit comments