ztxkutils 2.10.66-15 → 2.10.66-16
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.js +1 -1
- package/dist/{request-ba8abf99.js → request-588c90ec.js} +92 -18
- package/dist/{request-0cc024b1.js → request-dc69f021.js} +68 -13
- package/dist/request.js +1 -1
- package/package.json +1 -1
- package/zti18n-cli/bin/index.js +3 -3
- package/zti18n-cli/index.js +23 -23
- package/zti18n-cli/src/command/convert.js +17 -17
- package/zti18n-cli/src/command/convert2.js +35 -35
- package/zti18n-cli/src/command/initFileConf.js +133 -133
- package/zti18n-cli/src/command/publish.js +24 -24
- package/zti18n-cli/src/conf/BaseConf.js +21 -21
- package/zti18n-cli/src/conf/FileConf.js +116 -116
- package/zti18n-cli/src/index.js +75 -75
- package/zti18n-cli/src/translate/google.js +6 -6
- package/zti18n-cli/src/utils/isChinese.js +3 -3
- package/zti18n-cli/src/utils/log.js +8 -8
- package/zti18n-cli/src/utils/mergeOptions.js +45 -45
- package/zti18n-cli/src/utils/reactOptions.js +73 -73
- package/zti18n-cli/src/utils/vueOptions.js +69 -69
- package/zti18n-core/index.js +1 -1
- package/zti18n-core/src/index.js +5 -5
- package/zti18n-core/src/plugin/reactIntlToReactIntlUniversal.js +224 -224
- package/zti18n-core/src/plugin/reactIntlUniversalToDi18n.js +64 -64
- package/zti18n-core/src/transform/defaultPkMap.js +79 -79
- package/zti18n-core/src/transform/transformHtml.js +271 -271
- package/zti18n-core/src/transform/transformPug.js +272 -272
- package/zti18n-core/src/transform/transformReactIntlToReactIntlUniversal.js +96 -96
- package/zti18n-core/src/transform/transformReactIntlUniveralToDi18n.js +90 -90
- package/zti18n-core/src/transform/transformToDi18n.js +22 -22
- package/zti18n-core/src/transform/transformTs.js +41 -41
- package/zti18n-core/src/transform/transformVue.js +126 -126
- package/zti18n-core/src/translate/google.js +6 -6
- package/zti18n-core/src/utils/constants.js +3 -3
- package/zti18n-core/src/utils/getIgnoreLines.js +14 -14
- package/zti18n-core/src/utils/isChinese.js +3 -3
- package/zti18n-core/src/utils/log.js +8 -8
- package/dist/authority-e6bde99f.js +0 -423
- package/dist/reqUrl-3792afcd.js +0 -82
- package/dist/reqUrl-787dd9e5.js +0 -82
- package/dist/request-ef290b9a.js +0 -2838
- package/dist/tools-09a4d620.js +0 -2445
- package/dist/tools-0ca888cd.js +0 -2473
- package/dist/validate-6e735536.js +0 -79
- package/dist/zti18n-cli/bin/index.d.ts +0 -2
- package/dist/zti18n-cli/index.d.ts +0 -1
- package/dist/zti18n-cli/src/command/collect.d.ts +0 -2
- package/dist/zti18n-cli/src/command/convert.d.ts +0 -2
- package/dist/zti18n-cli/src/command/convert2.d.ts +0 -2
- package/dist/zti18n-cli/src/command/initFileConf.d.ts +0 -2
- package/dist/zti18n-cli/src/command/publish.d.ts +0 -2
- package/dist/zti18n-cli/src/conf/BaseConf.d.ts +0 -8
- package/dist/zti18n-cli/src/conf/FileConf.d.ts +0 -6
- package/dist/zti18n-cli/src/index.d.ts +0 -1
- package/dist/zti18n-cli/src/translate/google.d.ts +0 -2
- package/dist/zti18n-cli/src/utils/isChinese.d.ts +0 -2
- package/dist/zti18n-cli/src/utils/log.d.ts +0 -4
- package/dist/zti18n-cli/src/utils/mergeOptions.d.ts +0 -24
- package/dist/zti18n-cli/src/utils/reactOptions.d.ts +0 -21
- package/dist/zti18n-cli/src/utils/vueOptions.d.ts +0 -17
- package/dist/zti18n-core/index.d.ts +0 -2
- package/dist/zti18n-core/src/index.d.ts +0 -8
- package/dist/zti18n-core/src/plugin/reactIntlToReactIntlUniversal.d.ts +0 -19
- package/dist/zti18n-core/src/plugin/reactIntlUniversalToDi18n.d.ts +0 -9
- package/dist/zti18n-core/src/transform/defaultPkMap.d.ts +0 -75
- package/dist/zti18n-core/src/transform/transformHtml.d.ts +0 -5
- package/dist/zti18n-core/src/transform/transformJs.d.ts +0 -5
- package/dist/zti18n-core/src/transform/transformPug.d.ts +0 -5
- package/dist/zti18n-core/src/transform/transformReactIntlToReactIntlUniversal.d.ts +0 -2
- package/dist/zti18n-core/src/transform/transformReactIntlUniveralToDi18n.d.ts +0 -2
- package/dist/zti18n-core/src/transform/transformToDi18n.d.ts +0 -5
- package/dist/zti18n-core/src/transform/transformTs.d.ts +0 -5
- package/dist/zti18n-core/src/transform/transformVue.d.ts +0 -5
- package/dist/zti18n-core/src/transform/transformZeroToDi18n.d.ts +0 -2
- package/dist/zti18n-core/src/translate/google.d.ts +0 -2
- package/dist/zti18n-core/src/utils/constants.d.ts +0 -3
- package/dist/zti18n-core/src/utils/getIgnoreLines.d.ts +0 -2
- package/dist/zti18n-core/src/utils/isChinese.d.ts +0 -2
- package/dist/zti18n-core/src/utils/log.d.ts +0 -4
package/zti18n-cli/src/index.js
CHANGED
@@ -1,75 +1,75 @@
|
|
1
|
-
const program = require('commander');
|
2
|
-
const convert = require('./command/convert');
|
3
|
-
const convert2 = require('./command/convert2');
|
4
|
-
const collect = require('./command/collect');
|
5
|
-
const publish = require('./command/publish');
|
6
|
-
const option = require('../../package.json');
|
7
|
-
|
8
|
-
module.exports = program;
|
9
|
-
|
10
|
-
program
|
11
|
-
.version(option.version)
|
12
|
-
.option(
|
13
|
-
'-c, --config <path>',
|
14
|
-
'set config path. defaults to ./i18n.config.js'
|
15
|
-
);
|
16
|
-
|
17
|
-
program
|
18
|
-
.command('sync')
|
19
|
-
.alias('s')
|
20
|
-
.description('pick chinese words and snyc with locale conf')
|
21
|
-
.option('-p, --publish', 'to publish the synced conf or not, defautl : false')
|
22
|
-
.action(function (options) {
|
23
|
-
collect(program.opts(), !!options.publish);
|
24
|
-
})
|
25
|
-
.on('--help', function () {
|
26
|
-
console.log(' Examples:');
|
27
|
-
console.log();
|
28
|
-
console.log(' sync without publish:');
|
29
|
-
console.log(' $ zti18n sync -c ./config/prod.config.js');
|
30
|
-
console.log(' sync and then publish:');
|
31
|
-
console.log(' $ zti18n sync -p -c ./config/prod.config.js');
|
32
|
-
console.log();
|
33
|
-
});
|
34
|
-
|
35
|
-
program
|
36
|
-
.command('publish')
|
37
|
-
.description('publish locale confs')
|
38
|
-
.action(function () {
|
39
|
-
publish(program.opts());
|
40
|
-
})
|
41
|
-
.on('--help', function () {
|
42
|
-
console.log(' Examples:');
|
43
|
-
console.log();
|
44
|
-
console.log(' $ zti18n publish');
|
45
|
-
console.log();
|
46
|
-
});
|
47
|
-
|
48
|
-
// XXX: 不表意,需要改一下
|
49
|
-
program
|
50
|
-
.command('convert')
|
51
|
-
.alias('c')
|
52
|
-
.description('convert to react-intl-universal')
|
53
|
-
.action(function () {
|
54
|
-
convert(program.opts());
|
55
|
-
})
|
56
|
-
.on('--help', function () {
|
57
|
-
console.log(' Examples:');
|
58
|
-
console.log();
|
59
|
-
console.log(' $ zti18n convert -c ./config/prod.config.js');
|
60
|
-
console.log();
|
61
|
-
});
|
62
|
-
|
63
|
-
program
|
64
|
-
.command('convert2')
|
65
|
-
.alias('c2')
|
66
|
-
.description('convert to intl.t')
|
67
|
-
.action(function () {
|
68
|
-
convert2(program.opts());
|
69
|
-
})
|
70
|
-
.on('--help', function () {
|
71
|
-
console.log(' Examples:');
|
72
|
-
console.log();
|
73
|
-
console.log(' $ zti18n convert2 -c ./config/prod.config.js');
|
74
|
-
console.log();
|
75
|
-
});
|
1
|
+
const program = require('commander');
|
2
|
+
const convert = require('./command/convert');
|
3
|
+
const convert2 = require('./command/convert2');
|
4
|
+
const collect = require('./command/collect');
|
5
|
+
const publish = require('./command/publish');
|
6
|
+
const option = require('../../package.json');
|
7
|
+
|
8
|
+
module.exports = program;
|
9
|
+
|
10
|
+
program
|
11
|
+
.version(option.version)
|
12
|
+
.option(
|
13
|
+
'-c, --config <path>',
|
14
|
+
'set config path. defaults to ./i18n.config.js'
|
15
|
+
);
|
16
|
+
|
17
|
+
program
|
18
|
+
.command('sync')
|
19
|
+
.alias('s')
|
20
|
+
.description('pick chinese words and snyc with locale conf')
|
21
|
+
.option('-p, --publish', 'to publish the synced conf or not, defautl : false')
|
22
|
+
.action(function (options) {
|
23
|
+
collect(program.opts(), !!options.publish);
|
24
|
+
})
|
25
|
+
.on('--help', function () {
|
26
|
+
console.log(' Examples:');
|
27
|
+
console.log();
|
28
|
+
console.log(' sync without publish:');
|
29
|
+
console.log(' $ zti18n sync -c ./config/prod.config.js');
|
30
|
+
console.log(' sync and then publish:');
|
31
|
+
console.log(' $ zti18n sync -p -c ./config/prod.config.js');
|
32
|
+
console.log();
|
33
|
+
});
|
34
|
+
|
35
|
+
program
|
36
|
+
.command('publish')
|
37
|
+
.description('publish locale confs')
|
38
|
+
.action(function () {
|
39
|
+
publish(program.opts());
|
40
|
+
})
|
41
|
+
.on('--help', function () {
|
42
|
+
console.log(' Examples:');
|
43
|
+
console.log();
|
44
|
+
console.log(' $ zti18n publish');
|
45
|
+
console.log();
|
46
|
+
});
|
47
|
+
|
48
|
+
// XXX: 不表意,需要改一下
|
49
|
+
program
|
50
|
+
.command('convert')
|
51
|
+
.alias('c')
|
52
|
+
.description('convert to react-intl-universal')
|
53
|
+
.action(function () {
|
54
|
+
convert(program.opts());
|
55
|
+
})
|
56
|
+
.on('--help', function () {
|
57
|
+
console.log(' Examples:');
|
58
|
+
console.log();
|
59
|
+
console.log(' $ zti18n convert -c ./config/prod.config.js');
|
60
|
+
console.log();
|
61
|
+
});
|
62
|
+
|
63
|
+
program
|
64
|
+
.command('convert2')
|
65
|
+
.alias('c2')
|
66
|
+
.description('convert to intl.t')
|
67
|
+
.action(function () {
|
68
|
+
convert2(program.opts());
|
69
|
+
})
|
70
|
+
.on('--help', function () {
|
71
|
+
console.log(' Examples:');
|
72
|
+
console.log();
|
73
|
+
console.log(' $ zti18n convert2 -c ./config/prod.config.js');
|
74
|
+
console.log();
|
75
|
+
});
|
@@ -1,6 +1,6 @@
|
|
1
|
-
// https://github.com/matheuss/google-translate-api/issues/79#issuecomment-427841889
|
2
|
-
const googleTranslate = require('@vitalets/google-translate-api');
|
3
|
-
|
4
|
-
module.exports = function translateByGoogle(text, targetLang) {
|
5
|
-
return googleTranslate(text, { client: 'gtx', to: targetLang });
|
6
|
-
};
|
1
|
+
// https://github.com/matheuss/google-translate-api/issues/79#issuecomment-427841889
|
2
|
+
const googleTranslate = require('@vitalets/google-translate-api');
|
3
|
+
|
4
|
+
module.exports = function translateByGoogle(text, targetLang) {
|
5
|
+
return googleTranslate(text, { client: 'gtx', to: targetLang });
|
6
|
+
};
|
@@ -1,3 +1,3 @@
|
|
1
|
-
module.exports = function isChinese(text) {
|
2
|
-
return /[\u4e00-\u9fa5]/.test(text);
|
3
|
-
};
|
1
|
+
module.exports = function isChinese(text) {
|
2
|
+
return /[\u4e00-\u9fa5]/.test(text);
|
3
|
+
};
|
@@ -1,8 +1,8 @@
|
|
1
|
-
const chalk = require('chalk');
|
2
|
-
|
3
|
-
module.exports = {
|
4
|
-
info: (msg) => console.log(chalk.cyan(msg)),
|
5
|
-
warning: (msg) => console.log(chalk.yellow(msg)),
|
6
|
-
success: (msg) => console.log(chalk.green(msg)),
|
7
|
-
error: (msg) => console.log(chalk.red(msg)),
|
8
|
-
};
|
1
|
+
const chalk = require('chalk');
|
2
|
+
|
3
|
+
module.exports = {
|
4
|
+
info: (msg) => console.log(chalk.cyan(msg)),
|
5
|
+
warning: (msg) => console.log(chalk.yellow(msg)),
|
6
|
+
success: (msg) => console.log(chalk.green(msg)),
|
7
|
+
error: (msg) => console.log(chalk.red(msg)),
|
8
|
+
};
|
@@ -1,45 +1,45 @@
|
|
1
|
-
const fs = require('fs');
|
2
|
-
const path = require('path');
|
3
|
-
const defaultOptions = require('./reactOptions');
|
4
|
-
const log = require('./log');
|
5
|
-
|
6
|
-
const cwdPath = process.cwd();
|
7
|
-
|
8
|
-
module.exports = function mergeOptions(programOption, programParameter) {
|
9
|
-
const options = defaultOptions;
|
10
|
-
const configFileName = programOption.config || 'zti18n.config.js';
|
11
|
-
|
12
|
-
const configFilePath = path.join(cwdPath, configFileName);
|
13
|
-
|
14
|
-
// 读取 zti18n-ast.config.js 中设置的参数,然后并入 options
|
15
|
-
if (fs.existsSync(configFilePath)) {
|
16
|
-
let configurationFile = {};
|
17
|
-
try {
|
18
|
-
configurationFile = require(configFilePath);
|
19
|
-
} catch (err) {
|
20
|
-
log.error(`请检查 ${configFileName} 配置文件是否正确\n`);
|
21
|
-
}
|
22
|
-
|
23
|
-
Object.assign(options, configurationFile);
|
24
|
-
} else {
|
25
|
-
log.error(`配置文件 ${configFileName} 不存在\n`);
|
26
|
-
}
|
27
|
-
|
28
|
-
if (!Object.keys(programOption).length) {
|
29
|
-
return options;
|
30
|
-
}
|
31
|
-
|
32
|
-
// 处理命令行参数
|
33
|
-
programParameter.forEach((k) => {
|
34
|
-
const value = programOption[k];
|
35
|
-
if (value) {
|
36
|
-
if (k === 'exclude' && typeof value === 'string') {
|
37
|
-
options[k] = value.split(',');
|
38
|
-
} else {
|
39
|
-
options[k] = value;
|
40
|
-
}
|
41
|
-
}
|
42
|
-
});
|
43
|
-
|
44
|
-
return options;
|
45
|
-
};
|
1
|
+
const fs = require('fs');
|
2
|
+
const path = require('path');
|
3
|
+
const defaultOptions = require('./reactOptions');
|
4
|
+
const log = require('./log');
|
5
|
+
|
6
|
+
const cwdPath = process.cwd();
|
7
|
+
|
8
|
+
module.exports = function mergeOptions(programOption, programParameter) {
|
9
|
+
const options = defaultOptions;
|
10
|
+
const configFileName = programOption.config || 'zti18n.config.js';
|
11
|
+
|
12
|
+
const configFilePath = path.join(cwdPath, configFileName);
|
13
|
+
|
14
|
+
// 读取 zti18n-ast.config.js 中设置的参数,然后并入 options
|
15
|
+
if (fs.existsSync(configFilePath)) {
|
16
|
+
let configurationFile = {};
|
17
|
+
try {
|
18
|
+
configurationFile = require(configFilePath);
|
19
|
+
} catch (err) {
|
20
|
+
log.error(`请检查 ${configFileName} 配置文件是否正确\n`);
|
21
|
+
}
|
22
|
+
|
23
|
+
Object.assign(options, configurationFile);
|
24
|
+
} else {
|
25
|
+
log.error(`配置文件 ${configFileName} 不存在\n`);
|
26
|
+
}
|
27
|
+
|
28
|
+
if (!Object.keys(programOption).length) {
|
29
|
+
return options;
|
30
|
+
}
|
31
|
+
|
32
|
+
// 处理命令行参数
|
33
|
+
programParameter.forEach((k) => {
|
34
|
+
const value = programOption[k];
|
35
|
+
if (value) {
|
36
|
+
if (k === 'exclude' && typeof value === 'string') {
|
37
|
+
options[k] = value.split(',');
|
38
|
+
} else {
|
39
|
+
options[k] = value;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
});
|
43
|
+
|
44
|
+
return options;
|
45
|
+
};
|
@@ -1,73 +1,73 @@
|
|
1
|
-
// default options
|
2
|
-
module.exports = {
|
3
|
-
// source path, <string array>
|
4
|
-
// e.g. ['src']
|
5
|
-
entry: ['src'],
|
6
|
-
|
7
|
-
// exclude pattern, <string array>
|
8
|
-
// e.g. ['**/dist/**', '**/*.config.js', '**/*.data.js']
|
9
|
-
exclude: [],
|
10
|
-
|
11
|
-
// output path, <string array>
|
12
|
-
// e.g. ['dist']
|
13
|
-
output: ['src'], // default i18n in place
|
14
|
-
|
15
|
-
// auto translate flag, <boolean>
|
16
|
-
// e.g. true
|
17
|
-
disableAutoTranslate: true,
|
18
|
-
|
19
|
-
// only extract locales, not touch source code, <boolean>
|
20
|
-
// e.g. true
|
21
|
-
extractOnly: false,
|
22
|
-
|
23
|
-
// translator, <null | string>
|
24
|
-
// null: default google translator
|
25
|
-
// e.g. ../translate/google.js
|
26
|
-
translator: null,
|
27
|
-
|
28
|
-
// ignored components, <string array>
|
29
|
-
// e.g. ['EventTracker']
|
30
|
-
ignoreComponents: [],
|
31
|
-
|
32
|
-
// ignored methods, <string array>
|
33
|
-
// e.g. ['MirrorTrack']
|
34
|
-
ignoreMethods: [],
|
35
|
-
|
36
|
-
// XXX: json loose
|
37
|
-
// primaryRegx: /[\u4e00-\u9fa5]/,
|
38
|
-
|
39
|
-
// primary locale, <string>
|
40
|
-
// e.g. 'zh-CN'
|
41
|
-
primaryLocale: 'zh-CN',
|
42
|
-
|
43
|
-
// supported locales, <string array>
|
44
|
-
// e.g. ['zh-CN', 'en-US']
|
45
|
-
supportedLocales: ['zh-CN', 'en-US'],
|
46
|
-
|
47
|
-
// import codes, <string>
|
48
|
-
importCode: "import { intl } from 'di18n-react';",
|
49
|
-
|
50
|
-
// i18n object, <string>
|
51
|
-
// e.g. 'intl'
|
52
|
-
i18nObject: 'intl',
|
53
|
-
|
54
|
-
// i18n method, <string>
|
55
|
-
// e.g. 't'
|
56
|
-
i18nMethod: 't',
|
57
|
-
|
58
|
-
// prettier conf, <null | object>
|
59
|
-
// e.g. {}
|
60
|
-
prettier: {
|
61
|
-
singleQuote: true,
|
62
|
-
trailingComma: 'es5',
|
63
|
-
endOfLine: 'lf',
|
64
|
-
},
|
65
|
-
|
66
|
-
// i18n saving conf, <object>
|
67
|
-
// if localeConf.type !== 'file', localeConf.path is required
|
68
|
-
// e.g. { type: 'apollo', path: '../conf/ApolloConf.js', ... }
|
69
|
-
localeConf: {
|
70
|
-
type: 'file',
|
71
|
-
// others...
|
72
|
-
},
|
73
|
-
};
|
1
|
+
// default options
|
2
|
+
module.exports = {
|
3
|
+
// source path, <string array>
|
4
|
+
// e.g. ['src']
|
5
|
+
entry: ['src'],
|
6
|
+
|
7
|
+
// exclude pattern, <string array>
|
8
|
+
// e.g. ['**/dist/**', '**/*.config.js', '**/*.data.js']
|
9
|
+
exclude: [],
|
10
|
+
|
11
|
+
// output path, <string array>
|
12
|
+
// e.g. ['dist']
|
13
|
+
output: ['src'], // default i18n in place
|
14
|
+
|
15
|
+
// auto translate flag, <boolean>
|
16
|
+
// e.g. true
|
17
|
+
disableAutoTranslate: true,
|
18
|
+
|
19
|
+
// only extract locales, not touch source code, <boolean>
|
20
|
+
// e.g. true
|
21
|
+
extractOnly: false,
|
22
|
+
|
23
|
+
// translator, <null | string>
|
24
|
+
// null: default google translator
|
25
|
+
// e.g. ../translate/google.js
|
26
|
+
translator: null,
|
27
|
+
|
28
|
+
// ignored components, <string array>
|
29
|
+
// e.g. ['EventTracker']
|
30
|
+
ignoreComponents: [],
|
31
|
+
|
32
|
+
// ignored methods, <string array>
|
33
|
+
// e.g. ['MirrorTrack']
|
34
|
+
ignoreMethods: [],
|
35
|
+
|
36
|
+
// XXX: json loose
|
37
|
+
// primaryRegx: /[\u4e00-\u9fa5]/,
|
38
|
+
|
39
|
+
// primary locale, <string>
|
40
|
+
// e.g. 'zh-CN'
|
41
|
+
primaryLocale: 'zh-CN',
|
42
|
+
|
43
|
+
// supported locales, <string array>
|
44
|
+
// e.g. ['zh-CN', 'en-US']
|
45
|
+
supportedLocales: ['zh-CN', 'en-US'],
|
46
|
+
|
47
|
+
// import codes, <string>
|
48
|
+
importCode: "import { intl } from 'di18n-react';",
|
49
|
+
|
50
|
+
// i18n object, <string>
|
51
|
+
// e.g. 'intl'
|
52
|
+
i18nObject: 'intl',
|
53
|
+
|
54
|
+
// i18n method, <string>
|
55
|
+
// e.g. 't'
|
56
|
+
i18nMethod: 't',
|
57
|
+
|
58
|
+
// prettier conf, <null | object>
|
59
|
+
// e.g. {}
|
60
|
+
prettier: {
|
61
|
+
singleQuote: true,
|
62
|
+
trailingComma: 'es5',
|
63
|
+
endOfLine: 'lf',
|
64
|
+
},
|
65
|
+
|
66
|
+
// i18n saving conf, <object>
|
67
|
+
// if localeConf.type !== 'file', localeConf.path is required
|
68
|
+
// e.g. { type: 'apollo', path: '../conf/ApolloConf.js', ... }
|
69
|
+
localeConf: {
|
70
|
+
type: 'file',
|
71
|
+
// others...
|
72
|
+
},
|
73
|
+
};
|
@@ -1,69 +1,69 @@
|
|
1
|
-
// default options
|
2
|
-
module.exports = {
|
3
|
-
// source path, <string array>
|
4
|
-
// e.g. ['src']
|
5
|
-
entry: ['src'],
|
6
|
-
|
7
|
-
// exclude pattern, <string array>
|
8
|
-
// e.g. ['**/dist/**', '**/*.config.js', '**/*.data.js']
|
9
|
-
exclude: [],
|
10
|
-
|
11
|
-
// output path, <string array>
|
12
|
-
// e.g. ['dist']
|
13
|
-
output: ['src'], // default i18n in place
|
14
|
-
|
15
|
-
// auto translate flag, <boolean>
|
16
|
-
// e.g. true
|
17
|
-
disableAutoTranslate: true,
|
18
|
-
|
19
|
-
// only extract locales, not touch source code, <boolean>
|
20
|
-
// e.g. true
|
21
|
-
extractOnly: false,
|
22
|
-
|
23
|
-
// translator, <null | string>
|
24
|
-
// null: default google translator
|
25
|
-
// e.g. ../translate/google.js
|
26
|
-
translator: null,
|
27
|
-
|
28
|
-
// ignored components, <string array>
|
29
|
-
// e.g. ['EventTracker']
|
30
|
-
ignoreComponents: [],
|
31
|
-
|
32
|
-
// ignored methods, <string array>
|
33
|
-
// e.g. ['MirrorTrack']
|
34
|
-
ignoreMethods: [],
|
35
|
-
|
36
|
-
// XXX: json loose
|
37
|
-
// primaryRegx: /[\u4e00-\u9fa5]/,
|
38
|
-
|
39
|
-
// primary locale, <string>
|
40
|
-
// e.g. 'zh-CN'
|
41
|
-
primaryLocale: 'zh-CN',
|
42
|
-
|
43
|
-
// supported locales, <string array>
|
44
|
-
// e.g. ['zh-CN', 'en-US']
|
45
|
-
supportedLocales: ['zh-CN', 'en-US'],
|
46
|
-
|
47
|
-
// import codes, <string>
|
48
|
-
importCode: "import { intl } from 'di18n-vue';",
|
49
|
-
|
50
|
-
// i18n object, <string>
|
51
|
-
// e.g. 'intl'
|
52
|
-
i18nObject: 'intl',
|
53
|
-
|
54
|
-
// i18n method, <string>
|
55
|
-
// e.g. '$t'
|
56
|
-
i18nMethod: '$t',
|
57
|
-
|
58
|
-
// prettier conf, <null | object>
|
59
|
-
// e.g. {}
|
60
|
-
prettier: null,
|
61
|
-
|
62
|
-
// i18n saving conf, <object>
|
63
|
-
// if localeConf.type !== 'file', localeConf.path is required
|
64
|
-
// e.g. { type: 'apollo', path: '../conf/ApolloConf.js', ... }
|
65
|
-
localeConf: {
|
66
|
-
type: 'file',
|
67
|
-
// others...
|
68
|
-
},
|
69
|
-
};
|
1
|
+
// default options
|
2
|
+
module.exports = {
|
3
|
+
// source path, <string array>
|
4
|
+
// e.g. ['src']
|
5
|
+
entry: ['src'],
|
6
|
+
|
7
|
+
// exclude pattern, <string array>
|
8
|
+
// e.g. ['**/dist/**', '**/*.config.js', '**/*.data.js']
|
9
|
+
exclude: [],
|
10
|
+
|
11
|
+
// output path, <string array>
|
12
|
+
// e.g. ['dist']
|
13
|
+
output: ['src'], // default i18n in place
|
14
|
+
|
15
|
+
// auto translate flag, <boolean>
|
16
|
+
// e.g. true
|
17
|
+
disableAutoTranslate: true,
|
18
|
+
|
19
|
+
// only extract locales, not touch source code, <boolean>
|
20
|
+
// e.g. true
|
21
|
+
extractOnly: false,
|
22
|
+
|
23
|
+
// translator, <null | string>
|
24
|
+
// null: default google translator
|
25
|
+
// e.g. ../translate/google.js
|
26
|
+
translator: null,
|
27
|
+
|
28
|
+
// ignored components, <string array>
|
29
|
+
// e.g. ['EventTracker']
|
30
|
+
ignoreComponents: [],
|
31
|
+
|
32
|
+
// ignored methods, <string array>
|
33
|
+
// e.g. ['MirrorTrack']
|
34
|
+
ignoreMethods: [],
|
35
|
+
|
36
|
+
// XXX: json loose
|
37
|
+
// primaryRegx: /[\u4e00-\u9fa5]/,
|
38
|
+
|
39
|
+
// primary locale, <string>
|
40
|
+
// e.g. 'zh-CN'
|
41
|
+
primaryLocale: 'zh-CN',
|
42
|
+
|
43
|
+
// supported locales, <string array>
|
44
|
+
// e.g. ['zh-CN', 'en-US']
|
45
|
+
supportedLocales: ['zh-CN', 'en-US'],
|
46
|
+
|
47
|
+
// import codes, <string>
|
48
|
+
importCode: "import { intl } from 'di18n-vue';",
|
49
|
+
|
50
|
+
// i18n object, <string>
|
51
|
+
// e.g. 'intl'
|
52
|
+
i18nObject: 'intl',
|
53
|
+
|
54
|
+
// i18n method, <string>
|
55
|
+
// e.g. '$t'
|
56
|
+
i18nMethod: '$t',
|
57
|
+
|
58
|
+
// prettier conf, <null | object>
|
59
|
+
// e.g. {}
|
60
|
+
prettier: null,
|
61
|
+
|
62
|
+
// i18n saving conf, <object>
|
63
|
+
// if localeConf.type !== 'file', localeConf.path is required
|
64
|
+
// e.g. { type: 'apollo', path: '../conf/ApolloConf.js', ... }
|
65
|
+
localeConf: {
|
66
|
+
type: 'file',
|
67
|
+
// others...
|
68
|
+
},
|
69
|
+
};
|
package/zti18n-core/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
module.exports = require('./src');
|
1
|
+
module.exports = require('./src');
|
package/zti18n-core/src/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
exports.transformReactIntlToReactIntlUniversal = require('./transform/transformReactIntlToReactIntlUniversal');
|
2
|
-
exports.transformReactIntlUniveralToDi18n = require('./transform/transformReactIntlUniveralToDi18n');
|
3
|
-
exports.transformZeroToDi18n = require('./transform/transformZeroToDi18n');
|
4
|
-
exports.transformToDi18n = require('./transform/transformToDi18n');
|
5
|
-
exports.googleTranslate = require('./translate/google');
|
1
|
+
exports.transformReactIntlToReactIntlUniversal = require('./transform/transformReactIntlToReactIntlUniversal');
|
2
|
+
exports.transformReactIntlUniveralToDi18n = require('./transform/transformReactIntlUniveralToDi18n');
|
3
|
+
exports.transformZeroToDi18n = require('./transform/transformZeroToDi18n');
|
4
|
+
exports.transformToDi18n = require('./transform/transformToDi18n');
|
5
|
+
exports.googleTranslate = require('./translate/google');
|