File size: 746 Bytes
7d73cf2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateLegacyCode = void 0;
const shared_1 = require("@intlify/shared");
function generateLegacyCode({ isGlobal }, generator) {
    // prettier-ignore
    const componentNamespace = `Component.options`;
    const variableName = !isGlobal ? '__i18n' : '__i18nGlobal';
    const exportSyntax = 'export default';
    const code = `${exportSyntax} function (Component) {
  ${componentNamespace}.${variableName} = ${componentNamespace}.${variableName} || []
  ${componentNamespace}.${variableName}.push(${(0, shared_1.friendlyJSONstringify)(generator())})
  delete ${componentNamespace}._Ctor
}`;
    return code;
}
exports.generateLegacyCode = generateLegacyCode;