eshare-locale-bin
Advanced tools
Comparing version 1.1.3 to 2.0.0
13
index.js
@@ -10,3 +10,3 @@ #!/usr/bin/env node | ||
const { exit } = require('process') | ||
const { generateAndroid, generateWindowsV2, generateIOS } = require('./main') | ||
const { generateAndroid, generateWindowsV2, generateIOS,generateWeb } = require('./main') | ||
@@ -28,3 +28,3 @@ const packageStr = fs.readFileSync(path.join(__dirname, './package.json'), 'utf-8') | ||
type: 'list', | ||
choices: ['windows', 'ios','mac', 'android', 'android-ctrl'], | ||
choices: ['windows', 'ios', 'mac', 'android', 'web'], | ||
name: 'terminal', | ||
@@ -46,6 +46,7 @@ message: chalk.blue('请选择输出语言包的类型 :') | ||
case 'windows': return generateWindowsV2(data); | ||
case 'ios': return generateIOS(data, 5); | ||
case 'mac': return generateIOS(data, 6); | ||
case 'android': return generateAndroid(data, 7); | ||
case 'android-ctrl': return generateAndroid(data, 8); | ||
case 'ios': return generateIOS(data, 2); | ||
case 'mac': return generateIOS(data, 2); | ||
case 'web': return generateWeb(data, 2); | ||
case 'android': return generateAndroid(data, 2); | ||
// case 'android-ctrl': return generateAndroid(data, 2); | ||
@@ -52,0 +53,0 @@ } |
48
main.js
@@ -11,2 +11,4 @@ const tool = require('node-xlsx') | ||
console.log(HomeSheet) | ||
HomeSheet.forEach((item, index) => { | ||
@@ -29,3 +31,3 @@ if (index > 0) { | ||
const { zh, en } = getJSON(data, 4) | ||
const { zh, en } = getJSON(data, 2) | ||
const windowsModal = content => `<?xml version="1.0" encoding="utf-8"?> | ||
@@ -123,3 +125,3 @@ <root> | ||
exports.generateIOS = function (data,number) { | ||
exports.generateIOS = function (data, number) { | ||
const { zh, en } = getJSON(data, number) | ||
@@ -139,2 +141,4 @@ const model = (key, value) => `"${key}" = "${value}";` | ||
console.log(en_content) | ||
fs.writeFile(`./Localizable_en.strings`, en_content, err => { | ||
@@ -150,3 +154,37 @@ console.log(`写入ios中文资源文件成功`) | ||
exports.generateWeb = function (data, number) { | ||
const { zh, en } = getJSON(data, number) | ||
let en_content = 'export default {\n' | ||
for (const item in en) { | ||
en_content = en_content + `${item}: '${en[item]}',\n` | ||
} | ||
en_content = en_content + '}\n' | ||
let zh_content = 'export default {\n' | ||
for (const item in zh) { | ||
zh_content = zh_content + `${item}: '${zh[item]}',\n` | ||
} | ||
zh_content = zh_content + '}\n' | ||
const enName = `./en.js` | ||
const zhName = `./zh.js` | ||
fs.writeFile(enName, en_content, err => { | ||
console.log(`写入Web英文资源文件成功`) | ||
}) | ||
fs.writeFile(zhName, zh_content, err => { | ||
console.log(`写入Web中文资源文件成功`) | ||
}) | ||
} | ||
exports.generateAndroid = function (data, number) { | ||
@@ -167,4 +205,4 @@ const { zh, en } = getJSON(data, number) | ||
const en_Content = | ||
` | ||
const en_Content = | ||
` | ||
<resources> | ||
@@ -176,3 +214,3 @@ ${en_content} | ||
const zh_Content = | ||
` | ||
` | ||
<resources> | ||
@@ -179,0 +217,0 @@ ${zh_content} |
{ | ||
"name": "eshare-locale-bin", | ||
"version": "1.1.3", | ||
"version": "2.0.0", | ||
"description": "", | ||
@@ -17,5 +17,6 @@ "main": "index.js", | ||
"commander": "^7.1.0", | ||
"eshare-locale-bin": "^1.1.3", | ||
"inquirer": "^8.2.0", | ||
"node-xlsx": "^0.21.0" | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
226
8351
5
3
+ Addedeshare-locale-bin@^1.1.3
+ Addedeshare-locale-bin@1.1.3(transitive)