@intlify/vue-i18n-extensions 6.1.1 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +12 -9
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +12 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -394,18 +394,21 @@ function generateTranslationCode(context, mode, params, translationSignatures) {
|
|
|
394
394
|
return mode === "composition" ? generateComposableCode(context, params, translationSignatures) : generateLegacyCode(context, params);
|
|
395
395
|
}
|
|
396
396
|
function generateTranslationCallableSignatures(context, translationSignatures) {
|
|
397
|
-
const
|
|
397
|
+
const baseResolver = (context2, signature) => {
|
|
398
|
+
const { prefixIdentifiers, bindingMetadata, inline } = context2;
|
|
399
|
+
if (inline && signature !== GLOBAL_TRANSLATE_SIGNATURE) {
|
|
400
|
+
return signature;
|
|
401
|
+
}
|
|
402
|
+
const type = shared.hasOwn(bindingMetadata, signature) && bindingMetadata[signature];
|
|
403
|
+
const bindingContext = prefixIdentifiers ? type && type.startsWith("setup") || type === compilerDom.BindingTypes.LITERAL_CONST ? "$setup." : "_ctx." : "";
|
|
404
|
+
return `${bindingContext}${signature}`;
|
|
405
|
+
};
|
|
398
406
|
return translationSignatures.map((signatureOrResolver) => {
|
|
399
407
|
if (shared.isFunction(signatureOrResolver)) {
|
|
400
|
-
return signatureOrResolver(context);
|
|
408
|
+
return signatureOrResolver(context, baseResolver);
|
|
401
409
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
}
|
|
405
|
-
const type = shared.hasOwn(bindingMetadata, signatureOrResolver) && bindingMetadata[signatureOrResolver];
|
|
406
|
-
const bindingContext = prefixIdentifiers ? type && type.startsWith("setup") || type === compilerDom.BindingTypes.LITERAL_CONST ? "$setup." : "_ctx." : "";
|
|
407
|
-
return `${bindingContext}${signatureOrResolver}`;
|
|
408
|
-
}).join(" || ");
|
|
410
|
+
return baseResolver(context, signatureOrResolver);
|
|
411
|
+
}).filter(Boolean).join(" || ");
|
|
409
412
|
}
|
|
410
413
|
function generateComposableCode(context, params, translationSignatures) {
|
|
411
414
|
const baseCode = `(${generateTranslationCallableSignatures(context, translationSignatures)})`;
|
package/dist/index.d.cts
CHANGED
|
@@ -36,7 +36,7 @@ import { I18n, I18nMode } from 'vue-i18n';
|
|
|
36
36
|
* })
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
type TranslationSignatureResolver = (context: TransformContext) => string;
|
|
39
|
+
type TranslationSignatureResolver = (context: TransformContext, baseResolver: (context: TransformContext, signature: string) => string | undefined) => string | undefined;
|
|
40
40
|
/**
|
|
41
41
|
* Transform options for `v-t` custom directive
|
|
42
42
|
*
|
package/dist/index.d.mts
CHANGED
|
@@ -36,7 +36,7 @@ import { I18n, I18nMode } from 'vue-i18n';
|
|
|
36
36
|
* })
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
type TranslationSignatureResolver = (context: TransformContext) => string;
|
|
39
|
+
type TranslationSignatureResolver = (context: TransformContext, baseResolver: (context: TransformContext, signature: string) => string | undefined) => string | undefined;
|
|
40
40
|
/**
|
|
41
41
|
* Transform options for `v-t` custom directive
|
|
42
42
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ import { I18n, I18nMode } from 'vue-i18n';
|
|
|
36
36
|
* })
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
type TranslationSignatureResolver = (context: TransformContext) => string;
|
|
39
|
+
type TranslationSignatureResolver = (context: TransformContext, baseResolver: (context: TransformContext, signature: string) => string | undefined) => string | undefined;
|
|
40
40
|
/**
|
|
41
41
|
* Transform options for `v-t` custom directive
|
|
42
42
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -392,18 +392,21 @@ function generateTranslationCode(context, mode, params, translationSignatures) {
|
|
|
392
392
|
return mode === "composition" ? generateComposableCode(context, params, translationSignatures) : generateLegacyCode(context, params);
|
|
393
393
|
}
|
|
394
394
|
function generateTranslationCallableSignatures(context, translationSignatures) {
|
|
395
|
-
const
|
|
395
|
+
const baseResolver = (context2, signature) => {
|
|
396
|
+
const { prefixIdentifiers, bindingMetadata, inline } = context2;
|
|
397
|
+
if (inline && signature !== GLOBAL_TRANSLATE_SIGNATURE) {
|
|
398
|
+
return signature;
|
|
399
|
+
}
|
|
400
|
+
const type = hasOwn(bindingMetadata, signature) && bindingMetadata[signature];
|
|
401
|
+
const bindingContext = prefixIdentifiers ? type && type.startsWith("setup") || type === BindingTypes.LITERAL_CONST ? "$setup." : "_ctx." : "";
|
|
402
|
+
return `${bindingContext}${signature}`;
|
|
403
|
+
};
|
|
396
404
|
return translationSignatures.map((signatureOrResolver) => {
|
|
397
405
|
if (isFunction(signatureOrResolver)) {
|
|
398
|
-
return signatureOrResolver(context);
|
|
406
|
+
return signatureOrResolver(context, baseResolver);
|
|
399
407
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}
|
|
403
|
-
const type = hasOwn(bindingMetadata, signatureOrResolver) && bindingMetadata[signatureOrResolver];
|
|
404
|
-
const bindingContext = prefixIdentifiers ? type && type.startsWith("setup") || type === BindingTypes.LITERAL_CONST ? "$setup." : "_ctx." : "";
|
|
405
|
-
return `${bindingContext}${signatureOrResolver}`;
|
|
406
|
-
}).join(" || ");
|
|
408
|
+
return baseResolver(context, signatureOrResolver);
|
|
409
|
+
}).filter(Boolean).join(" || ");
|
|
407
410
|
}
|
|
408
411
|
function generateComposableCode(context, params, translationSignatures) {
|
|
409
412
|
const baseCode = `(${generateTranslationCallableSignatures(context, translationSignatures)})`;
|