@intlify/vue-i18n-extensions 6.0.5 → 6.0.6
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 +6 -2
- package/dist/index.mjs +6 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -205,11 +205,12 @@ function createContentBuilder(options = {}) {
|
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
const GLOBAL_TRANSLATE_SIGNATURE = "$t";
|
|
208
209
|
function transformVTDirective(options = {}) {
|
|
209
210
|
const i18nInstance = options.i18n;
|
|
210
211
|
const mode = shared.isString(options.mode) && ["composition", "legacy"].includes(options.mode) ? options.mode : "composition";
|
|
211
212
|
const translationSignatures = shared.isString(options.translationSignatures) ? [options.translationSignatures] : shared.isArray(options.translationSignatures) ? options.translationSignatures : ["t"];
|
|
212
|
-
translationSignatures.push(
|
|
213
|
+
translationSignatures.push(GLOBAL_TRANSLATE_SIGNATURE);
|
|
213
214
|
return (dir, node, context) => {
|
|
214
215
|
const { exp, loc } = dir;
|
|
215
216
|
if (!exp) {
|
|
@@ -393,8 +394,11 @@ function generateTranslationCode(context, mode, params, translationSignatures) {
|
|
|
393
394
|
return mode === "composition" ? generateComposableCode(context, params, translationSignatures) : generateLegacyCode(context, params);
|
|
394
395
|
}
|
|
395
396
|
function generateTranslationCallableSignatures(context, translationSignatures) {
|
|
396
|
-
const { prefixIdentifiers, bindingMetadata } = context;
|
|
397
|
+
const { prefixIdentifiers, bindingMetadata, inline } = context;
|
|
397
398
|
return translationSignatures.map((signature) => {
|
|
399
|
+
if (inline && signature !== GLOBAL_TRANSLATE_SIGNATURE) {
|
|
400
|
+
return signature;
|
|
401
|
+
}
|
|
398
402
|
const type = shared.hasOwn(bindingMetadata, signature) && bindingMetadata[signature];
|
|
399
403
|
const bindingContext = prefixIdentifiers ? type && type.startsWith("setup") || type === compilerDom.BindingTypes.LITERAL_CONST ? "$setup." : "_ctx." : "";
|
|
400
404
|
return `${bindingContext}${signature}`;
|
package/dist/index.mjs
CHANGED
|
@@ -203,11 +203,12 @@ function createContentBuilder(options = {}) {
|
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
const GLOBAL_TRANSLATE_SIGNATURE = "$t";
|
|
206
207
|
function transformVTDirective(options = {}) {
|
|
207
208
|
const i18nInstance = options.i18n;
|
|
208
209
|
const mode = isString(options.mode) && ["composition", "legacy"].includes(options.mode) ? options.mode : "composition";
|
|
209
210
|
const translationSignatures = isString(options.translationSignatures) ? [options.translationSignatures] : isArray(options.translationSignatures) ? options.translationSignatures : ["t"];
|
|
210
|
-
translationSignatures.push(
|
|
211
|
+
translationSignatures.push(GLOBAL_TRANSLATE_SIGNATURE);
|
|
211
212
|
return (dir, node, context) => {
|
|
212
213
|
const { exp, loc } = dir;
|
|
213
214
|
if (!exp) {
|
|
@@ -391,8 +392,11 @@ function generateTranslationCode(context, mode, params, translationSignatures) {
|
|
|
391
392
|
return mode === "composition" ? generateComposableCode(context, params, translationSignatures) : generateLegacyCode(context, params);
|
|
392
393
|
}
|
|
393
394
|
function generateTranslationCallableSignatures(context, translationSignatures) {
|
|
394
|
-
const { prefixIdentifiers, bindingMetadata } = context;
|
|
395
|
+
const { prefixIdentifiers, bindingMetadata, inline } = context;
|
|
395
396
|
return translationSignatures.map((signature) => {
|
|
397
|
+
if (inline && signature !== GLOBAL_TRANSLATE_SIGNATURE) {
|
|
398
|
+
return signature;
|
|
399
|
+
}
|
|
396
400
|
const type = hasOwn(bindingMetadata, signature) && bindingMetadata[signature];
|
|
397
401
|
const bindingContext = prefixIdentifiers ? type && type.startsWith("setup") || type === BindingTypes.LITERAL_CONST ? "$setup." : "_ctx." : "";
|
|
398
402
|
return `${bindingContext}${signature}`;
|