translate-compiler
Advanced tools
Comparing version 0.6.0-beta to 0.7.0-beta
#! /usr/bin/env node | ||
const a0_0x1bcf2a=a0_0x33e0;(function(_0x47ca51,_0x126aed){const _0x41deb4=a0_0x33e0,_0x50c787=_0x47ca51();while(!![]){try{const _0x25a877=parseInt(_0x41deb4(0x1d8))/0x1*(parseInt(_0x41deb4(0x1a8))/0x2)+parseInt(_0x41deb4(0x1e6))/0x3+-parseInt(_0x41deb4(0x1c5))/0x4+parseInt(_0x41deb4(0x195))/0x5+-parseInt(_0x41deb4(0x1d6))/0x6+parseInt(_0x41deb4(0x19f))/0x7+parseInt(_0x41deb4(0x1bf))/0x8*(-parseInt(_0x41deb4(0x19e))/0x9);if(_0x25a877===_0x126aed)break;else _0x50c787['push'](_0x50c787['shift']());}catch(_0x95005f){_0x50c787['push'](_0x50c787['shift']());}}}(a0_0x3f06,0x5584b));const fs=require('fs'),path=require(a0_0x1bcf2a(0x1d4)),{program}=require('commander'),{pinyin}=require(a0_0x1bcf2a(0x1e8)),_path=process['cwd']();function hasChinese(_0x2f41fb){const _0x3c9662=a0_0x1bcf2a;return/[\u4e00-\u9fa5]/g[_0x3c9662(0x1dc)](_0x2f41fb);}let customLang={},config={'env':a0_0x1bcf2a(0x1c3),'locals':[],'excludes':[],'channel':'baidu','suffix':'.vue','output':a0_0x1bcf2a(0x1cd)};getConfig();function getConfig(){const _0x1d558e=a0_0x1bcf2a;program['argument']('<env>','指定环境:dev(开发)/test(测试)/prod(生产),默认为开发环境')[_0x1d558e(0x1bb)](_0x1d558e(0x1c4),_0x1d558e(0x19b))['option'](_0x1d558e(0x1ba),'需要生成的地区语言(语种代码)如:zh等')[_0x1d558e(0x1e4)]('--channel\x20<value>',_0x1d558e(0x1e5))[_0x1d558e(0x1e4)]('--appKey\x20<value>',_0x1d558e(0x1ab))['option'](_0x1d558e(0x1cf),_0x1d558e(0x1de))[_0x1d558e(0x1e4)](_0x1d558e(0x1dd),_0x1d558e(0x196))[_0x1d558e(0x1e4)](_0x1d558e(0x1d3),'排除翻译的文件,可指定多个')['option'](_0x1d558e(0x1b8),_0x1d558e(0x1d0))['option'](_0x1d558e(0x1e1),_0x1d558e(0x1a4)),program[_0x1d558e(0x1e7)]();const _0x4adb0a=program[_0x1d558e(0x198)]();config=Object['assign'](config,_0x4adb0a,{'env':program[_0x1d558e(0x1c2)][0x0]}),getFileContent(path[_0x1d558e(0x197)](_path,_0x1d558e(0x1c8)),_0x481f9d=>{const _0x4ecb36=_0x1d558e;customLang=_0x481f9d,console[_0x4ecb36(0x1c0)](_0x4ecb36(0x1b0));},()=>{const _0xf9f46a=_0x1d558e;console[_0xf9f46a(0x1c0)](_0xf9f46a(0x1a1));});}function getFileContent(_0x5e7204,_0x570ccb,_0x836408){const _0x5e9909=a0_0x1bcf2a;if(fs[_0x5e9909(0x1ad)](_0x5e7204))try{let _0x281a5d=fs[_0x5e9909(0x1ef)](_0x5e7204,{'encoding':_0x5e9909(0x1b4)});const _0x365215=path[_0x5e9909(0x1a6)](_0x5e7204);if(_0x365215==_0x5e9909(0x1e3))_0x570ccb&&_0x570ccb(JSON['parse'](_0x281a5d));else{let _0x59ca2c={};_0x281a5d[_0x5e9909(0x1d5)](/['"]*(\w+)['"]*:\s*"([^"]+)"/g,(_0x382430,_0x5731ad,_0x178daa)=>{_0x59ca2c[_0x5731ad]=_0x178daa;}),_0x570ccb&&_0x570ccb(_0x59ca2c);}}catch(_0x5c490a){_0x836408&&_0x836408(_0x5e9909(0x1ea));}else _0x836408&&_0x836408(_0x5e9909(0x1ca));}function getSuffixFiles(_0x58c202,_0x403a11,_0x3559d5){const _0x2f9b45=a0_0x1bcf2a,_0x5904c1=fs[_0x2f9b45(0x1ee)](_0x58c202),_0x25d595=[];return _0x5904c1[_0x2f9b45(0x1c7)]((_0x3b0daa,_0x56191c)=>{const _0x5b2a99=_0x2f9b45,_0x5e5cea=path[_0x5b2a99(0x197)](_0x58c202,_0x3b0daa),_0x2299b6=fs[_0x5b2a99(0x1f4)](_0x5e5cea);if(_0x2299b6[_0x5b2a99(0x1ec)]())_0x25d595[_0x5b2a99(0x1ed)](...getSuffixFiles(_0x5e5cea,_0x403a11,_0x3559d5));else path['extname'](_0x3b0daa)==_0x403a11&&!_0x3559d5[_0x5b2a99(0x1df)](path[_0x5b2a99(0x1a6)](_0x3b0daa))&&_0x25d595[_0x5b2a99(0x1ed)](_0x5e5cea);}),_0x25d595;}function delSuffixFiles(_0x432092,_0x137ff0,_0x54c926){const _0x264930=a0_0x1bcf2a,_0xd063ef=fs[_0x264930(0x1ee)](_0x432092);_0xd063ef[_0x264930(0x1c7)]((_0x3f6b93,_0x4dc57d)=>{const _0x1a7a1a=_0x264930,_0x266681=path['join'](_0x432092,_0x3f6b93),_0x4e372f=fs[_0x1a7a1a(0x1f4)](_0x266681),_0x42ac48=new RegExp(_0x1a7a1a(0x1cc)+_0x137ff0+'$');if(_0x4e372f[_0x1a7a1a(0x1ec)]())delSuffixFiles(_0x266681,_0x137ff0,_0x54c926);else _0x42ac48[_0x1a7a1a(0x1dc)](_0x3f6b93)&&!_0x54c926[_0x1a7a1a(0x1df)](path[_0x1a7a1a(0x1a6)](_0x3f6b93))&&fs[_0x1a7a1a(0x1e0)](_0x266681);});}function getTranslateKey(_0x4cafcc,_0x3dc032){const _0x308dfb=a0_0x1bcf2a;if(_0x3dc032[_0x308dfb(0x19a)]>0x28)return'??????FILE_NAME_TO_LONG';const _0x3b7c2a=/^(['"`])|['"`]$/g,_0x3ebbfa=/\$*\{(.*?)\}/g;let _0xf83ed2=_0x4cafcc['replace'](_0x3b7c2a,'');const _0x2f10dc=(_0xf83ed2['match'](_0x3ebbfa)||[])['reduce']((_0x36f1d7,_0x38503f,_0xfb6b0d)=>_0x36f1d7[_0x308dfb(0x1d5)](_0x38503f,'{'+_0xfb6b0d+'}'),_0xf83ed2),_0x2b04bf=Object[_0x308dfb(0x1c1)](customLang)['indexOf'](_0x2f10dc);if(_0x2b04bf!==-0x1)return Object[_0x308dfb(0x1d9)](customLang)[_0x2b04bf];_0xf83ed2=_0xf83ed2[_0x308dfb(0x1d5)](_0x3ebbfa,'o'),_0xf83ed2=_0xf83ed2[_0x308dfb(0x1d5)](/[^\u4e00-\u9fa5\w]/g,'');let _0x5b5c4f=_0xf83ed2['replace'](/([\u4e00-\u9fa5]+)/g,_0x4abd8a=>{const _0x2d6378=_0x308dfb;return pinyin(_0x4abd8a,{'toneType':_0x2d6378(0x1a9),'type':'array'})[_0x2d6378(0x197)]('_');}),_0x5b79d6=_0x3dc032+'_'+_0x5b5c4f;if(_0x5b79d6[_0x308dfb(0x19a)]>0x1e){_0x5b5c4f=_0xf83ed2[_0x308dfb(0x1d5)](/([\u4e00-\u9fa5]+)/g,_0x4860e0=>{const _0x52e2f8=_0x308dfb;return pinyin(_0x4860e0,{'pattern':_0x52e2f8(0x1ae),'toneType':_0x52e2f8(0x1a9),'type':_0x52e2f8(0x1a2)})[_0x52e2f8(0x197)]('');}),_0x5b79d6=_0x3dc032+'_'+_0x5b5c4f;if(_0x5b79d6[_0x308dfb(0x19a)]>0x32){const _0x3a231c=Number[_0x308dfb(0x1b5)](_0x5b5c4f['length']/(0x31-_0x3dc032[_0x308dfb(0x19a)]))+0x1;_0x5b5c4f=new Array(_0x5b5c4f[_0x308dfb(0x19a)])[_0x308dfb(0x1f1)]('')['reduce']((_0x34df5b,_0x3058ec,_0x3865cf)=>''+_0x34df5b+(_0x3865cf%_0x3a231c==0x0?_0x5b5c4f[_0x3865cf]:''));}_0x5b79d6=_0x3dc032+'_'+_0x5b5c4f;}return _0x5b79d6;}translater();function translater(){const _0x1b01c9=a0_0x1bcf2a;delSuffixFiles(path[_0x1b01c9(0x197)](_path,config[_0x1b01c9(0x1bd)]),config[_0x1b01c9(0x1bc)],config[_0x1b01c9(0x1b1)]);const _0x3df2c6=getSuffixFiles(path['join'](_path,config[_0x1b01c9(0x1bd)]),config['suffix'],config[_0x1b01c9(0x1b1)]);let _0x305f51={};_0x3df2c6[_0x1b01c9(0x1c7)](function(_0x2abfe1,_0x7f45e3){const _0x173276=_0x1b01c9;console['log'](_0x173276(0x1a5)+_0x2abfe1);let _0x2a76f6=fs[_0x173276(0x1ef)](_0x2abfe1,{'encoding':'utf-8'})+'';const _0x156098=path[_0x173276(0x1b6)](_0x2abfe1)['split']('.')[0x0],_0x120266=/\<template\>(.|\n|\r)*\<\/template\>/g,_0x5e0e5e=/<!--[\s\S]*?-->/g,_0xbcc655=/\<script\>(.|\n|\r)*\<\/script\>/g,_0xd92890=/(?<=\s|\;|^|\{|\})\/\/[^\r\n]*/g,_0x556cb5=/\/\*[\s\S]*?\*\//g;_0x2a76f6=_0x2a76f6[_0x173276(0x1d5)](_0x120266,_0x3dea05=>_0x3dea05[_0x173276(0x1d5)](_0x5e0e5e,'')),_0x2a76f6=_0x2a76f6[_0x173276(0x1d5)](_0xbcc655,_0x214acb=>_0x214acb[_0x173276(0x1d5)](_0xd92890,'')[_0x173276(0x1d5)](_0x556cb5,''));const _0x159eac=/(?<=\$t\()(['"])(.*?)\1/g;_0x2a76f6=_0x2a76f6[_0x173276(0x1d5)](_0x159eac,(_0x4593d4,_0x31ea54,_0x3721d2)=>{if(hasChinese(_0x4593d4)){const _0xb3ea9f=getTranslateKey(_0x4593d4,_0x156098);return _0x305f51[_0xb3ea9f]=_0x3721d2,'\x27'+_0xb3ea9f+'\x27';}return _0x4593d4;}),_0x2a76f6=_0x2a76f6[_0x173276(0x1d5)](_0x120266,_0x418dc7=>{const _0x434a6c=_0x173276,_0x1f9184=handleTemplate(_0x418dc7,_0x156098);return _0x305f51=Object['assign'](_0x305f51,_0x1f9184[_0x434a6c(0x1d7)]),_0x1f9184[_0x434a6c(0x1a3)];}),_0x2a76f6=_0x2a76f6[_0x173276(0x1d5)](_0xbcc655,_0x70e27d=>{const _0x2b6e61=_0x173276,_0x57508c=handleScript(_0x70e27d,_0x156098);return _0x305f51=Object[_0x2b6e61(0x1af)](_0x305f51,_0x57508c[_0x2b6e61(0x1d7)]),_0x57508c[_0x2b6e61(0x1a3)];}),outputLangFile(_0x2abfe1,_0x2a76f6);}),outputTranslate(_0x305f51);}function a0_0x3f06(){const _0x1b1510=['20719wKmdMO','keys','\x27)\x20}}','.lang.$1','test','-s,\x20--suffix\x20<value>','翻译api\x20密钥','includes','unlinkSync','--strict','export\x20default\x20{\x0d','.json','option','翻译渠道\x20baidu\x20百度,youdao\x20有道','315351JDLLqU','parse','pinyin-pro','{{\x20$t(\x27','读取文件失败','$key','isDirectory','push','readdirSync','readFileSync','split','fill',':\x20\x22','env','lstatSync','2323255klkRfb','翻译的文件名后缀,默认.vue','join','opts','local','length','翻译的文件夹','filter','\x22:\x20\x22','1528713MmyTzt','3277428EtsaUR','mkdirSync','-\x20读取字典:\x20读取自定义字典发生错误!','array','content','是否严格模式,\x20严格模式只提取$t()内中文,否则全局','-\x20执行文件:','extname','locals','34rxOAPo','none','$t($key)','翻译api\x20应用key','\x27,\x20[','existsSync','first','assign','-\x20读取字典:\x20读取自定义字典\x27translate.json\x27成功!','excludes','$t(','this.$t($key)','utf-8','parseInt','basename','\x20\x20\x22','-o,\x20--output\x20<file>','output','-l,\x20--locals\x20<value...>','requiredOption','suffix','dir','dirname','32XabZXg','log','values','args','dev','-d,\x20--dir\x20<dir>','110976tZvSiD','prod','forEach','/translate.json','writeFileSync','文件不存在','strict','.lang','locals/local.json','map','--secretKey\x20<value>','翻译结果写入的文件路径,默认locals/local.json','match','$t(\x27','-e,\x20--excludes\x20<value...>','path','replace','1996440ZqzpbG','obj'];a0_0x3f06=function(){return _0x1b1510;};return a0_0x3f06();}function handleTemplate(_0x58d162,_0x4f9cb6){const _0x1417fa=a0_0x1bcf2a,_0x45dcab=/<([a-z][a-z0-9\-]*)\b[^>]*>(.*?)<\/\1>/g,_0xbdc958=/(?<!\:)\b(?:\w|-)+\=(['"])(.*?)\1/g,_0x198ef3=handleStringTpl(_0x58d162,_0x4f9cb6,!![]);_0x58d162=_0x198ef3[_0x1417fa(0x1a3)];let _0x5913c3=_0x198ef3[_0x1417fa(0x1d7)];return!config[_0x1417fa(0x1cb)]&&(_0x58d162=_0x58d162[_0x1417fa(0x1d5)](_0x45dcab,(_0x1cba1b,_0x5b8eb5,_0x35bbd9)=>{const _0xeab8ca=_0x1417fa;if(hasChinese(_0x35bbd9)){if(/\{\{(.*?)\}\}/g[_0xeab8ca(0x1dc)](_0x35bbd9)){const _0x135bdb=handleDoubleBrace(_0x35bbd9,_0x4f9cb6,_0xeab8ca(0x1aa),!![]);return _0x5913c3=Object[_0xeab8ca(0x1af)](_0x5913c3,_0x135bdb[_0xeab8ca(0x1d7)]),_0x1cba1b['replace'](_0x35bbd9,_0x135bdb[_0xeab8ca(0x1a3)]);}const _0x1f83ac=getTranslateKey(_0x35bbd9,_0x4f9cb6);return _0x5913c3[_0x1f83ac]=_0x35bbd9,_0x1cba1b[_0xeab8ca(0x1d5)](_0x35bbd9,_0xeab8ca(0x1e9)+_0x1f83ac+_0xeab8ca(0x1da));}return _0x1cba1b;}),_0x58d162=_0x58d162[_0x1417fa(0x1d5)](_0xbdc958,(_0x2f3231,_0xb6e9b,_0x299c16)=>{const _0x2a71fc=_0x1417fa;if(hasChinese(_0x299c16)){const _0x2775c3=getTranslateKey(_0x299c16,_0x4f9cb6);return _0x5913c3[_0x2775c3]=_0x299c16,':'+_0x2f3231[_0x2a71fc(0x1d5)](_0x299c16,_0x2a71fc(0x1d2)+_0x2775c3+'\x27)');}return _0x2f3231;})),{'content':_0x58d162,'obj':_0x5913c3};}function handleScript(_0x1b09b7,_0x432812){const _0x1f2d3d=a0_0x1bcf2a,_0xb9257d=/(?<!\$t\(\s*)(['"])(.*?)(\1)/g,_0x1d1ced=handleStringTpl(_0x1b09b7,_0x432812);_0x1b09b7=_0x1d1ced[_0x1f2d3d(0x1a3)];let _0x389c17=_0x1d1ced[_0x1f2d3d(0x1d7)];return!config[_0x1f2d3d(0x1cb)]&&(_0x1b09b7=_0x1b09b7[_0x1f2d3d(0x1d5)](_0xb9257d,(_0x1e911e,_0x444edb,_0x56e21c)=>{if(hasChinese(_0x1e911e)){const _0xb73172=getTranslateKey(_0x1e911e,_0x432812);return _0x389c17[_0xb73172]=_0x56e21c,'this.$t(\x27'+_0xb73172+'\x27)';}return _0x1e911e;})),{'content':_0x1b09b7,'obj':_0x389c17};}function handleStringTpl(_0x3b010a,_0x1371aa,_0x43559c){const _0x51175e=a0_0x1bcf2a,_0x466583=/(?<!\$t\(\s*)`(.*?)`/g,_0x40b84c=/(?<=\$t\()`(.*?)`/g,_0x5b85ef=/\${(.*?)}/g;let _0x30c561={};const _0x27e820=function(_0x2fdcba,_0x45f8e3,_0x1baf7b){const _0x42baab=a0_0x33e0,_0x459800=_0x2fdcba[_0x42baab(0x1d5)](_0x5b85ef,'');if(hasChinese(_0x459800)){const _0x37a435=getTranslateKey(_0x2fdcba,_0x1371aa),_0x38ac2e=_0x2fdcba[_0x42baab(0x1d1)](_0x5b85ef);if(_0x38ac2e){const _0x3b397c=_0x38ac2e['reduce']((_0x435811,_0x1d1d5d,_0xfa27bf)=>_0x435811[_0x42baab(0x1d5)](_0x1d1d5d,'{'+_0xfa27bf+'}'),_0x45f8e3),_0x2374e1=_0x38ac2e[_0x42baab(0x1ce)](_0x1de052=>{const _0x275651=_0x42baab,_0x148a57=_0x1de052['replace'](_0x5b85ef,'$1'),_0x25ab49=handleDoubleBrace(_0x148a57,_0x1371aa,_0x43559c?_0x275651(0x1aa):_0x275651(0x1b3));return _0x30c561=Object[_0x275651(0x1af)](_0x30c561,_0x25ab49['obj']),_0x25ab49[_0x275651(0x1a3)];});return _0x30c561[_0x37a435]=_0x3b397c,_0x1baf7b('\x27'+_0x37a435+_0x42baab(0x1ac)+_0x2374e1[_0x42baab(0x197)](',\x20')+']');}return _0x30c561[_0x37a435]=_0x45f8e3,_0x1baf7b('\x27'+_0x37a435+'\x27');}return _0x2fdcba;};return _0x3b010a=_0x3b010a[_0x51175e(0x1d5)](_0x40b84c,(_0x139e5f,_0x5bca4b)=>{return _0x27e820(_0x139e5f,_0x5bca4b,_0x792f03=>_0x792f03);}),!config['strict']&&(_0x3b010a=_0x3b010a['replace'](_0x466583,(_0x331b90,_0x8ddbf9)=>{const _0xe327a1=_0x51175e;return _0x27e820(_0x331b90,_0x8ddbf9,_0x2df866=>_0x43559c?_0xe327a1(0x1b2)+_0x2df866+')':'this.$t('+_0x2df866+')');})),{'content':_0x3b010a,'obj':_0x30c561};}function handleDoubleBrace(_0x29e29c,_0x531e65,_0x442208=a0_0x1bcf2a(0x1eb),_0x54f060=![]){const _0x4a495d=a0_0x1bcf2a,_0x3e1cd9=/(['"])(.*?)(\1)/g;let _0x5112c9={};if(_0x54f060){const _0x389314=(_0x29e29c[_0x4a495d(0x1f0)](/{{.*?}}/)||[])['filter'](_0x21788f=>hasChinese(_0x21788f));_0x389314['forEach'](_0x5a1294=>{const _0x156573=_0x4a495d,_0x988d57=getTranslateKey(_0x5a1294,_0x531e65);_0x29e29c=_0x29e29c[_0x156573(0x1d5)](_0x5a1294,_0x156573(0x1e9)+_0x988d57+'\x27)\x20}}'),_0x5112c9[_0x988d57]=_0x5a1294;});}const _0x59dd11=(_0x29e29c[_0x4a495d(0x1d1)](_0x3e1cd9)||[])[_0x4a495d(0x19c)](_0x1b5c63=>hasChinese(_0x1b5c63));return _0x59dd11[_0x4a495d(0x1c7)](_0x39f16a=>{const _0x44724f=_0x4a495d,_0x4d5ffb=getTranslateKey(_0x39f16a,_0x531e65);_0x29e29c=_0x29e29c[_0x44724f(0x1d5)](_0x39f16a,_0x442208[_0x44724f(0x1d5)](_0x44724f(0x1eb),'\x27'+_0x4d5ffb+'\x27')),_0x5112c9[_0x4d5ffb]=_0x39f16a['replace'](/^['"]|['"]$/g,'');}),{'content':_0x29e29c,'obj':_0x5112c9};}function outputLangFile(_0x48d5d5,_0x334f73){const _0x3e41cd=a0_0x1bcf2a;if(config[_0x3e41cd(0x1f3)]==_0x3e41cd(0x1dc)){const _0x490bc1=_0x48d5d5[_0x3e41cd(0x1d5)](/\.(\w+)$/,_0x3e41cd(0x1db));fs['writeFileSync'](_0x490bc1,_0x334f73);}else config[_0x3e41cd(0x1f3)]==_0x3e41cd(0x1c6)&&fs['writeFileSync'](_0x48d5d5,_0x334f73);}function a0_0x33e0(_0x24cbea,_0x48f203){const _0x3f0695=a0_0x3f06();return a0_0x33e0=function(_0x33e078,_0x1d8fad){_0x33e078=_0x33e078-0x195;let _0x5bbc62=_0x3f0695[_0x33e078];return _0x5bbc62;},a0_0x33e0(_0x24cbea,_0x48f203);}function outputTranslate(_0x30b4b3){const _0x15ca75=a0_0x1bcf2a,_0x4aae40=function(_0x4b643e,_0x39a3b6,_0x1def10,_0x15d252){const _0x5d79de=a0_0x33e0;let _0x5b6080=_0x30b4b3;_0x15d252&&getFileContent(path[_0x5d79de(0x197)](_0x1def10,''+_0x4b643e+_0x39a3b6),_0x5d8706=>{const _0x19c52e=_0x5d79de;_0x5b6080=Object[_0x19c52e(0x1af)](_0x30b4b3,_0x5d8706);});if(_0x39a3b6=='.js'){let _0x2cd74e=Object[_0x5d79de(0x1d9)](_0x5b6080)[_0x5d79de(0x1ce)](_0x465318=>'\x20\x20'+_0x465318+_0x5d79de(0x1f2)+_0x5b6080[_0x465318]+'\x22')[_0x5d79de(0x197)](',\x0d');fs[_0x5d79de(0x1c9)](path[_0x5d79de(0x197)](_0x1def10,''+_0x4b643e+_0x39a3b6),_0x5d79de(0x1e2)+_0x2cd74e+'\x0d}');}else{let _0x243ea1=Object['keys'](_0x5b6080)['map'](_0x2d0db9=>_0x5d79de(0x1b7)+_0x2d0db9+_0x5d79de(0x19d)+_0x5b6080[_0x2d0db9]+'\x22')[_0x5d79de(0x197)](',\x0d');fs[_0x5d79de(0x1c9)](path[_0x5d79de(0x197)](_0x1def10,''+_0x4b643e+_0x39a3b6),'{\x0d'+_0x243ea1+'\x0d}');}},_0x1845ec=path['join'](_path,config[_0x15ca75(0x1b9)]);if(/\.\w+$/g[_0x15ca75(0x1dc)](_0x1845ec)){const _0x1dd62b=path[_0x15ca75(0x1be)](_0x1845ec);!fs[_0x15ca75(0x1ad)](_0x1dd62b)&&fs[_0x15ca75(0x1a0)](_0x1dd62b,{'recursive':!![]});const _0x5eb7ac=path['basename'](_0x1845ec),_0x40547e=path[_0x15ca75(0x1a6)](_0x1845ec),_0x2a6cab=_0x5eb7ac[_0x15ca75(0x1d5)](_0x40547e,'');[_0x2a6cab,...config[_0x15ca75(0x1a7)]][_0x15ca75(0x1c7)]((_0x2ab566,_0x37042)=>{const _0x2c2431=_0x15ca75;_0x4aae40(_0x2ab566,_0x40547e,path[_0x2c2431(0x1be)](_0x1845ec),_0x37042>0x0);});}else!fs[_0x15ca75(0x1ad)](_0x1845ec)&&fs['mkdirSync'](_0x1845ec,{'recursive':!![]}),[_0x15ca75(0x199),...config['locals']]['forEach']((_0x3e50a7,_0x5ac8e7)=>{const _0x24561f=_0x15ca75;_0x4aae40(_0x3e50a7,_0x24561f(0x1e3),_0x1845ec,_0x5ac8e7>0x0);});} | ||
const a0_0x5da5b4=a0_0x3816;(function(_0x194cb4,_0x2f2efb){const _0x5d3392=a0_0x3816,_0xb2445f=_0x194cb4();while(!![]){try{const _0xf22c21=parseInt(_0x5d3392(0x6f))/0x1*(-parseInt(_0x5d3392(0x6e))/0x2)+parseInt(_0x5d3392(0xae))/0x3+-parseInt(_0x5d3392(0x8f))/0x4+parseInt(_0x5d3392(0xc5))/0x5*(parseInt(_0x5d3392(0x84))/0x6)+parseInt(_0x5d3392(0x9e))/0x7*(parseInt(_0x5d3392(0x8a))/0x8)+parseInt(_0x5d3392(0x83))/0x9*(-parseInt(_0x5d3392(0xcc))/0xa)+parseInt(_0x5d3392(0xb9))/0xb;if(_0xf22c21===_0x2f2efb)break;else _0xb2445f['push'](_0xb2445f['shift']());}catch(_0xd1952a){_0xb2445f['push'](_0xb2445f['shift']());}}}(a0_0x47f8,0x3b788));const fs=require('fs'),path=require(a0_0x5da5b4(0xb6)),{program}=require(a0_0x5da5b4(0x9b)),{pinyin}=require(a0_0x5da5b4(0x9f)),{translater}=require(a0_0x5da5b4(0xb8)),_path=process[a0_0x5da5b4(0xcf)]();function hasChinese(_0x22a8f8){const _0x46b443=a0_0x5da5b4;return/[\u4e00-\u9fa5]/g[_0x46b443(0xc4)](_0x22a8f8);}let customLang={},config={'env':a0_0x5da5b4(0xb3),'locals':[],'excludes':[],'translate':[],'channel':'baidu','appKey':'','secretKey':'','suffix':a0_0x5da5b4(0x99),'output':'locals.json'};getConfig();function getConfig(){const _0x38cbb9=a0_0x5da5b4;program[_0x38cbb9(0x90)]('<env>',_0x38cbb9(0xbf))[_0x38cbb9(0xc3)](_0x38cbb9(0x96),_0x38cbb9(0xc1))[_0x38cbb9(0x80)](_0x38cbb9(0xb0),_0x38cbb9(0x77))['option']('--channel\x20<value>','翻译渠道\x20baidu\x20百度,youdao\x20有道')[_0x38cbb9(0x80)](_0x38cbb9(0xc9),_0x38cbb9(0x79))[_0x38cbb9(0x80)]('--secretKey\x20<value>',_0x38cbb9(0x7d))['option'](_0x38cbb9(0xba),'需要翻译的语言,对应locals')['option'](_0x38cbb9(0xc7),'翻译的文件名后缀,默认.vue')[_0x38cbb9(0x80)]('-e,\x20--excludes\x20<value...>',_0x38cbb9(0x97))['option']('-o,\x20--output\x20<file>','翻译结果写入的文件路径,默认locals/local.json')[_0x38cbb9(0x80)](_0x38cbb9(0x7c),_0x38cbb9(0x8d)),program[_0x38cbb9(0x89)]();const _0x202406=program['opts']();config=Object[_0x38cbb9(0x9a)](config,_0x202406,{'env':program['args'][0x0]}),getFileContent(path[_0x38cbb9(0xa0)](_path,_0x38cbb9(0xa5)),_0x5ec22b=>{const _0x47efbf=_0x38cbb9;customLang=_0x5ec22b,console[_0x47efbf(0xc0)](_0x47efbf(0x75));},()=>{const _0x417e40=_0x38cbb9;console[_0x417e40(0xc0)](_0x417e40(0xac));});}function getFileContent(_0x4e9391,_0x5a8358,_0x2aa56a){const _0x285f45=a0_0x5da5b4;if(fs[_0x285f45(0x87)](_0x4e9391))try{let _0x31d670=fs[_0x285f45(0xb2)](_0x4e9391,{'encoding':_0x285f45(0xa4)});const _0x526858=path[_0x285f45(0x74)](_0x4e9391);if(_0x526858==_0x285f45(0x73))_0x5a8358&&_0x5a8358(JSON[_0x285f45(0x89)](_0x31d670));else{let _0x3fbf86={};_0x31d670['replace'](/['"]*(\w+)['"]*:\s*"([^"]+)"/g,(_0xfd1ba0,_0x417c32,_0x1d7236)=>{_0x3fbf86[_0x417c32]=_0x1d7236;}),_0x5a8358&&_0x5a8358(_0x3fbf86);}}catch(_0x59259c){_0x2aa56a&&_0x2aa56a(_0x285f45(0xbc));}else _0x2aa56a&&_0x2aa56a(_0x285f45(0x70));}function getSuffixFiles(_0x3447f8,_0x1a9692,_0x30dc90){const _0x5ea214=a0_0x5da5b4,_0x24fb6c=fs['readdirSync'](_0x3447f8),_0x3d76d7=[];return _0x24fb6c[_0x5ea214(0xc6)]((_0x1d4514,_0x5daaf0)=>{const _0x1539b4=_0x5ea214,_0x46697f=path[_0x1539b4(0xa0)](_0x3447f8,_0x1d4514),_0x465561=fs[_0x1539b4(0xc8)](_0x46697f);if(_0x465561[_0x1539b4(0xa1)]())_0x3d76d7[_0x1539b4(0x88)](...getSuffixFiles(_0x46697f,_0x1a9692,_0x30dc90));else path[_0x1539b4(0x74)](_0x1d4514)==_0x1a9692&&!_0x30dc90[_0x1539b4(0x8c)](path['extname'](_0x1d4514))&&_0x3d76d7[_0x1539b4(0x88)](_0x46697f);}),_0x3d76d7;}function delSuffixFiles(_0x453eea,_0x1bb7c4,_0x32f6b8){const _0x232335=a0_0x5da5b4,_0x289576=fs[_0x232335(0xab)](_0x453eea);_0x289576['forEach']((_0x12fe17,_0x51d961)=>{const _0xb2983e=_0x232335,_0x43a276=path[_0xb2983e(0xa0)](_0x453eea,_0x12fe17),_0xaadda4=fs[_0xb2983e(0xc8)](_0x43a276),_0x5e5271=new RegExp('.lang'+_0x1bb7c4+'$');if(_0xaadda4['isDirectory']())delSuffixFiles(_0x43a276,_0x1bb7c4,_0x32f6b8);else _0x5e5271['test'](_0x12fe17)&&!_0x32f6b8['includes'](path[_0xb2983e(0x74)](_0x12fe17))&&fs[_0xb2983e(0xb1)](_0x43a276);});}function getTranslateKey(_0x3246ce,_0x224741){const _0x29c291=a0_0x5da5b4;if(_0x224741['length']>0x28)return _0x29c291(0xa3);const _0x59b6b8=/^(['"`])|['"`]$/g,_0x593055=/\$*\{(.*?)\}/g;let _0x36e749=_0x3246ce[_0x29c291(0x71)](_0x59b6b8,'');const _0x233a57=(_0x36e749[_0x29c291(0x95)](_0x593055)||[])['reduce']((_0x2146b5,_0x470eda,_0x284a71)=>_0x2146b5[_0x29c291(0x71)](_0x470eda,'{'+_0x284a71+'}'),_0x36e749),_0x1dae58=Object['values'](customLang)[_0x29c291(0xb7)](_0x233a57);if(_0x1dae58!==-0x1)return Object[_0x29c291(0x93)](customLang)[_0x1dae58];_0x36e749=_0x36e749['replace'](_0x593055,'o'),_0x36e749=_0x36e749['replace'](/[^\u4e00-\u9fa5\w]/g,'');let _0x28abdc=_0x36e749[_0x29c291(0x71)](/([\u4e00-\u9fa5]+)/g,_0x2dc7c5=>{const _0x5aa8b3=_0x29c291;return pinyin(_0x2dc7c5,{'toneType':_0x5aa8b3(0xce),'type':_0x5aa8b3(0x6d)})[_0x5aa8b3(0xa0)]('_');}),_0x56faa5=_0x224741+'_'+_0x28abdc;if(_0x56faa5['length']>0x1e){_0x28abdc=_0x36e749[_0x29c291(0x71)](/([\u4e00-\u9fa5]+)/g,_0x1a1c18=>{const _0x43f4af=_0x29c291;return pinyin(_0x1a1c18,{'pattern':_0x43f4af(0xa2),'toneType':_0x43f4af(0xce),'type':_0x43f4af(0x6d)})['join']('');}),_0x56faa5=_0x224741+'_'+_0x28abdc;if(_0x56faa5[_0x29c291(0x85)]>0x32){const _0x43a55b=Number['parseInt'](_0x28abdc['length']/(0x31-_0x224741[_0x29c291(0x85)]))+0x1;_0x28abdc=new Array(_0x28abdc[_0x29c291(0x85)])[_0x29c291(0xad)]('')[_0x29c291(0x9d)]((_0x4fb8ad,_0x311ef3,_0x87fc97)=>''+_0x4fb8ad+(_0x87fc97%_0x43a55b==0x0?_0x28abdc[_0x87fc97]:''));}_0x56faa5=_0x224741+'_'+_0x28abdc;}return _0x56faa5;}translate();function translate(){const _0x2b2101=a0_0x5da5b4;delSuffixFiles(path[_0x2b2101(0xa0)](_path,config[_0x2b2101(0x76)]),config[_0x2b2101(0xb4)],config[_0x2b2101(0x91)]);const _0x5efcb5=getSuffixFiles(path[_0x2b2101(0xa0)](_path,config[_0x2b2101(0x76)]),config[_0x2b2101(0xb4)],config[_0x2b2101(0x91)]);let _0x104f31={};_0x5efcb5[_0x2b2101(0xc6)](function(_0xab9e0d,_0x3db589){const _0x17ada6=_0x2b2101;console[_0x17ada6(0xc0)]('-\x20执行文件:'+_0xab9e0d);let _0x146169=fs['readFileSync'](_0xab9e0d,{'encoding':'utf-8'})+'';const _0x2358b4=path['basename'](_0xab9e0d)[_0x17ada6(0xcd)]('.')[0x0],_0x3575e8=/\<template\>(.|\n|\r)*\<\/template\>/g,_0x4aab00=/<!--[\s\S]*?-->/g,_0x429de2=/\<script\>(.|\n|\r)*\<\/script\>/g,_0x53b9d7=/(?<=\s|\;|^|\{|\})\/\/[^\r\n]*/g,_0x4aef4f=/\/\*[\s\S]*?\*\//g;_0x146169=_0x146169[_0x17ada6(0x71)](_0x3575e8,_0x5d245c=>_0x5d245c[_0x17ada6(0x71)](_0x4aab00,'')),_0x146169=_0x146169[_0x17ada6(0x71)](_0x429de2,_0x147188=>_0x147188[_0x17ada6(0x71)](_0x53b9d7,'')[_0x17ada6(0x71)](_0x4aef4f,''));const _0x16c5d1=/(?<=\$t\()(['"])(.*?)\1/g;_0x146169=_0x146169[_0x17ada6(0x71)](_0x16c5d1,(_0x3b613e,_0x5d96bf,_0x575ba1)=>{if(hasChinese(_0x3b613e)){const _0x1134b0=getTranslateKey(_0x3b613e,_0x2358b4);return _0x104f31[_0x1134b0]=_0x575ba1,'\x27'+_0x1134b0+'\x27';}return _0x3b613e;}),_0x146169=_0x146169[_0x17ada6(0x71)](_0x3575e8,_0xab26a8=>{const _0x2264eb=_0x17ada6,_0x2f4c7c=handleTemplate(_0xab26a8,_0x2358b4);return _0x104f31=Object[_0x2264eb(0x9a)](_0x104f31,_0x2f4c7c[_0x2264eb(0x72)]),_0x2f4c7c[_0x2264eb(0xb5)];}),_0x146169=_0x146169[_0x17ada6(0x71)](_0x429de2,_0x35cd4d=>{const _0x4c411d=_0x17ada6,_0x2756a0=handleScript(_0x35cd4d,_0x2358b4);return _0x104f31=Object[_0x4c411d(0x9a)](_0x104f31,_0x2756a0['obj']),_0x2756a0[_0x4c411d(0xb5)];}),outputLangFile(_0xab9e0d,_0x146169);}),outputLocalFile(_0x104f31);}function handleTemplate(_0x298a3d,_0x56c3a3){const _0x3790d7=a0_0x5da5b4,_0x479457=/<([a-z][a-z0-9\-]*)\b[^>]*>(.*?)<\/\1>/g,_0x2fca2b=/(?<!\:)\b(?:\w|-)+\=(['"])(.*?)\1/g,_0x254e5a=handleStringTpl(_0x298a3d,_0x56c3a3,!![]);_0x298a3d=_0x254e5a['content'];let _0x8effb5=_0x254e5a[_0x3790d7(0x72)];return!config['strict']&&(_0x298a3d=_0x298a3d[_0x3790d7(0x71)](_0x479457,(_0x20a34d,_0x4f4935,_0x4569bf)=>{const _0x2d4c11=_0x3790d7;if(hasChinese(_0x4569bf)){if(/\{\{(.*?)\}\}/g[_0x2d4c11(0xc4)](_0x4569bf)){const _0x2b0675=handleDoubleBrace(_0x4569bf,_0x56c3a3,_0x2d4c11(0x94),!![]);return _0x8effb5=Object['assign'](_0x8effb5,_0x2b0675[_0x2d4c11(0x72)]),_0x20a34d['replace'](_0x4569bf,_0x2b0675[_0x2d4c11(0xb5)]);}const _0x5aea6e=getTranslateKey(_0x4569bf,_0x56c3a3);return _0x8effb5[_0x5aea6e]=_0x4569bf,_0x20a34d[_0x2d4c11(0x71)](_0x4569bf,_0x2d4c11(0xbe)+_0x5aea6e+'\x27)\x20}}');}return _0x20a34d;}),_0x298a3d=_0x298a3d['replace'](_0x2fca2b,(_0x242609,_0x4df10a,_0x5f0469)=>{const _0x93bff5=_0x3790d7;if(hasChinese(_0x5f0469)){const _0x3bdb4c=getTranslateKey(_0x5f0469,_0x56c3a3);return _0x8effb5[_0x3bdb4c]=_0x5f0469,':'+_0x242609[_0x93bff5(0x71)](_0x5f0469,_0x93bff5(0xca)+_0x3bdb4c+'\x27)');}return _0x242609;})),{'content':_0x298a3d,'obj':_0x8effb5};}function a0_0x3816(_0x3c1018,_0xa9a2c5){const _0x47f87a=a0_0x47f8();return a0_0x3816=function(_0x3816b1,_0x24aef7){_0x3816b1=_0x3816b1-0x6c;let _0x16df7b=_0x47f87a[_0x3816b1];return _0x16df7b;},a0_0x3816(_0x3c1018,_0xa9a2c5);}function a0_0x47f8(){const _0x44f319=['existsSync','push','parse','9688iwERVn','writeFileSync','includes','是否严格模式,\x20严格模式只提取$t()内中文,否则全局','this.$t(\x27','1540876ZFpNoX','argument','excludes','\x27)\x20}}','keys','$t($key)','match','-d,\x20--dir\x20<dir>','排除翻译的文件,可指定多个','translate','.vue','assign','commander','locals','reduce','1638apuDrq','pinyin-pro','join','isDirectory','first','??????FILE_NAME_TO_LONG','utf-8','/translate.json','$t(','this.$t(','map','prod','\x27,\x20[','readdirSync','-\x20读取字典:\x20读取自定义字典发生错误!','fill','1057542CqyGQF','dirname','-l,\x20--locals\x20<value...>','unlinkSync','readFileSync','dev','suffix','content','path','indexOf','./parser/translater','4170683PhVvRb','-t,\x20--translate\x20<value...>','hasOwnProperty','读取文件失败','output','{{\x20$t(\x27','指定环境:dev(开发)/test(测试)/prod(生产),默认为开发环境','log','翻译的文件夹','$key','requiredOption','test','1315865bcyQCv','forEach','-s,\x20--suffix\x20<value>','lstatSync','--appKey\x20<value>','$t(\x27','mkdirSync','10YbSJOx','split','none','cwd','.lang.$1','zh_cn','filter','array','2224CKaCGp','354teiYMk','文件不存在','replace','obj','.json','extname','-\x20读取字典:\x20读取自定义字典\x27translate.json\x27成功!','dir','需要生成的地区语言(语种代码)如:zh等','export\x20default\x20{\x0d','翻译api\x20应用key','stringify','env','--strict','翻译api\x20密钥','toLowerCase','this.$t($key)','option','strict',':\x20\x22','2301795CnCkSn','6nwWjIS','length','\x20\x20\x22'];a0_0x47f8=function(){return _0x44f319;};return a0_0x47f8();}function handleScript(_0x52a53e,_0x41fa6d){const _0x1f7a33=a0_0x5da5b4,_0x408acd=/(?<!\$t\(\s*)(['"])(.*?)(\1)/g,_0x2b254b=handleStringTpl(_0x52a53e,_0x41fa6d);_0x52a53e=_0x2b254b[_0x1f7a33(0xb5)];let _0x3c2d81=_0x2b254b[_0x1f7a33(0x72)];return!config[_0x1f7a33(0x81)]&&(_0x52a53e=_0x52a53e['replace'](_0x408acd,(_0x74e955,_0x39e184,_0x287ebd)=>{const _0x504a2f=_0x1f7a33;if(hasChinese(_0x74e955)){const _0x579df5=getTranslateKey(_0x74e955,_0x41fa6d);return _0x3c2d81[_0x579df5]=_0x287ebd,_0x504a2f(0x8e)+_0x579df5+'\x27)';}return _0x74e955;})),{'content':_0x52a53e,'obj':_0x3c2d81};}function handleStringTpl(_0x482a58,_0x9c8111,_0x3f04d3){const _0x6c70a1=a0_0x5da5b4,_0x27bd74=/(?<!\$t\(\s*)`(.*?)`/g,_0x2c6435=/(?<=\$t\()`(.*?)`/g,_0x137930=/\${(.*?)}/g;let _0x3072d5={};const _0x6829c1=function(_0x25d564,_0x8b7098,_0x2b771f){const _0x628fe3=a0_0x3816,_0xa2f872=_0x25d564[_0x628fe3(0x71)](_0x137930,'');if(hasChinese(_0xa2f872)){const _0x3bcf4c=getTranslateKey(_0x25d564,_0x9c8111),_0x22b13b=_0x25d564['match'](_0x137930);if(_0x22b13b){const _0x525bc9=_0x22b13b['reduce']((_0x36acda,_0x4ffcd8,_0xd4fd21)=>_0x36acda[_0x628fe3(0x71)](_0x4ffcd8,'{'+_0xd4fd21+'}'),_0x8b7098),_0x1b6b55=_0x22b13b['map'](_0x14dba2=>{const _0x4151dc=_0x628fe3,_0x4869bc=_0x14dba2[_0x4151dc(0x71)](_0x137930,'$1'),_0x421d31=handleDoubleBrace(_0x4869bc,_0x9c8111,_0x3f04d3?'$t($key)':_0x4151dc(0x7f));return _0x3072d5=Object['assign'](_0x3072d5,_0x421d31[_0x4151dc(0x72)]),_0x421d31[_0x4151dc(0xb5)];});return _0x3072d5[_0x3bcf4c]=_0x525bc9,_0x2b771f('\x27'+_0x3bcf4c+_0x628fe3(0xaa)+_0x1b6b55['join'](',\x20')+']');}return _0x3072d5[_0x3bcf4c]=_0x8b7098,_0x2b771f('\x27'+_0x3bcf4c+'\x27');}return _0x25d564;};return _0x482a58=_0x482a58[_0x6c70a1(0x71)](_0x2c6435,(_0x58c2e2,_0x56ace0)=>{return _0x6829c1(_0x58c2e2,_0x56ace0,_0x44b380=>_0x44b380);}),!config[_0x6c70a1(0x81)]&&(_0x482a58=_0x482a58[_0x6c70a1(0x71)](_0x27bd74,(_0x4f1312,_0x2fa49e)=>{const _0x356434=_0x6c70a1;return _0x6829c1(_0x4f1312,_0x2fa49e,_0x541d5c=>_0x3f04d3?_0x356434(0xa6)+_0x541d5c+')':_0x356434(0xa7)+_0x541d5c+')');})),{'content':_0x482a58,'obj':_0x3072d5};}function handleDoubleBrace(_0xb082fd,_0x3329d7,_0x3146ad=a0_0x5da5b4(0xc2),_0x6fb90f=![]){const _0x3e4133=a0_0x5da5b4,_0x1db394=/(['"])(.*?)(\1)/g;let _0x21dc3a={};if(_0x6fb90f){const _0x338b9f=(_0xb082fd[_0x3e4133(0xcd)](/{{.*?}}/)||[])[_0x3e4133(0x6c)](_0x4a4a14=>hasChinese(_0x4a4a14));_0x338b9f[_0x3e4133(0xc6)](_0x109674=>{const _0x5165f5=_0x3e4133,_0x19ae7f=getTranslateKey(_0x109674,_0x3329d7);_0xb082fd=_0xb082fd[_0x5165f5(0x71)](_0x109674,'{{\x20$t(\x27'+_0x19ae7f+_0x5165f5(0x92)),_0x21dc3a[_0x19ae7f]=_0x109674;});}const _0x364de5=(_0xb082fd[_0x3e4133(0x95)](_0x1db394)||[])[_0x3e4133(0x6c)](_0x1b57ea=>hasChinese(_0x1b57ea));return _0x364de5['forEach'](_0x1cd734=>{const _0x232fb8=_0x3e4133,_0x5dff24=getTranslateKey(_0x1cd734,_0x3329d7);_0xb082fd=_0xb082fd[_0x232fb8(0x71)](_0x1cd734,_0x3146ad['replace']('$key','\x27'+_0x5dff24+'\x27')),_0x21dc3a[_0x5dff24]=_0x1cd734[_0x232fb8(0x71)](/^['"]|['"]$/g,'');}),{'content':_0xb082fd,'obj':_0x21dc3a};}function outputLangFile(_0x47bf66,_0x481d3c){const _0x28fe79=a0_0x5da5b4;if(config[_0x28fe79(0x7b)]==_0x28fe79(0xc4)){const _0x5b98b2=_0x47bf66['replace'](/\.(\w+)$/,_0x28fe79(0xd0));fs[_0x28fe79(0x8b)](_0x5b98b2,_0x481d3c);}else config[_0x28fe79(0x7b)]==_0x28fe79(0xa9)&&fs[_0x28fe79(0x8b)](_0x47bf66,_0x481d3c);}async function outputLocalFile(_0x14fadc){const _0x4f2999=a0_0x5da5b4,_0x217390=path['join'](_path,config[_0x4f2999(0xbd)]);if(/\.\w+$/g[_0x4f2999(0xc4)](_0x217390)){const _0x30214f=path[_0x4f2999(0xaf)](_0x217390);!fs[_0x4f2999(0x87)](_0x30214f)&&fs[_0x4f2999(0xcb)](_0x30214f,{'recursive':!![]});const _0x5c39be=path[_0x4f2999(0x74)](_0x217390);handleLocalFile(_0x14fadc,_0x217390);for(let _0x13d808=0x0;_0x13d808<config[_0x4f2999(0x9c)]['length'];_0x13d808++){const _0x59601c=config['locals'][_0x13d808];if(_0x59601c=='zh'||_0x59601c[_0x4f2999(0x7e)]()==_0x4f2999(0xd1)){await handleLocalFile(_0x14fadc,path['join'](path[_0x4f2999(0xaf)](_0x217390),''+_0x59601c+_0x5c39be));return;}await handleLocalFile(_0x14fadc,path['join'](path[_0x4f2999(0xaf)](_0x217390),''+_0x59601c+_0x5c39be),_0x59601c,config['translate'][_0x4f2999(0x8c)](_0x59601c));}}else{!fs[_0x4f2999(0x87)](_0x217390)&&fs['mkdirSync'](_0x217390,{'recursive':!![]});handleLocalFile(_0x14fadc,path[_0x4f2999(0xa0)](_0x217390,'local.json'));for(let _0x162899=0x0;_0x162899<config[_0x4f2999(0x9c)]['length'];_0x162899++){const _0x30ef3e=config[_0x4f2999(0x9c)][_0x162899];if(_0x30ef3e=='zh'||_0x30ef3e['toLowerCase']()=='zh_cn'){await handleLocalFile(_0x14fadc,path[_0x4f2999(0xa0)](_0x217390,_0x30ef3e+_0x4f2999(0x73)));return;}await handleLocalFile(_0x14fadc,path[_0x4f2999(0xa0)](_0x217390,_0x30ef3e+_0x4f2999(0x73)),_0x30ef3e,config[_0x4f2999(0x98)][_0x4f2999(0x8c)](_0x30ef3e));}}}async function handleLocalFile(_0x5f522e,_0x27791b,_0x481ac4,_0x522b0a){const _0x38158b=function(_0x4bdde2){const _0x1a5b5a=a0_0x3816,_0x2c4f09=path[_0x1a5b5a(0x74)](_0x27791b);if(_0x2c4f09=='.js'){let _0x1dd369=Object[_0x1a5b5a(0x93)](_0x4bdde2)[_0x1a5b5a(0xa8)](_0x394983=>'\x20\x20'+_0x394983+_0x1a5b5a(0x82)+_0x4bdde2[_0x394983]+'\x22')[_0x1a5b5a(0xa0)](',\x0d');fs['writeFileSync'](_0x27791b,_0x1a5b5a(0x78)+_0x1dd369+'\x0d}');}else{let _0x39362c=Object['keys'](_0x4bdde2)[_0x1a5b5a(0xa8)](_0x191185=>_0x1a5b5a(0x86)+_0x191185+'\x22:\x20\x22'+_0x4bdde2[_0x191185]+'\x22')['join'](',\x0d');fs[_0x1a5b5a(0x8b)](_0x27791b,'{\x0d'+_0x39362c+'\x0d}');}};let _0x8ae411,_0x1ea277;getFileContent(_0x27791b,_0x120ea6=>{const _0x21e72d=a0_0x3816;_0x8ae411=Object[_0x21e72d(0x9a)]({},_0x5f522e,_0x120ea6),_0x1ea277=getExtraValues(_0x5f522e,_0x120ea6);},()=>{const _0x3ba281=a0_0x3816;_0x8ae411=JSON[_0x3ba281(0x89)](JSON[_0x3ba281(0x7a)](_0x5f522e)),_0x1ea277=JSON[_0x3ba281(0x89)](JSON[_0x3ba281(0x7a)](_0x5f522e));}),_0x522b0a?await translater(_0x1ea277,_0x481ac4,config,_0x484acd=>{const _0xa0cad8=a0_0x3816;_0x8ae411=Object[_0xa0cad8(0x9a)](_0x8ae411,_0x484acd),_0x38158b(_0x8ae411);}):_0x38158b(_0x8ae411);}function getExtraValues(_0x15f47d,_0x5ad994){const _0x39570d=a0_0x5da5b4,_0x5e6b01=Object['keys'](_0x15f47d)[_0x39570d(0x6c)](_0x2b3521=>!_0x5ad994[_0x39570d(0xbb)](_0x2b3521)),_0x5240f6={};return _0x5e6b01[_0x39570d(0xc6)](_0x39bab8=>{_0x5240f6[_0x39bab8]=_0x15f47d[_0x39bab8];}),_0x5240f6;} |
@@ -1,1 +0,1 @@ | ||
const a1_0x1d1a02=a1_0x1082;function a1_0x1082(_0x355c9f,_0x5ca24f){const _0x5f1cf9=a1_0x5f1c();return a1_0x1082=function(_0x10823a,_0x362b0f){_0x10823a=_0x10823a-0x8f;let _0x11683c=_0x5f1cf9[_0x10823a];return _0x11683c;},a1_0x1082(_0x355c9f,_0x5ca24f);}(function(_0x5f5d02,_0x5a2451){const _0x1bf93f=a1_0x1082,_0x3acce7=_0x5f5d02();while(!![]){try{const _0xae95e1=parseInt(_0x1bf93f(0x9d))/0x1+-parseInt(_0x1bf93f(0xab))/0x2+parseInt(_0x1bf93f(0x94))/0x3+parseInt(_0x1bf93f(0xa3))/0x4*(-parseInt(_0x1bf93f(0xa1))/0x5)+-parseInt(_0x1bf93f(0xa5))/0x6*(parseInt(_0x1bf93f(0x91))/0x7)+-parseInt(_0x1bf93f(0xb3))/0x8+parseInt(_0x1bf93f(0x9f))/0x9;if(_0xae95e1===_0x5a2451)break;else _0x3acce7['push'](_0x3acce7['shift']());}catch(_0x1df554){_0x3acce7['push'](_0x3acce7['shift']());}}}(a1_0x5f1c,0x6b165));function makeMap(_0x1ae4f6,_0x5a3f0b){const _0x34c378=a1_0x1082,_0x12bb94=Object[_0x34c378(0xa9)](null),_0x4818e0=_0x1ae4f6[_0x34c378(0x9b)](',');for(let _0x6ae34f=0x0;_0x6ae34f<_0x4818e0[_0x34c378(0xb6)];_0x6ae34f++){_0x12bb94[_0x4818e0[_0x6ae34f]]=!![];}return _0x5a3f0b?_0x3a34fe=>_0x12bb94[_0x3a34fe[_0x34c378(0xa2)]()]:_0xc195e9=>_0x12bb94[_0xc195e9];}const doctype=/^<!DOCTYPE [^>]+>/i,endTag=/^<\/([a-zA-Z_][\-\.0-9_a-zA-Z]*)[^>]*>/,startTagOpen=/^<([a-zA-Z_][\-\.0-9_a-zA-Z]*)/,attribute=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,dynamicArgAttribute=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,startTagClose=/^\s*(\/?)>/,isPlainTextElement=makeMap(a1_0x1d1a02(0xaf),!![]),isIgnoreNewlineTag=makeMap(a1_0x1d1a02(0x97),!![]),shouldIgnoreFirstNewline=(_0x73cbf7,_0x58554a)=>_0x73cbf7&&isIgnoreNewlineTag(_0x73cbf7)&&_0x58554a[0x0]==='\x0a',decodingMap={'<':'<','>':'>','"':'\x22','&':'&',' ':'\x0a','	':'\x09',''':'\x27'},encodedAttr=/&(?:lt|gt|quot|amp|#39);/g,encodedAttrWithNewLines=/&(?:lt|gt|quot|amp|#39|#10|#9);/g;function decodeAttr(_0x29fca7,_0x512461){const _0x45de4c=a1_0x1d1a02,_0x4852e0=_0x512461?encodedAttrWithNewLines:encodedAttr;return _0x29fca7[_0x45de4c(0x93)](_0x4852e0,_0x1bc8fd=>decodingMap[_0x1bc8fd]);}parseHTML(a1_0x1d1a02(0xa8));function parseHTML(_0x269bbe,_0x5c5551={'shouldDecodeNewlines':!![],'shouldDecodeNewlinesForHref':!![]}){const _0x167cb9=a1_0x1d1a02,_0xdb307=[];let _0x4d5646=0x0,_0x1a68f1,_0x2c411d;while(_0x269bbe){_0x1a68f1=_0x269bbe,console['log'](_0x269bbe);if(!_0x2c411d||!isPlainTextElement(_0x2c411d)){let _0x5f36e0=_0x269bbe['indexOf']('<');if(_0x5f36e0===0x0){const _0x4aa71b=_0x269bbe[_0x167cb9(0xa7)](doctype);if(_0x4aa71b){_0xb4a73c(_0x4aa71b[0x0][_0x167cb9(0xb6)]);continue;}const _0x1b36d9=_0x269bbe['match'](endTag);if(_0x1b36d9){console[_0x167cb9(0xb4)]('【结束标签】:'+_0x1b36d9[0x1]);const _0x48be73=_0x4d5646;_0xb4a73c(_0x1b36d9[0x0][_0x167cb9(0xb6)]),_0x37cb7e(_0x1b36d9[0x1],_0x48be73,_0x4d5646);continue;}const _0x3c98f2=_0x174d8e();if(_0x3c98f2){console[_0x167cb9(0xb4)]('【'+(_0x3c98f2[_0x167cb9(0x9c)]?_0x167cb9(0xac):_0x167cb9(0xae))+'】:'+_0x3c98f2[_0x167cb9(0xa4)]);continue;}}let _0x409b94,_0x2a93b7,_0x24efa6;if(_0x5f36e0>=0x0){_0x2a93b7=_0x269bbe[_0x167cb9(0x95)](_0x5f36e0);while(!endTag[_0x167cb9(0x92)](_0x2a93b7)&&!startTagOpen[_0x167cb9(0x92)](_0x2a93b7)){_0x24efa6=_0x2a93b7[_0x167cb9(0x9e)]('<',0x1);if(_0x24efa6<0x0)break;_0x5f36e0+=_0x24efa6,_0x2a93b7=_0x269bbe['slice'](_0x5f36e0);}_0x409b94=_0x269bbe[_0x167cb9(0xb0)](0x0,_0x5f36e0),console[_0x167cb9(0xb4)](_0x167cb9(0xb2)+_0x409b94);}_0x5f36e0<0x0&&(_0x409b94=_0x269bbe),_0x409b94&&_0xb4a73c(_0x409b94[_0x167cb9(0xb6)]);}else{}if(_0x269bbe===_0x1a68f1){}}function _0xb4a73c(_0xeff216){_0x4d5646+=_0xeff216,_0x269bbe=_0x269bbe['substring'](_0xeff216);}function _0x174d8e(){const _0x56ad13=_0x167cb9,_0x3563f9=_0x269bbe[_0x56ad13(0xa7)](startTagOpen);if(_0x3563f9){const _0x5c15d7={'tagName':_0x3563f9[0x1],'attrs':[],'start':_0x4d5646};_0xb4a73c(_0x3563f9[0x0][_0x56ad13(0xb6)]);let _0x3b3ef8,_0x3cd838;while(!(_0x3b3ef8=_0x269bbe[_0x56ad13(0xa7)](startTagClose))&&(_0x3cd838=_0x269bbe[_0x56ad13(0xa7)](dynamicArgAttribute)||_0x269bbe[_0x56ad13(0xa7)](attribute))){_0x3cd838['start']=_0x4d5646,_0xb4a73c(_0x3cd838[0x0]['length']),_0x3cd838['end']=_0x4d5646,_0x5c15d7[_0x56ad13(0x98)][_0x56ad13(0xb5)](_0x3cd838);}if(_0x3b3ef8)return _0x5c15d7['unarySlash']=_0x3b3ef8[0x1],_0xb4a73c(_0x3b3ef8[0x0][_0x56ad13(0xb6)]),_0x5c15d7[_0x56ad13(0xb1)]=_0x4d5646,_0x5c15d7;}}function _0x30ea3a(_0x418bd5){const _0x3f4e6e=_0x167cb9,_0x1839ac=_0x418bd5[_0x3f4e6e(0xa4)],_0x4d55b1=!!_0x418bd5['unarySlash'],_0x21a8af=_0x418bd5['attrs']['length'],_0x26968e=new Array(_0x21a8af);for(let _0x135637=0x0;_0x135637<_0x21a8af;_0x135637++){const _0x5cfaac=_0x418bd5['attrs'][_0x135637],_0x5c69d2=_0x5cfaac[0x3]||_0x5cfaac[0x4]||_0x5cfaac[0x5]||'',_0x1b36e1=_0x1839ac==='a'&&_0x5cfaac[0x1]===_0x3f4e6e(0xa0)?_0x5c5551[_0x3f4e6e(0xaa)]:_0x5c5551[_0x3f4e6e(0x8f)];_0x26968e[_0x135637]={'name':_0x5cfaac[0x1],'value':decodeAttr(_0x5c69d2,_0x1b36e1)};}!_0x4d55b1&&(_0xdb307[_0x3f4e6e(0xb5)]({'tag':_0x1839ac,'lowerCasedTag':_0x1839ac['toLowerCase'](),'attrs':_0x26968e,'start':_0x418bd5[_0x3f4e6e(0x90)],'end':_0x418bd5[_0x3f4e6e(0xb1)]}),_0x2c411d=_0x1839ac);}function _0x37cb7e(_0xd05186,_0x1c6769,_0x4f3446){const _0x8d76aa=_0x167cb9;let _0x188011,_0x1ab5b9;if(_0x1c6769==null)_0x1c6769=_0x4d5646;if(_0x4f3446==null)_0x4f3446=_0x4d5646;if(_0xd05186){_0x1ab5b9=_0xd05186[_0x8d76aa(0xa2)]();for(_0x188011=_0xdb307['length']-0x1;_0x188011>=0x0;_0x188011--){if(_0xdb307[_0x188011][_0x8d76aa(0xad)]===_0x1ab5b9)break;}}else _0x188011=0x0;console[_0x8d76aa(0xb4)](_0x8d76aa(0x96)+_0x188011);if(_0x188011>=0x0){for(let _0x514966=_0xdb307[_0x8d76aa(0xb6)]-0x1;_0x514966>=_0x188011;_0x514966--){(_0x514966>_0x188011||!_0xd05186)&&console[_0x8d76aa(0xa6)](_0x8d76aa(0xb7)+_0xdb307[_0x514966][_0x8d76aa(0x99)]+_0x8d76aa(0x9a));}_0xdb307[_0x8d76aa(0xb6)]=_0x188011,_0x2c411d=_0x188011&&_0xdb307[_0x188011-0x1][_0x8d76aa(0x99)];}}}function a1_0x5f1c(){const _0x1747da=['test','replace','2317407bRdxKi','slice','ssss','pre,textarea','attrs','tag','>\x20has\x20no\x20matching\x20end\x20tag.','split','unarySlash','299256EwLOeZ','indexOf','7715871CehdXK','href','2070OncGuC','toLowerCase','4956fapbHm','tagName','2805258nXBrQh','warn','match','<div><span\x20class=\x22title\x22>测试</span><my-component/></div>','create','shouldDecodeNewlinesForHref','622262iDvqEt','闭合标签','lowerCasedTag','开始标签','script,style,textarea','substring','end','【文本内容】:','1590360JhgYAN','log','push','length','tag\x20<','shouldDecodeNewlines','start','7tCqkcR'];a1_0x5f1c=function(){return _0x1747da;};return a1_0x5f1c();} | ||
const a1_0x303419=a1_0x32a3;function a1_0x32a3(_0x2022e0,_0x247247){const _0x28674f=a1_0x2867();return a1_0x32a3=function(_0x32a356,_0x3c03ce){_0x32a356=_0x32a356-0x1c1;let _0x373002=_0x28674f[_0x32a356];return _0x373002;},a1_0x32a3(_0x2022e0,_0x247247);}(function(_0x33ff6d,_0x5c4506){const _0x3d3cba=a1_0x32a3,_0x1610e1=_0x33ff6d();while(!![]){try{const _0x89d76e=-parseInt(_0x3d3cba(0x1e3))/0x1+-parseInt(_0x3d3cba(0x1c3))/0x2+-parseInt(_0x3d3cba(0x1c2))/0x3*(-parseInt(_0x3d3cba(0x1cc))/0x4)+parseInt(_0x3d3cba(0x1e0))/0x5+parseInt(_0x3d3cba(0x1d6))/0x6+parseInt(_0x3d3cba(0x1ca))/0x7*(parseInt(_0x3d3cba(0x1dc))/0x8)+-parseInt(_0x3d3cba(0x1d9))/0x9;if(_0x89d76e===_0x5c4506)break;else _0x1610e1['push'](_0x1610e1['shift']());}catch(_0x25d5f5){_0x1610e1['push'](_0x1610e1['shift']());}}}(a1_0x2867,0xb57e6));function a1_0x2867(){const _0x11b3c6=['href','3651SosJEw','2369832TxPkIi','log','tag','warn','split','test','>\x20has\x20no\x20matching\x20end\x20tag.','1387960xGJsqe','shouldDecodeNewlinesForHref','3524ahNBGA','indexOf','start','match','pre,textarea','开始标签','replace','substring','push','end','2016180Rgbqnn','ssss','tagName','10534860hRTXBg','length','script,style,textarea','40reBZsm','slice','【文本内容】:','lowerCasedTag','5509200PaWUoS','toLowerCase','unarySlash','402593gSulck','create','attrs'];a1_0x2867=function(){return _0x11b3c6;};return a1_0x2867();}function makeMap(_0x1fbe5c,_0x5759b6){const _0x49a5ea=a1_0x32a3,_0x37e544=Object[_0x49a5ea(0x1e4)](null),_0x414e44=_0x1fbe5c[_0x49a5ea(0x1c7)](',');for(let _0x2c7189=0x0;_0x2c7189<_0x414e44[_0x49a5ea(0x1da)];_0x2c7189++){_0x37e544[_0x414e44[_0x2c7189]]=!![];}return _0x5759b6?_0x4d5e02=>_0x37e544[_0x4d5e02[_0x49a5ea(0x1e1)]()]:_0x3ec4f2=>_0x37e544[_0x3ec4f2];}const doctype=/^<!DOCTYPE [^>]+>/i,endTag=/^<\/([a-zA-Z_][\-\.0-9_a-zA-Z]*)[^>]*>/,startTagOpen=/^<([a-zA-Z_][\-\.0-9_a-zA-Z]*)/,attribute=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,dynamicArgAttribute=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,startTagClose=/^\s*(\/?)>/,isPlainTextElement=makeMap(a1_0x303419(0x1db),!![]),isIgnoreNewlineTag=makeMap(a1_0x303419(0x1d0),!![]),shouldIgnoreFirstNewline=(_0x90f5e9,_0x3cf09f)=>_0x90f5e9&&isIgnoreNewlineTag(_0x90f5e9)&&_0x3cf09f[0x0]==='\x0a',decodingMap={'<':'<','>':'>','"':'\x22','&':'&',' ':'\x0a','	':'\x09',''':'\x27'},encodedAttr=/&(?:lt|gt|quot|amp|#39);/g,encodedAttrWithNewLines=/&(?:lt|gt|quot|amp|#39|#10|#9);/g;function decodeAttr(_0x1d175c,_0x8d765b){const _0x1e4f10=a1_0x303419,_0x5d610f=_0x8d765b?encodedAttrWithNewLines:encodedAttr;return _0x1d175c[_0x1e4f10(0x1d2)](_0x5d610f,_0x19e408=>decodingMap[_0x19e408]);}parseHTML('<div><span\x20class=\x22title\x22>测试</span><my-component/></div>');function parseHTML(_0xd30c,_0x3c84f5={'shouldDecodeNewlines':!![],'shouldDecodeNewlinesForHref':!![]}){const _0x3d1bbd=a1_0x303419,_0x465be4=[];let _0x518580=0x0,_0x217d0f,_0x3ee37d;while(_0xd30c){_0x217d0f=_0xd30c,console[_0x3d1bbd(0x1c4)](_0xd30c);if(!_0x3ee37d||!isPlainTextElement(_0x3ee37d)){let _0x1e6e75=_0xd30c['indexOf']('<');if(_0x1e6e75===0x0){const _0x4a6e3f=_0xd30c['match'](doctype);if(_0x4a6e3f){_0x48fd6f(_0x4a6e3f[0x0]['length']);continue;}const _0x55bd24=_0xd30c[_0x3d1bbd(0x1cf)](endTag);if(_0x55bd24){console[_0x3d1bbd(0x1c4)]('【结束标签】:'+_0x55bd24[0x1]);const _0x4dcb8f=_0x518580;_0x48fd6f(_0x55bd24[0x0][_0x3d1bbd(0x1da)]),_0x218268(_0x55bd24[0x1],_0x4dcb8f,_0x518580);continue;}const _0x5610ed=_0x4efd65();if(_0x5610ed){console[_0x3d1bbd(0x1c4)]('【'+(_0x5610ed[_0x3d1bbd(0x1e2)]?'闭合标签':_0x3d1bbd(0x1d1))+'】:'+_0x5610ed[_0x3d1bbd(0x1d8)]);continue;}}let _0x699405,_0x31652f,_0x23d57a;if(_0x1e6e75>=0x0){_0x31652f=_0xd30c[_0x3d1bbd(0x1dd)](_0x1e6e75);while(!endTag[_0x3d1bbd(0x1c8)](_0x31652f)&&!startTagOpen[_0x3d1bbd(0x1c8)](_0x31652f)){_0x23d57a=_0x31652f[_0x3d1bbd(0x1cd)]('<',0x1);if(_0x23d57a<0x0)break;_0x1e6e75+=_0x23d57a,_0x31652f=_0xd30c['slice'](_0x1e6e75);}_0x699405=_0xd30c[_0x3d1bbd(0x1d3)](0x0,_0x1e6e75),console['log'](_0x3d1bbd(0x1de)+_0x699405);}_0x1e6e75<0x0&&(_0x699405=_0xd30c),_0x699405&&_0x48fd6f(_0x699405[_0x3d1bbd(0x1da)]);}else{}if(_0xd30c===_0x217d0f){}}function _0x48fd6f(_0x45f196){const _0x4bea99=_0x3d1bbd;_0x518580+=_0x45f196,_0xd30c=_0xd30c[_0x4bea99(0x1d3)](_0x45f196);}function _0x4efd65(){const _0x254378=_0x3d1bbd,_0x40a7b8=_0xd30c[_0x254378(0x1cf)](startTagOpen);if(_0x40a7b8){const _0x26d68e={'tagName':_0x40a7b8[0x1],'attrs':[],'start':_0x518580};_0x48fd6f(_0x40a7b8[0x0][_0x254378(0x1da)]);let _0xe4cb3c,_0x103388;while(!(_0xe4cb3c=_0xd30c[_0x254378(0x1cf)](startTagClose))&&(_0x103388=_0xd30c[_0x254378(0x1cf)](dynamicArgAttribute)||_0xd30c[_0x254378(0x1cf)](attribute))){_0x103388['start']=_0x518580,_0x48fd6f(_0x103388[0x0][_0x254378(0x1da)]),_0x103388['end']=_0x518580,_0x26d68e[_0x254378(0x1e5)][_0x254378(0x1d4)](_0x103388);}if(_0xe4cb3c)return _0x26d68e['unarySlash']=_0xe4cb3c[0x1],_0x48fd6f(_0xe4cb3c[0x0][_0x254378(0x1da)]),_0x26d68e[_0x254378(0x1d5)]=_0x518580,_0x26d68e;}}function _0x1bb812(_0x215961){const _0x14689c=_0x3d1bbd,_0x2949f4=_0x215961['tagName'],_0x305b59=!!_0x215961[_0x14689c(0x1e2)],_0x4fc7a7=_0x215961[_0x14689c(0x1e5)][_0x14689c(0x1da)],_0x35d9d1=new Array(_0x4fc7a7);for(let _0x5651ea=0x0;_0x5651ea<_0x4fc7a7;_0x5651ea++){const _0x547330=_0x215961['attrs'][_0x5651ea],_0xba4e6e=_0x547330[0x3]||_0x547330[0x4]||_0x547330[0x5]||'',_0x5d7d4c=_0x2949f4==='a'&&_0x547330[0x1]===_0x14689c(0x1c1)?_0x3c84f5[_0x14689c(0x1cb)]:_0x3c84f5['shouldDecodeNewlines'];_0x35d9d1[_0x5651ea]={'name':_0x547330[0x1],'value':decodeAttr(_0xba4e6e,_0x5d7d4c)};}!_0x305b59&&(_0x465be4[_0x14689c(0x1d4)]({'tag':_0x2949f4,'lowerCasedTag':_0x2949f4['toLowerCase'](),'attrs':_0x35d9d1,'start':_0x215961[_0x14689c(0x1ce)],'end':_0x215961[_0x14689c(0x1d5)]}),_0x3ee37d=_0x2949f4);}function _0x218268(_0x1bf47c,_0x3d8f72,_0x818778){const _0x300d6e=_0x3d1bbd;let _0x560e34,_0x3bdc43;if(_0x3d8f72==null)_0x3d8f72=_0x518580;if(_0x818778==null)_0x818778=_0x518580;if(_0x1bf47c){_0x3bdc43=_0x1bf47c[_0x300d6e(0x1e1)]();for(_0x560e34=_0x465be4[_0x300d6e(0x1da)]-0x1;_0x560e34>=0x0;_0x560e34--){if(_0x465be4[_0x560e34][_0x300d6e(0x1df)]===_0x3bdc43)break;}}else _0x560e34=0x0;console['log'](_0x300d6e(0x1d7)+_0x560e34);if(_0x560e34>=0x0){for(let _0x15b578=_0x465be4[_0x300d6e(0x1da)]-0x1;_0x15b578>=_0x560e34;_0x15b578--){(_0x15b578>_0x560e34||!_0x1bf47c)&&console[_0x300d6e(0x1c6)]('tag\x20<'+_0x465be4[_0x15b578]['tag']+_0x300d6e(0x1c9));}_0x465be4[_0x300d6e(0x1da)]=_0x560e34,_0x3ee37d=_0x560e34&&_0x465be4[_0x560e34-0x1][_0x300d6e(0x1c5)];}}} |
{ | ||
"name": "translate-compiler", | ||
"version": "0.6.0-beta", | ||
"version": "0.7.0-beta", | ||
"description": "Vue 国际化i18n编译器,自动提取项目(.vue)文件中的”中文“并替换为多语言($t(key)),并导出全部翻译到指定文件。", | ||
@@ -10,3 +10,3 @@ "main": "main/index.js", | ||
"scripts": { | ||
"dev": "node lib/index.js test --dir example -o example/locals/local.json -l en --strict", | ||
"dev": "node lib/index.js dev --dir example -o example/locals/local.json -l en ja --strict", | ||
"test": "node lib/index.js test --dir example -o example/locals -l zh en", | ||
@@ -13,0 +13,0 @@ "obf": "javascript-obfuscator lib --output main" |
@@ -22,8 +22,12 @@ # translate-compiler | ||
Options: | ||
-d, --dir <dir> 翻译的文件夹 | ||
-l, --locals <value...> 需要生成的地区语言(语种代码)如:zh等" | ||
-s, --suffix <value> 翻译的文件名后缀,默认:.vue | ||
-e, --excludes <value...> 排除翻译的文件,可指定多个 | ||
-o, --output <file> 翻译输出文件写入的文件(夹)路径,默认:locals/local.json | ||
--strict 是否严格模式, 严格模式只提取$t()内中文,否则全局 | ||
-d, --dir <dir> 翻译的文件夹 | ||
-l, --locals <value...> 需要生成的地区语言,参考下方常见语种列表 | ||
-t, --translate <value...> 需要翻译的语言,对应locals语种代码 | ||
--channel <value> 翻译渠道 baidu 百度,youdao 有道 | ||
--appKey <value> 翻译api 应用key | ||
--secretKey <value> 翻译api 密钥 | ||
-s, --suffix <value> 翻译的文件名后缀,默认:.vue | ||
-e, --excludes <value...> 排除翻译的文件,可指定多个 | ||
-o, --output <file> 翻译输出文件写入的文件(夹)路径,默认:locals/local.json | ||
--strict 是否严格模式, 严格模式只提取$t()内中文,否则全局 | ||
@@ -38,3 +42,8 @@ ``` | ||
- 备注: | ||
- 自动翻译: | ||
- 只有设置了`channel`、`appKey`、`secretKey`、`translate`(且`locals`参数含有该 key),才会执行翻译,默认填充中文。 | ||
- 已经原语言文件存在的 key 不会再做翻译,如需翻译可以删改该 key 或直接删除语言文件重新生成。 | ||
- 其他备注: | ||
1. `test`生成的文件后缀前加`.lang`的新文件,可执行 `dev`/`prod` 删除。 | ||
@@ -49,3 +58,3 @@ 2. `output`支持输出到文件或文件夹,文件支持`js`和`json`格式,指定文件夹则默认文件名为`local.json` | ||
| -------- | ------------ | ------------ | ------------ | ------------ | | ||
| 简体中文 | zh | zh-CHS | zh-cn | zh | | ||
| 简体中文 | zh | zh-CHS | zh-cn | zh | | ||
| 英语 | en | en | en | en | | ||
@@ -52,0 +61,0 @@ | 繁体中文 | cht | zh-CHT | zh-tw | zh-tw | |
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
AI-detected potential malware
Supply chain riskAI has identified this package as malware. This is a strong signal that the package may be malicious.
Found 1 instance in 1 package
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
Unpopular package
QualityThis package is not very popular.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
61514
9
0
410
4
2
9
1