translate-compiler
Advanced tools
Comparing version 0.8.0-beta to 0.8.8-beta
#! /usr/bin/env node | ||
const a0_0x39a010=a0_0x443b;(function(_0x29c8a8,_0x58729f){const _0x2a14e5=a0_0x443b,_0x228d8c=_0x29c8a8();while(!![]){try{const _0x56d8c6=-parseInt(_0x2a14e5(0x220))/0x1*(-parseInt(_0x2a14e5(0x238))/0x2)+parseInt(_0x2a14e5(0x1e0))/0x3*(-parseInt(_0x2a14e5(0x1f2))/0x4)+-parseInt(_0x2a14e5(0x211))/0x5+-parseInt(_0x2a14e5(0x1e9))/0x6+-parseInt(_0x2a14e5(0x242))/0x7*(-parseInt(_0x2a14e5(0x22b))/0x8)+-parseInt(_0x2a14e5(0x203))/0x9+parseInt(_0x2a14e5(0x1fa))/0xa*(parseInt(_0x2a14e5(0x1fc))/0xb);if(_0x56d8c6===_0x58729f)break;else _0x228d8c['push'](_0x228d8c['shift']());}catch(_0x94d069){_0x228d8c['push'](_0x228d8c['shift']());}}}(a0_0xcbf5,0xda7a1));const fs=require('fs'),path=require(a0_0x39a010(0x1dc)),{program}=require(a0_0x39a010(0x20c)),{pinyin}=require('pinyin-pro'),{translater}=require(a0_0x39a010(0x22c)),_path=process[a0_0x39a010(0x21d)]();function hasChinese(_0x1fe619){const _0x334fdb=a0_0x39a010;return/[\u4e00-\u9fa5]/g[_0x334fdb(0x1ea)](_0x1fe619);}let customLang={},config={'env':a0_0x39a010(0x1df),'locals':[],'excludes':[],'translate':[],'channel':'baidu','appKey':'','secretKey':'','suffix':a0_0x39a010(0x230),'output':a0_0x39a010(0x234)};getConfig();function getConfig(){const _0x5a7794=a0_0x39a010;program[_0x5a7794(0x1ec)](_0x5a7794(0x20a),_0x5a7794(0x205))['requiredOption'](_0x5a7794(0x200),'翻译的文件夹')[_0x5a7794(0x225)](_0x5a7794(0x218),_0x5a7794(0x207))[_0x5a7794(0x225)](_0x5a7794(0x23f),_0x5a7794(0x21c))['option']('--appKey\x20<value>',_0x5a7794(0x1e4))['option'](_0x5a7794(0x1f1),_0x5a7794(0x1e5))[_0x5a7794(0x225)](_0x5a7794(0x217),_0x5a7794(0x1ef))[_0x5a7794(0x225)](_0x5a7794(0x224),_0x5a7794(0x204))[_0x5a7794(0x225)]('-e,\x20--excludes\x20<value...>',_0x5a7794(0x214))[_0x5a7794(0x225)]('-o,\x20--output\x20<file>',_0x5a7794(0x240))[_0x5a7794(0x225)](_0x5a7794(0x215),_0x5a7794(0x206)),program[_0x5a7794(0x1d7)]();const _0x305f51=program[_0x5a7794(0x208)]();config=Object[_0x5a7794(0x222)](config,_0x305f51,{'env':program[_0x5a7794(0x233)][0x0]}),getFileContent(path['join'](_path,_0x5a7794(0x22f)),_0x3cf782=>{const _0x55f127=_0x5a7794;customLang=_0x3cf782,console[_0x55f127(0x20b)]('-\x20读取字典:\x20读取自定义字典\x27translate.json\x27成功!');},()=>{const _0x37b97c=_0x5a7794;console[_0x37b97c(0x20b)](_0x37b97c(0x22a));});}function getFileContent(_0x530785,_0x4c17f4,_0x10a3fd){const _0xb39c9b=a0_0x39a010;if(fs['existsSync'](_0x530785))try{let _0x123ddd=fs[_0xb39c9b(0x1ee)](_0x530785,{'encoding':_0xb39c9b(0x232)});const _0x550777=path[_0xb39c9b(0x227)](_0x530785);if(_0x550777==_0xb39c9b(0x1e8))_0x4c17f4&&_0x4c17f4(JSON[_0xb39c9b(0x1d7)](_0x123ddd));else{let _0x546eb0={};_0x123ddd[_0xb39c9b(0x23b)](/['"]*(\w+)['"]*:\s*"([^"]+)"/g,(_0x543be8,_0x2102fb,_0x2adc32)=>{_0x546eb0[_0x2102fb]=_0x2adc32;}),_0x4c17f4&&_0x4c17f4(_0x546eb0);}}catch(_0x25ded4){_0x10a3fd&&_0x10a3fd(_0xb39c9b(0x1f4));}else _0x10a3fd&&_0x10a3fd(_0xb39c9b(0x236));}function a0_0xcbf5(){const _0x5246a0=['locals','dev','390534xSCqYF','join','split','translate','翻译api\x20应用key','翻译api\x20密钥','forEach','-\x20执行文件:','.json','2478444UPAueN','test','match','argument','\x27)\x20}}','readFileSync','需要翻译的语言,对应locals','map','--secretKey\x20<value>','36GPJpfo','{{\x20$t(\x27','读取文件失败','this.$t(','this.$t(\x27','this.$t($key)','basename','parseInt','28698370wZArhs','toLowerCase','11hqCqNs','array','unlinkSync','readdirSync','-d,\x20--dir\x20<dir>','filter','excludes','7682175ULnlDN','翻译的文件名后缀,默认.vue','指定环境:dev(开发)/test(测试)/prod(生产),默认为开发环境','是否严格模式,\x20严格模式只提取$t()内中文,否则全局','需要生成的地区语言(语种代码)如:zh等','opts','fill','<env>','log','commander','.lang.$1','content','reduce','local.json','4492750UUGBVl','first','values','排除翻译的文件,可指定多个','--strict','\x20\x20\x22','-t,\x20--translate\x20<value...>','-l,\x20--locals\x20<value...>','strict','push','.lang','翻译渠道\x20baidu百度,youdao有道','cwd','keys','$t($key)','1036244rgDMTj','$t(','assign','output','-s,\x20--suffix\x20<value>','option','includes','extname','obj','env','-\x20读取字典:\x20未读取到自定义字典translate.json!','8kyYIbU','./parser/translater','dirname','isDirectory','/translate.json','.vue','hasOwnProperty','utf-8','args','locals/local.json','zh_cn','文件不存在','mkdirSync','2NEKDkv','lstatSync','length','replace','indexOf','none','\x27,\x20[','-c,\x20--channel\x20<value>','翻译结果写入路径,默认locals/local.json','writeFileSync','2279207OFYPtS','parse','??????FILE_NAME_TO_LONG','prod','existsSync','suffix','path','.js'];a0_0xcbf5=function(){return _0x5246a0;};return a0_0xcbf5();}function getSuffixFiles(_0x21b381,_0x3a4acd,_0x40fee9){const _0x242032=a0_0x39a010,_0x12f665=fs['readdirSync'](_0x21b381),_0xcadf32=[];return _0x12f665[_0x242032(0x1e6)]((_0x155f62,_0x269860)=>{const _0x4fe007=_0x242032,_0x22c6b8=path[_0x4fe007(0x1e1)](_0x21b381,_0x155f62),_0x174192=fs[_0x4fe007(0x239)](_0x22c6b8);if(_0x174192[_0x4fe007(0x22e)]())_0xcadf32[_0x4fe007(0x21a)](...getSuffixFiles(_0x22c6b8,_0x3a4acd,_0x40fee9));else path[_0x4fe007(0x227)](_0x155f62)==_0x3a4acd&&!_0x40fee9['includes'](path[_0x4fe007(0x227)](_0x155f62))&&_0xcadf32[_0x4fe007(0x21a)](_0x22c6b8);}),_0xcadf32;}function delSuffixFiles(_0x35e665,_0x42b3c2,_0x5ae079){const _0x2873ff=a0_0x39a010,_0x1117bf=fs[_0x2873ff(0x1ff)](_0x35e665);_0x1117bf[_0x2873ff(0x1e6)]((_0x209ff8,_0x435ca1)=>{const _0x422ca8=_0x2873ff,_0x4be59a=path[_0x422ca8(0x1e1)](_0x35e665,_0x209ff8),_0x537815=fs[_0x422ca8(0x239)](_0x4be59a),_0x1fd63e=new RegExp(_0x422ca8(0x21b)+_0x42b3c2+'$');if(_0x537815['isDirectory']())delSuffixFiles(_0x4be59a,_0x42b3c2,_0x5ae079);else _0x1fd63e[_0x422ca8(0x1ea)](_0x209ff8)&&!_0x5ae079['includes'](path[_0x422ca8(0x227)](_0x209ff8))&&fs[_0x422ca8(0x1fe)](_0x4be59a);});}function getTranslateKey(_0x51b13c,_0x1de71a){const _0x544802=a0_0x39a010;if(_0x1de71a[_0x544802(0x23a)]>0x28)return _0x544802(0x1d8);const _0x33029a=/^(['"`])|['"`]$/g,_0x42a11f=/\$*\{(.*?)\}/g;let _0x4b228c=_0x51b13c[_0x544802(0x23b)](_0x33029a,'');const _0x5ab64e=(_0x4b228c[_0x544802(0x1eb)](_0x42a11f)||[])[_0x544802(0x20f)]((_0x19f23d,_0x2a28d4,_0x808050)=>_0x19f23d[_0x544802(0x23b)](_0x2a28d4,'{'+_0x808050+'}'),_0x4b228c),_0xc23296=Object[_0x544802(0x213)](customLang)[_0x544802(0x23c)](_0x5ab64e);if(_0xc23296!==-0x1)return Object[_0x544802(0x21e)](customLang)[_0xc23296];_0x4b228c=_0x4b228c[_0x544802(0x23b)](_0x42a11f,'o'),_0x4b228c=_0x4b228c[_0x544802(0x23b)](/[^\u4e00-\u9fa5\w]/g,'');let _0x110214=_0x4b228c[_0x544802(0x23b)](/([\u4e00-\u9fa5]+)/g,_0x3e1478=>{const _0x13523d=_0x544802;return pinyin(_0x3e1478,{'toneType':'none','type':_0x13523d(0x1fd)})['join']('_');}),_0x2137fa=_0x1de71a+'_'+_0x110214;if(_0x2137fa[_0x544802(0x23a)]>0x1e){_0x110214=_0x4b228c['replace'](/([\u4e00-\u9fa5]+)/g,_0x4c2ca6=>{const _0x1da37d=_0x544802;return pinyin(_0x4c2ca6,{'pattern':_0x1da37d(0x212),'toneType':_0x1da37d(0x23d),'type':_0x1da37d(0x1fd)})[_0x1da37d(0x1e1)]('');}),_0x2137fa=_0x1de71a+'_'+_0x110214;if(_0x2137fa[_0x544802(0x23a)]>0x32){const _0xd72144=Number[_0x544802(0x1f9)](_0x110214[_0x544802(0x23a)]/(0x31-_0x1de71a[_0x544802(0x23a)]))+0x1;_0x110214=new Array(_0x110214[_0x544802(0x23a)])[_0x544802(0x209)]('')['reduce']((_0xbdd000,_0x4cd06e,_0x57afc6)=>''+_0xbdd000+(_0x57afc6%_0xd72144==0x0?_0x110214[_0x57afc6]:''));}_0x2137fa=_0x1de71a+'_'+_0x110214;}return _0x2137fa;}translate();function translate(){const _0x5a35f4=a0_0x39a010;delSuffixFiles(path[_0x5a35f4(0x1e1)](_path,config['dir']),config[_0x5a35f4(0x1db)],config[_0x5a35f4(0x202)]);const _0x1a398b=getSuffixFiles(path[_0x5a35f4(0x1e1)](_path,config['dir']),config[_0x5a35f4(0x1db)],config[_0x5a35f4(0x202)]);let _0x561b06={};_0x1a398b[_0x5a35f4(0x1e6)](function(_0x125a81,_0x4398fb){const _0x5c6956=_0x5a35f4;console['log'](_0x5c6956(0x1e7)+_0x125a81);let _0x511e2f=fs['readFileSync'](_0x125a81,{'encoding':_0x5c6956(0x232)})+'';const _0x443f1c=path[_0x5c6956(0x1f8)](_0x125a81)[_0x5c6956(0x1e2)]('.')[0x0],_0xe6c0d2=/\<template\>(.|\n|\r)*\<\/template\>/g,_0x3d50bb=/<!--[\s\S]*?-->/g,_0xddf850=/\<script\>(.|\n|\r)*\<\/script\>/g,_0x41dff8=/(?<=\s|\;|^|\{|\})\/\/[^\r\n]*/g,_0x497833=/\/\*[\s\S]*?\*\//g;_0x511e2f=_0x511e2f[_0x5c6956(0x23b)](_0xe6c0d2,_0xcf288c=>_0xcf288c['replace'](_0x3d50bb,'')),_0x511e2f=_0x511e2f[_0x5c6956(0x23b)](_0xddf850,_0x5c3225=>_0x5c3225[_0x5c6956(0x23b)](_0x41dff8,'')[_0x5c6956(0x23b)](_0x497833,''));const _0x491b39=/(?<=\$t\()(['"])(.*?)\1/g;_0x511e2f=_0x511e2f[_0x5c6956(0x23b)](_0x491b39,(_0x1e339f,_0x165717,_0x2e58e1)=>{if(hasChinese(_0x1e339f)){const _0x377212=getTranslateKey(_0x1e339f,_0x443f1c);return _0x561b06[_0x377212]=_0x2e58e1,'\x27'+_0x377212+'\x27';}return _0x1e339f;}),_0x511e2f=_0x511e2f[_0x5c6956(0x23b)](_0xe6c0d2,_0x364d30=>{const _0x152f85=_0x5c6956,_0x2f5c85=handleTemplate(_0x364d30,_0x443f1c);return _0x561b06=Object['assign'](_0x561b06,_0x2f5c85[_0x152f85(0x228)]),_0x2f5c85[_0x152f85(0x20e)];}),_0x511e2f=_0x511e2f[_0x5c6956(0x23b)](_0xddf850,_0x58763f=>{const _0x57346b=_0x5c6956,_0x13ec5f=handleScript(_0x58763f,_0x443f1c);return _0x561b06=Object[_0x57346b(0x222)](_0x561b06,_0x13ec5f['obj']),_0x13ec5f[_0x57346b(0x20e)];}),outputLangFile(_0x125a81,_0x511e2f);}),outputLocalFile(_0x561b06);}function handleTemplate(_0x31db6a,_0x206ec0){const _0x3fad1c=a0_0x39a010,_0x52b744=/<([a-z][a-z0-9\-]*)\b[^>]*>(.*?)<\/\1>/g,_0x2aace6=/(?<!\:)\b(?:\w|-)+\=(['"])(.*?)\1/g,_0x3fc81e=handleStringTpl(_0x31db6a,_0x206ec0,!![]);_0x31db6a=_0x3fc81e['content'];let _0x2c7fb9=_0x3fc81e['obj'];return!config[_0x3fad1c(0x219)]&&(_0x31db6a=_0x31db6a[_0x3fad1c(0x23b)](_0x52b744,(_0x368da5,_0x4dbc1a,_0x177093)=>{const _0x2bfb42=_0x3fad1c;if(hasChinese(_0x177093)){if(/\{\{(.*?)\}\}/g['test'](_0x177093)){const _0x931140=handleDoubleBrace(_0x177093,_0x206ec0,_0x2bfb42(0x21f),!![]);return _0x2c7fb9=Object[_0x2bfb42(0x222)](_0x2c7fb9,_0x931140['obj']),_0x368da5['replace'](_0x177093,_0x931140['content']);}const _0x517bdb=getTranslateKey(_0x177093,_0x206ec0);return _0x2c7fb9[_0x517bdb]=_0x177093,_0x368da5[_0x2bfb42(0x23b)](_0x177093,_0x2bfb42(0x1f3)+_0x517bdb+_0x2bfb42(0x1ed));}return _0x368da5;}),_0x31db6a=_0x31db6a[_0x3fad1c(0x23b)](_0x2aace6,(_0x260470,_0x78feb1,_0x31ce74)=>{const _0x1893be=_0x3fad1c;if(hasChinese(_0x31ce74)){const _0x2c755a=getTranslateKey(_0x31ce74,_0x206ec0);return _0x2c7fb9[_0x2c755a]=_0x31ce74,':'+_0x260470[_0x1893be(0x23b)](_0x31ce74,'$t(\x27'+_0x2c755a+'\x27)');}return _0x260470;})),{'content':_0x31db6a,'obj':_0x2c7fb9};}function a0_0x443b(_0x2463a9,_0x2e0066){const _0xcbf559=a0_0xcbf5();return a0_0x443b=function(_0x443bba,_0x25a000){_0x443bba=_0x443bba-0x1d7;let _0x3e9960=_0xcbf559[_0x443bba];return _0x3e9960;},a0_0x443b(_0x2463a9,_0x2e0066);}function handleScript(_0x3e7828,_0x1e043c){const _0x5144de=a0_0x39a010,_0x2d79b4=/(?<!\$t\(\s*)(['"])(.*?)(\1)/g,_0x1debbb=handleStringTpl(_0x3e7828,_0x1e043c);_0x3e7828=_0x1debbb[_0x5144de(0x20e)];let _0x3d0f0e=_0x1debbb[_0x5144de(0x228)];return!config[_0x5144de(0x219)]&&(_0x3e7828=_0x3e7828[_0x5144de(0x23b)](_0x2d79b4,(_0x2d5658,_0x2f2745,_0x53953c)=>{const _0x508e29=_0x5144de;if(hasChinese(_0x2d5658)){const _0x17d93c=getTranslateKey(_0x2d5658,_0x1e043c);return _0x3d0f0e[_0x17d93c]=_0x53953c,_0x508e29(0x1f6)+_0x17d93c+'\x27)';}return _0x2d5658;})),{'content':_0x3e7828,'obj':_0x3d0f0e};}function handleStringTpl(_0x59e3e3,_0x3a9254,_0x136fd6){const _0x431293=a0_0x39a010,_0x4282b3=/(?<!\$t\(\s*)`(.*?)`/g,_0x1407b4=/(?<=\$t\()`(.*?)`/g,_0x126f40=/\${(.*?)}/g;let _0x561a23={};const _0x5c9b50=function(_0x258851,_0x12c0c6,_0x9a23c){const _0x51e55b=a0_0x443b,_0x24c9f8=_0x258851[_0x51e55b(0x23b)](_0x126f40,'');if(hasChinese(_0x24c9f8)){const _0x4ce6cb=getTranslateKey(_0x258851,_0x3a9254),_0x2fbf4f=_0x258851['match'](_0x126f40);if(_0x2fbf4f){const _0x49043c=_0x2fbf4f['reduce']((_0x2d2885,_0x2bbae6,_0x97cb86)=>_0x2d2885[_0x51e55b(0x23b)](_0x2bbae6,'{'+_0x97cb86+'}'),_0x12c0c6),_0x1aea9c=_0x2fbf4f['map'](_0x3a7614=>{const _0x2c26cc=_0x51e55b,_0x49f64b=_0x3a7614[_0x2c26cc(0x23b)](_0x126f40,'$1'),_0x446e36=handleDoubleBrace(_0x49f64b,_0x3a9254,_0x136fd6?_0x2c26cc(0x21f):_0x2c26cc(0x1f7));return _0x561a23=Object[_0x2c26cc(0x222)](_0x561a23,_0x446e36[_0x2c26cc(0x228)]),_0x446e36[_0x2c26cc(0x20e)];});return _0x561a23[_0x4ce6cb]=_0x49043c,_0x9a23c('\x27'+_0x4ce6cb+_0x51e55b(0x23e)+_0x1aea9c[_0x51e55b(0x1e1)](',\x20')+']');}return _0x561a23[_0x4ce6cb]=_0x12c0c6,_0x9a23c('\x27'+_0x4ce6cb+'\x27');}return _0x258851;};return _0x59e3e3=_0x59e3e3[_0x431293(0x23b)](_0x1407b4,(_0xec6c1,_0xd1f27f)=>{return _0x5c9b50(_0xec6c1,_0xd1f27f,_0x333b2c=>_0x333b2c);}),!config[_0x431293(0x219)]&&(_0x59e3e3=_0x59e3e3[_0x431293(0x23b)](_0x4282b3,(_0x2c2fa6,_0x2a5c30)=>{const _0x397356=_0x431293;return _0x5c9b50(_0x2c2fa6,_0x2a5c30,_0xff8c99=>_0x136fd6?_0x397356(0x221)+_0xff8c99+')':_0x397356(0x1f5)+_0xff8c99+')');})),{'content':_0x59e3e3,'obj':_0x561a23};}function handleDoubleBrace(_0x1f9fdf,_0x5b8a62,_0x1c577f='$key',_0x3d3c87=![]){const _0x914fdc=a0_0x39a010,_0x339b34=/(['"])(.*?)(\1)/g;let _0x1dc64f={};if(_0x3d3c87){const _0xddbeae=(_0x1f9fdf['split'](/{{.*?}}/)||[])[_0x914fdc(0x201)](_0x3b9e01=>hasChinese(_0x3b9e01));_0xddbeae[_0x914fdc(0x1e6)](_0x3c0a19=>{const _0x447cee=_0x914fdc,_0x5dcf09=getTranslateKey(_0x3c0a19,_0x5b8a62);_0x1f9fdf=_0x1f9fdf['replace'](_0x3c0a19,_0x447cee(0x1f3)+_0x5dcf09+_0x447cee(0x1ed)),_0x1dc64f[_0x5dcf09]=_0x3c0a19;});}const _0x85d631=(_0x1f9fdf[_0x914fdc(0x1eb)](_0x339b34)||[])[_0x914fdc(0x201)](_0x29f97e=>hasChinese(_0x29f97e));return _0x85d631[_0x914fdc(0x1e6)](_0xa6e6d5=>{const _0x70580e=_0x914fdc,_0xdea187=getTranslateKey(_0xa6e6d5,_0x5b8a62);_0x1f9fdf=_0x1f9fdf[_0x70580e(0x23b)](_0xa6e6d5,_0x1c577f[_0x70580e(0x23b)]('$key','\x27'+_0xdea187+'\x27')),_0x1dc64f[_0xdea187]=_0xa6e6d5[_0x70580e(0x23b)](/^['"]|['"]$/g,'');}),{'content':_0x1f9fdf,'obj':_0x1dc64f};}function outputLangFile(_0x15da6f,_0x399ff2){const _0x5625a1=a0_0x39a010;if(config[_0x5625a1(0x229)]==_0x5625a1(0x1ea)){const _0x4e8cf4=_0x15da6f[_0x5625a1(0x23b)](/\.(\w+)$/,_0x5625a1(0x20d));fs[_0x5625a1(0x241)](_0x4e8cf4,_0x399ff2);}else config[_0x5625a1(0x229)]==_0x5625a1(0x1d9)&&fs[_0x5625a1(0x241)](_0x15da6f,_0x399ff2);}async function outputLocalFile(_0x1b99d2){const _0x4ad501=a0_0x39a010,_0x47db39=path[_0x4ad501(0x1e1)](_path,config[_0x4ad501(0x223)]);if(/\.\w+$/g[_0x4ad501(0x1ea)](_0x47db39)){const _0x259433=path[_0x4ad501(0x22d)](_0x47db39);!fs[_0x4ad501(0x1da)](_0x259433)&&fs[_0x4ad501(0x237)](_0x259433,{'recursive':!![]});const _0x31d949=path[_0x4ad501(0x227)](_0x47db39);handleLocalFile(_0x1b99d2,_0x47db39);for(let _0x5c772f=0x0;_0x5c772f<config['locals'][_0x4ad501(0x23a)];_0x5c772f++){const _0x48b769=config['locals'][_0x5c772f];if(_0x48b769=='zh'||_0x48b769[_0x4ad501(0x1fb)]()==_0x4ad501(0x235)){await handleLocalFile(_0x1b99d2,path[_0x4ad501(0x1e1)](path[_0x4ad501(0x22d)](_0x47db39),''+_0x48b769+_0x31d949));return;}await handleLocalFile(_0x1b99d2,path[_0x4ad501(0x1e1)](path[_0x4ad501(0x22d)](_0x47db39),''+_0x48b769+_0x31d949),_0x48b769,config[_0x4ad501(0x1e3)][_0x4ad501(0x226)](_0x48b769));}}else{!fs[_0x4ad501(0x1da)](_0x47db39)&&fs[_0x4ad501(0x237)](_0x47db39,{'recursive':!![]});handleLocalFile(_0x1b99d2,path[_0x4ad501(0x1e1)](_0x47db39,_0x4ad501(0x210)));for(let _0x38ca06=0x0;_0x38ca06<config['locals'][_0x4ad501(0x23a)];_0x38ca06++){const _0x1857e5=config[_0x4ad501(0x1de)][_0x38ca06];if(_0x1857e5=='zh'||_0x1857e5['toLowerCase']()==_0x4ad501(0x235)){await handleLocalFile(_0x1b99d2,path[_0x4ad501(0x1e1)](_0x47db39,_0x1857e5+'.json'));return;}await handleLocalFile(_0x1b99d2,path[_0x4ad501(0x1e1)](_0x47db39,_0x1857e5+_0x4ad501(0x1e8)),_0x1857e5,config[_0x4ad501(0x1e3)]['includes'](_0x1857e5));}}}async function handleLocalFile(_0x5484df,_0x5b2124,_0x1fd44d,_0x1e0848){const _0x116641=function(_0x47ee8f){const _0x27c1ee=a0_0x443b,_0x2e05e8=path[_0x27c1ee(0x227)](_0x5b2124);if(_0x2e05e8==_0x27c1ee(0x1dd)){let _0x10a514=Object[_0x27c1ee(0x21e)](_0x47ee8f)[_0x27c1ee(0x1f0)](_0x33bcba=>'\x20\x20'+_0x33bcba+':\x20\x22'+_0x47ee8f[_0x33bcba]+'\x22')[_0x27c1ee(0x1e1)](',\x0d');fs[_0x27c1ee(0x241)](_0x5b2124,'export\x20default\x20{\x0d'+_0x10a514+'\x0d}');}else{let _0x90e60c=Object['keys'](_0x47ee8f)[_0x27c1ee(0x1f0)](_0x2808e5=>_0x27c1ee(0x216)+_0x2808e5+'\x22:\x20\x22'+_0x47ee8f[_0x2808e5]+'\x22')[_0x27c1ee(0x1e1)](',\x0d');fs[_0x27c1ee(0x241)](_0x5b2124,'{\x0d'+_0x90e60c+'\x0d}');}};let _0x203926,_0x5223b3;getFileContent(_0x5b2124,_0x25b869=>{const _0x41c877=a0_0x443b;_0x203926=Object[_0x41c877(0x222)]({},_0x5484df,_0x25b869),_0x5223b3=getExtraValues(_0x5484df,_0x25b869);},()=>{const _0x436189=a0_0x443b;_0x203926=JSON[_0x436189(0x1d7)](JSON['stringify'](_0x5484df)),_0x5223b3=JSON['parse'](JSON['stringify'](_0x5484df));}),_0x1e0848?await translater(_0x5223b3,_0x1fd44d,config,_0x378693=>{const _0x40ac99=a0_0x443b;_0x203926=Object[_0x40ac99(0x222)](_0x203926,_0x378693),_0x116641(_0x203926);}):_0x116641(_0x203926);}function getExtraValues(_0x37ab97,_0x1b03ae){const _0x4917cf=a0_0x39a010,_0x96278c=Object[_0x4917cf(0x21e)](_0x37ab97)[_0x4917cf(0x201)](_0x18b3cb=>!_0x1b03ae[_0x4917cf(0x231)](_0x18b3cb)),_0x4a4dbd={};return _0x96278c['forEach'](_0x1f4eed=>{_0x4a4dbd[_0x1f4eed]=_0x37ab97[_0x1f4eed];}),_0x4a4dbd;} | ||
const a0_0x45a3ec=a0_0x51f2;(function(_0x3dcc57,_0x277593){const _0x5ed47b=a0_0x51f2,_0x300dbd=_0x3dcc57();while(!![]){try{const _0x473ede=-parseInt(_0x5ed47b(0x22e))/0x1*(parseInt(_0x5ed47b(0x243))/0x2)+-parseInt(_0x5ed47b(0x1e8))/0x3*(-parseInt(_0x5ed47b(0x254))/0x4)+-parseInt(_0x5ed47b(0x1f1))/0x5*(-parseInt(_0x5ed47b(0x1e1))/0x6)+parseInt(_0x5ed47b(0x201))/0x7*(-parseInt(_0x5ed47b(0x237))/0x8)+-parseInt(_0x5ed47b(0x23e))/0x9+-parseInt(_0x5ed47b(0x22d))/0xa+parseInt(_0x5ed47b(0x1f5))/0xb*(parseInt(_0x5ed47b(0x21b))/0xc);if(_0x473ede===_0x277593)break;else _0x300dbd['push'](_0x300dbd['shift']());}catch(_0x22ce28){_0x300dbd['push'](_0x300dbd['shift']());}}}(a0_0x324c,0x1b844));const fs=require('fs'),path=require(a0_0x45a3ec(0x23c)),{program}=require(a0_0x45a3ec(0x231)),{pinyin}=require(a0_0x45a3ec(0x203)),{translater}=require(a0_0x45a3ec(0x216)),{parseHTML}=require(a0_0x45a3ec(0x24d)),_path=process[a0_0x45a3ec(0x219)]();function hasChinese(_0x398ecb){const _0x39d508=a0_0x45a3ec;return/[\u4e00-\u9fa5]/g[_0x39d508(0x200)](_0x398ecb);}let customLang={},config={'env':a0_0x45a3ec(0x21d),'locals':[],'excludes':[],'translate':[],'channel':a0_0x45a3ec(0x1e5),'appKey':'','secretKey':'','suffix':'.vue','output':a0_0x45a3ec(0x21e)};getConfig();function getConfig(){const _0x13ba59=a0_0x45a3ec;program[_0x13ba59(0x207)](_0x13ba59(0x24a),_0x13ba59(0x1ef))[_0x13ba59(0x1fa)]('-d,\x20--dir\x20<dir>',_0x13ba59(0x24f))['option'](_0x13ba59(0x230),'需要生成的地区语言(语种代码)如:zh等')[_0x13ba59(0x1ee)]('-c,\x20--channel\x20<value>','翻译渠道\x20baidu百度,youdao有道')[_0x13ba59(0x1ee)](_0x13ba59(0x213),_0x13ba59(0x235))['option'](_0x13ba59(0x1f6),_0x13ba59(0x1fc))[_0x13ba59(0x1ee)](_0x13ba59(0x20a),_0x13ba59(0x1e6))[_0x13ba59(0x1ee)](_0x13ba59(0x252),'翻译的文件名后缀,默认.vue')[_0x13ba59(0x1ee)](_0x13ba59(0x226),_0x13ba59(0x1f7))[_0x13ba59(0x1ee)](_0x13ba59(0x240),'翻译结果写入路径,默认locals/local.json')[_0x13ba59(0x1ee)](_0x13ba59(0x218),_0x13ba59(0x205)),program[_0x13ba59(0x1eb)]();const _0x1ffabc=program[_0x13ba59(0x215)]();config=Object['assign'](config,_0x1ffabc,{'env':program['args'][0x0]}),getFileContent(path[_0x13ba59(0x223)](_path,_0x13ba59(0x1f8)),_0x157010=>{const _0x19413f=_0x13ba59;customLang=_0x157010,console[_0x19413f(0x1f4)]('-\x20读取字典:\x20读取自定义字典\x27translate.json\x27成功!');},()=>{const _0x11de36=_0x13ba59;console[_0x11de36(0x1f4)](_0x11de36(0x210));});}function getFileContent(_0x3fd889,_0x2c7c36,_0x531f5d){const _0x48fc61=a0_0x45a3ec;if(fs['existsSync'](_0x3fd889))try{let _0x2c7205=fs[_0x48fc61(0x20f)](_0x3fd889,{'encoding':_0x48fc61(0x23a)});const _0x57cc86=path[_0x48fc61(0x23b)](_0x3fd889);if(_0x57cc86==_0x48fc61(0x1f2))_0x2c7c36&&_0x2c7c36(JSON[_0x48fc61(0x1eb)](_0x2c7205));else{let _0x40ffaa={};_0x2c7205['replace'](/['"]*(\w+)['"]*:\s*"([^"]+)"/g,(_0x1eedff,_0x30d710,_0x106fe3)=>{_0x40ffaa[_0x30d710]=_0x106fe3;}),_0x2c7c36&&_0x2c7c36(_0x40ffaa);}}catch(_0x5abd68){_0x531f5d&&_0x531f5d(_0x48fc61(0x214));}else _0x531f5d&&_0x531f5d(_0x48fc61(0x236));}function getSuffixFiles(_0x407eea,_0x193fdb,_0x32af6b){const _0x2d9f51=a0_0x45a3ec,_0x38e593=fs[_0x2d9f51(0x23f)](_0x407eea),_0x1e76fa=[];return _0x38e593[_0x2d9f51(0x209)]((_0x28c312,_0x12c811)=>{const _0x5efb56=_0x2d9f51,_0x52878c=path[_0x5efb56(0x223)](_0x407eea,_0x28c312),_0x4b911a=fs[_0x5efb56(0x24b)](_0x52878c);if(_0x4b911a[_0x5efb56(0x20c)]())_0x1e76fa[_0x5efb56(0x247)](...getSuffixFiles(_0x52878c,_0x193fdb,_0x32af6b));else path['extname'](_0x28c312)==_0x193fdb&&!_0x32af6b[_0x5efb56(0x212)](path['extname'](_0x28c312))&&_0x1e76fa[_0x5efb56(0x247)](_0x52878c);}),_0x1e76fa;}function a0_0x51f2(_0xe8ded5,_0x2980b9){const _0x324cd3=a0_0x324c();return a0_0x51f2=function(_0x51f2f9,_0x93c468){_0x51f2f9=_0x51f2f9-0x1e1;let _0x177dc8=_0x324cd3[_0x51f2f9];return _0x177dc8;},a0_0x51f2(_0xe8ded5,_0x2980b9);}function delSuffixFiles(_0x419c7f,_0x28473b,_0x2a1091){const _0x504afa=a0_0x45a3ec,_0x4e3c86=fs[_0x504afa(0x23f)](_0x419c7f);_0x4e3c86[_0x504afa(0x209)]((_0x33e973,_0x44d6a3)=>{const _0x112baa=_0x504afa,_0x19f3be=path[_0x112baa(0x223)](_0x419c7f,_0x33e973),_0x31e6b0=fs[_0x112baa(0x24b)](_0x19f3be),_0x3b9869=new RegExp('.lang'+_0x28473b+'$');if(_0x31e6b0[_0x112baa(0x20c)]())delSuffixFiles(_0x19f3be,_0x28473b,_0x2a1091);else _0x3b9869[_0x112baa(0x200)](_0x33e973)&&!_0x2a1091['includes'](path[_0x112baa(0x23b)](_0x33e973))&&fs['unlinkSync'](_0x19f3be);});}function getTranslateKey(_0x5876aa,_0x1edbf9){const _0x67cdbd=a0_0x45a3ec;if(_0x1edbf9[_0x67cdbd(0x21a)]>0x28)return _0x67cdbd(0x253);const _0x5d0101=/^(['"`])|['"`]$/g,_0x57ce48=/\$*\{(.*?)\}/g;let _0xcaca09=_0x5876aa[_0x67cdbd(0x251)](_0x5d0101,'');const _0x36dd56=(_0xcaca09[_0x67cdbd(0x22f)](_0x57ce48)||[])[_0x67cdbd(0x1f9)]((_0x37e791,_0x59411d,_0xff88a4)=>_0x37e791[_0x67cdbd(0x251)](_0x59411d,'{'+_0xff88a4+'}'),_0xcaca09),_0x3d5754=Object[_0x67cdbd(0x249)](customLang)[_0x67cdbd(0x245)](_0x36dd56);if(_0x3d5754!==-0x1)return Object[_0x67cdbd(0x238)](customLang)[_0x3d5754];_0xcaca09=_0xcaca09[_0x67cdbd(0x251)](_0x57ce48,'o'),_0xcaca09=_0xcaca09[_0x67cdbd(0x251)](/[^\u4e00-\u9fa5\w]/g,'');let _0x193272=_0xcaca09[_0x67cdbd(0x251)](/([\u4e00-\u9fa5]+)/g,_0x12d526=>{const _0xf31dcc=_0x67cdbd;return pinyin(_0x12d526,{'toneType':'none','type':_0xf31dcc(0x1f3)})[_0xf31dcc(0x223)]('_');}),_0x2e18c5=_0x1edbf9+'_'+_0x193272;if(_0x2e18c5[_0x67cdbd(0x21a)]>0x1e){_0x193272=_0xcaca09[_0x67cdbd(0x251)](/([\u4e00-\u9fa5]+)/g,_0x155fe6=>{const _0x225ef9=_0x67cdbd;return pinyin(_0x155fe6,{'pattern':_0x225ef9(0x1f0),'toneType':_0x225ef9(0x1e2),'type':_0x225ef9(0x1f3)})[_0x225ef9(0x223)]('');}),_0x2e18c5=_0x1edbf9+'_'+_0x193272;if(_0x2e18c5[_0x67cdbd(0x21a)]>0x32){const _0x5ba600=Number[_0x67cdbd(0x246)](_0x193272[_0x67cdbd(0x21a)]/(0x31-_0x1edbf9[_0x67cdbd(0x21a)]))+0x1;_0x193272=new Array(_0x193272['length'])['fill']('')[_0x67cdbd(0x1f9)]((_0x4fea42,_0x42859b,_0x1062df)=>''+_0x4fea42+(_0x1062df%_0x5ba600==0x0?_0x193272[_0x1062df]:''));}_0x2e18c5=_0x1edbf9+'_'+_0x193272;}return _0x2e18c5;}translate();function translate(){const _0x42bd46=a0_0x45a3ec;delSuffixFiles(path[_0x42bd46(0x223)](_path,config[_0x42bd46(0x1e4)]),config[_0x42bd46(0x220)],config[_0x42bd46(0x239)]);const _0x33416b=getSuffixFiles(path[_0x42bd46(0x223)](_path,config[_0x42bd46(0x1e4)]),config['suffix'],config[_0x42bd46(0x239)]);let _0x1c7bce={};_0x33416b[_0x42bd46(0x209)](function(_0x1b19b5,_0x5074fc){const _0x42523e=_0x42bd46;console[_0x42523e(0x1f4)](_0x42523e(0x229)+_0x1b19b5);let _0x232cbf=fs[_0x42523e(0x20f)](_0x1b19b5,{'encoding':'utf-8'})+'';const _0x3e2601=path[_0x42523e(0x242)](_0x1b19b5)['split']('.')[0x0],_0x1a60c4=/\<template\>(.|\n|\r)*\<\/template\>/g,_0x169686=/<!--[\s\S]*?-->/g,_0x384f4e=/\<script\>(.|\n|\r)*\<\/script\>/g,_0x980491=/(?<=\s|\;|^|\{|\})\/\/[^\r\n]*/g,_0x427861=/\/\*[\s\S]*?\*\//g;_0x232cbf=_0x232cbf[_0x42523e(0x251)](_0x1a60c4,_0x373869=>_0x373869[_0x42523e(0x251)](_0x169686,'')),_0x232cbf=_0x232cbf[_0x42523e(0x251)](_0x384f4e,_0x20ba01=>_0x20ba01[_0x42523e(0x251)](_0x980491,'')[_0x42523e(0x251)](_0x427861,''));const _0x4c47b4=/(?<=\$t\()(['"])(.*?)\1/g;_0x232cbf=_0x232cbf[_0x42523e(0x251)](_0x4c47b4,(_0x587bde,_0x74bbcd,_0x1353d7)=>{if(hasChinese(_0x587bde)){const _0x400a21=getTranslateKey(_0x587bde,_0x3e2601);return _0x1c7bce[_0x400a21]=_0x1353d7,'\x27'+_0x400a21+'\x27';}return _0x587bde;}),_0x232cbf=_0x232cbf[_0x42523e(0x251)](_0x1a60c4,_0x52a68c=>{const _0x3ae5f6=_0x42523e,_0x4026ad=handleTemplate(_0x52a68c,_0x3e2601);return _0x1c7bce=Object[_0x3ae5f6(0x232)](_0x1c7bce,_0x4026ad[_0x3ae5f6(0x233)]),_0x4026ad['content'];}),_0x232cbf=_0x232cbf[_0x42523e(0x251)](_0x384f4e,_0x100dc3=>{const _0xe2ad8=_0x42523e,_0xe8e71e=handleScript(_0x100dc3,_0x3e2601);return _0x1c7bce=Object[_0xe2ad8(0x232)](_0x1c7bce,_0xe8e71e[_0xe2ad8(0x233)]),_0xe8e71e[_0xe2ad8(0x24c)];}),outputLangFile(_0x1b19b5,_0x232cbf);}),outputLocalFile(_0x1c7bce);}function handleTemplate(_0x283c28,_0x40f84c){const _0x528e1d=a0_0x45a3ec,_0x2a31a2=/<([a-z][a-z0-9\-]*)\b[^>]*>(.*?)<\/\1>/g,_0x48c6b9=/(?<!\:)\b(?:\w|-)+\=(['"])(.*?)\1/g,_0x2e3be9=handleStringTpl(_0x283c28,_0x40f84c,!![]);_0x283c28=_0x2e3be9[_0x528e1d(0x24c)];let _0x3623b0=_0x2e3be9[_0x528e1d(0x233)];if(!config['strict']){const _0x4f28e1=_0x283c28;let _0x31bcd5=0x0;parseHTML(_0x4f28e1,_0x4cd073=>{const _0x59ab8a=_0x528e1d;hasChinese(_0x4cd073[_0x59ab8a(0x244)])&&_0x4cd073['value'][_0x59ab8a(0x251)](/^\s*([\w\W]*?)\s*$/,(_0x43f96a,_0x23cb6f)=>{const _0x3c14df=_0x59ab8a;if(/\{\{(.*?)\}\}/g[_0x3c14df(0x200)](_0x43f96a)){const _0x48b795=handleDoubleBrace(_0x23cb6f,_0x40f84c,'$t($key)',!![]);return _0x3623b0=Object[_0x3c14df(0x232)](_0x3623b0,_0x48b795[_0x3c14df(0x233)]),_0x283c28=replaceStringFromTo(_0x283c28,_0x4cd073['start']+_0x31bcd5,_0x4cd073[_0x3c14df(0x1e7)]+_0x31bcd5,_0x43f96a[_0x3c14df(0x251)](_0x23cb6f,_0x48b795[_0x3c14df(0x24c)])),_0x31bcd5=_0x31bcd5+(_0x48b795[_0x3c14df(0x24c)][_0x3c14df(0x21a)]-_0x23cb6f['length']),_0x43f96a;}const _0x2e3fd6=getTranslateKey(_0x23cb6f,_0x40f84c);_0x3623b0[_0x2e3fd6]=_0x23cb6f;const _0x247d9c=_0x3c14df(0x208)+_0x2e3fd6+_0x3c14df(0x250);return _0x283c28=replaceStringFromTo(_0x283c28,_0x4cd073[_0x3c14df(0x206)]+_0x31bcd5,_0x4cd073['end']+_0x31bcd5,_0x43f96a[_0x3c14df(0x251)](_0x23cb6f,_0x247d9c)),_0x31bcd5=_0x31bcd5+(_0x247d9c[_0x3c14df(0x21a)]-_0x23cb6f[_0x3c14df(0x21a)]),_0x43f96a;});},_0x2ada46=>{const _0x18f898=_0x528e1d;for(let _0x135f9c=0x0;_0x135f9c<_0x2ada46[_0x18f898(0x1e3)][_0x18f898(0x21a)];_0x135f9c++){const _0x13ec29=_0x2ada46[_0x18f898(0x1e3)][_0x135f9c];if(hasChinese(_0x13ec29[_0x18f898(0x244)])){const _0x36704c=getTranslateKey(_0x13ec29[_0x18f898(0x244)],_0x40f84c);_0x3623b0[_0x36704c]=_0x13ec29['value'];const _0x1d3c40=_0x18f898(0x204)+_0x36704c+'\x27)';_0x283c28=replaceStringFromTo(_0x283c28,_0x13ec29[_0x18f898(0x206)]+_0x31bcd5,_0x13ec29['end']+_0x31bcd5,_0x13ec29[_0x18f898(0x1fe)]['replace'](_0x13ec29[_0x18f898(0x244)],_0x1d3c40)[_0x18f898(0x251)](_0x13ec29[_0x18f898(0x224)],':'+_0x13ec29[_0x18f898(0x224)])),_0x31bcd5=_0x31bcd5+(_0x1d3c40[_0x18f898(0x21a)]-_0x13ec29[_0x18f898(0x244)][_0x18f898(0x21a)])+0x1;}}});}return{'content':_0x283c28,'obj':_0x3623b0};}function handleScript(_0x2d0319,_0x3e581a){const _0x5123c7=a0_0x45a3ec,_0x3d51ab=/(?<!\$t\(\s*)(['"])(.*?)(\1)/g,_0x114e2f=handleStringTpl(_0x2d0319,_0x3e581a);_0x2d0319=_0x114e2f[_0x5123c7(0x24c)];let _0x4e03eb=_0x114e2f['obj'];return!config[_0x5123c7(0x1ec)]&&(_0x2d0319=_0x2d0319['replace'](_0x3d51ab,(_0x4d9b5e,_0x45629a,_0x24d596)=>{const _0x28646b=_0x5123c7;if(hasChinese(_0x4d9b5e)){const _0x452072=getTranslateKey(_0x4d9b5e,_0x3e581a);return _0x4e03eb[_0x452072]=_0x24d596,_0x28646b(0x20b)+_0x452072+'\x27)';}return _0x4d9b5e;})),{'content':_0x2d0319,'obj':_0x4e03eb};}function handleStringTpl(_0x3cc3a7,_0x48ef8c,_0x1b2fb9){const _0x2519e0=a0_0x45a3ec,_0x2569b8=/(?<!\$t\(\s*)`(.*?)`/g,_0x41def5=/(?<=\$t\()`(.*?)`/g,_0x5dc374=/\${(.*?)}/g;let _0x23cf9c={};const _0x4c3737=function(_0x431dc1,_0x567978,_0x50cc7d){const _0x3cf168=a0_0x51f2,_0x2091d7=_0x431dc1[_0x3cf168(0x251)](_0x5dc374,'');if(hasChinese(_0x2091d7)){const _0x5b9782=getTranslateKey(_0x431dc1,_0x48ef8c),_0x23bb5c=_0x431dc1[_0x3cf168(0x22f)](_0x5dc374);if(_0x23bb5c){const _0x531dfa=_0x23bb5c[_0x3cf168(0x1f9)]((_0x8c4cb3,_0x10b6f2,_0x3cf598)=>_0x8c4cb3['replace'](_0x10b6f2,'{'+_0x3cf598+'}'),_0x567978),_0x16037f=_0x23bb5c[_0x3cf168(0x1ff)](_0xb01ae4=>{const _0x26e391=_0x3cf168,_0x5660b7=_0xb01ae4['replace'](_0x5dc374,'$1'),_0x2017b1=handleDoubleBrace(_0x5660b7,_0x48ef8c,_0x1b2fb9?'$t($key)':'this.$t($key)');return _0x23cf9c=Object[_0x26e391(0x232)](_0x23cf9c,_0x2017b1[_0x26e391(0x233)]),_0x2017b1[_0x26e391(0x24c)];});return _0x23cf9c[_0x5b9782]=_0x531dfa,_0x50cc7d('\x27'+_0x5b9782+_0x3cf168(0x24e)+_0x16037f[_0x3cf168(0x223)](',\x20')+']');}return _0x23cf9c[_0x5b9782]=_0x567978,_0x50cc7d('\x27'+_0x5b9782+'\x27');}return _0x431dc1;};return _0x3cc3a7=_0x3cc3a7[_0x2519e0(0x251)](_0x41def5,(_0x3db531,_0x39c807)=>{return _0x4c3737(_0x3db531,_0x39c807,_0x18d8d9=>_0x18d8d9);}),!config[_0x2519e0(0x1ec)]&&(_0x3cc3a7=_0x3cc3a7['replace'](_0x2569b8,(_0x512209,_0x146762)=>{const _0x35278a=_0x2519e0;return _0x4c3737(_0x512209,_0x146762,_0x168789=>_0x1b2fb9?'$t('+_0x168789+')':_0x35278a(0x1fd)+_0x168789+')');})),{'content':_0x3cc3a7,'obj':_0x23cf9c};}function handleDoubleBrace(_0x3fd039,_0x361f8b,_0x2787cb='$key',_0x48f120=![]){const _0x7f5046=a0_0x45a3ec,_0x448dd1=/(['"])(.*?)(\1)/g;let _0x1fb5e3={};if(_0x48f120){const _0x1654d9=(_0x3fd039['split'](/{{.*?}}/)||[])['filter'](_0x4e187c=>hasChinese(_0x4e187c));_0x1654d9[_0x7f5046(0x209)](_0x2511eb=>{const _0x1ce51f=_0x7f5046,_0x2f639f=getTranslateKey(_0x2511eb,_0x361f8b);_0x3fd039=_0x3fd039[_0x1ce51f(0x251)](_0x2511eb,'{{\x20$t(\x27'+_0x2f639f+_0x1ce51f(0x250)),_0x1fb5e3[_0x2f639f]=_0x2511eb;});}const _0x528c12=(_0x3fd039[_0x7f5046(0x22f)](_0x448dd1)||[])[_0x7f5046(0x222)](_0x268202=>hasChinese(_0x268202));return _0x528c12[_0x7f5046(0x209)](_0x4730d9=>{const _0x2fcc66=_0x7f5046,_0x84705b=getTranslateKey(_0x4730d9,_0x361f8b);_0x3fd039=_0x3fd039[_0x2fcc66(0x251)](_0x4730d9,_0x2787cb[_0x2fcc66(0x251)](_0x2fcc66(0x225),'\x27'+_0x84705b+'\x27')),_0x1fb5e3[_0x84705b]=_0x4730d9['replace'](/^['"]|['"]$/g,'');}),{'content':_0x3fd039,'obj':_0x1fb5e3};}function outputLangFile(_0x4f388c,_0x54845e){const _0x31b097=a0_0x45a3ec;if(config[_0x31b097(0x241)]==_0x31b097(0x200)){const _0x396988=_0x4f388c[_0x31b097(0x251)](/\.(\w+)$/,_0x31b097(0x228));fs['writeFileSync'](_0x396988,_0x54845e);}else config[_0x31b097(0x241)]==_0x31b097(0x227)&&fs[_0x31b097(0x217)](_0x4f388c,_0x54845e);}async function outputLocalFile(_0x324cbf){const _0x193e9b=a0_0x45a3ec,_0x523eab=path['join'](_path,config['output']);if(/\.\w+$/g['test'](_0x523eab)){const _0x228489=path[_0x193e9b(0x1ea)](_0x523eab);!fs[_0x193e9b(0x221)](_0x228489)&&fs[_0x193e9b(0x20e)](_0x228489,{'recursive':!![]});const _0x1c03fa=path[_0x193e9b(0x23b)](_0x523eab);handleLocalFile(_0x324cbf,_0x523eab);for(let _0x39219c=0x0;_0x39219c<config[_0x193e9b(0x211)][_0x193e9b(0x21a)];_0x39219c++){const _0x330c3c=config[_0x193e9b(0x211)][_0x39219c];_0x330c3c=='zh'||_0x330c3c[_0x193e9b(0x22c)]()==_0x193e9b(0x23d)?await handleLocalFile(_0x324cbf,path[_0x193e9b(0x223)](path[_0x193e9b(0x1ea)](_0x523eab),''+_0x330c3c+_0x1c03fa)):await handleLocalFile(_0x324cbf,path['join'](path['dirname'](_0x523eab),''+_0x330c3c+_0x1c03fa),_0x330c3c,config[_0x193e9b(0x1fb)]['includes'](_0x330c3c));}statisticalSort(_0x324cbf);}else{!fs['existsSync'](_0x523eab)&&fs[_0x193e9b(0x20e)](_0x523eab,{'recursive':!![]});handleLocalFile(_0x324cbf,path['join'](_0x523eab,'local.json'));for(let _0x3567e4=0x0;_0x3567e4<config[_0x193e9b(0x211)][_0x193e9b(0x21a)];_0x3567e4++){const _0x1012cb=config[_0x193e9b(0x211)][_0x3567e4];_0x1012cb=='zh'||_0x1012cb[_0x193e9b(0x22c)]()==_0x193e9b(0x23d)?await handleLocalFile(_0x324cbf,path['join'](_0x523eab,_0x1012cb+_0x193e9b(0x1f2))):await handleLocalFile(_0x324cbf,path[_0x193e9b(0x223)](_0x523eab,_0x1012cb+_0x193e9b(0x1f2)),_0x1012cb,config[_0x193e9b(0x1fb)][_0x193e9b(0x212)](_0x1012cb));}statisticalSort(_0x324cbf);}}function a0_0x324c(){const _0x57af0d=['是否严格模式,\x20严格模式只提取$t()内中文,否则全局','start','argument','{{\x20$t(\x27','forEach','-t,\x20--translate\x20<value...>','this.$t(\x27','isDirectory','entries','mkdirSync','readFileSync','-\x20读取字典:\x20未读取到自定义字典translate.json!','locals','includes','--appKey\x20<value>','读取文件失败','opts','./parser/translater','writeFileSync','--strict','cwd','length','288mljqkj','-----------\x20中文字段统计频率排行榜','dev','locals/local.json','\x22:\x20\x22','suffix','existsSync','filter','join','name','$key','-e,\x20--excludes\x20<value...>','prod','.lang.$1','-\x20执行文件:','.js','substring','toLowerCase','38040ZOomDA','1AofCmj','match','-l,\x20--locals\x20<value...>','commander','assign','obj','\x20\x20\x22','翻译api\x20应用key','文件不存在','1516936rgCcJa','keys','excludes','utf-8','extname','path','zh_cn','502875whXies','readdirSync','-o,\x20--output\x20<file>','env','basename','9886ONVvBD','value','indexOf','parseInt','push','stringify','values','<env>','lstatSync','content','./parser/html-parser','\x27,\x20[','翻译的文件夹','\x27)\x20}}','replace','-s,\x20--suffix\x20<value>','??????FILE_NAME_TO_LONG','391928ZdsSpg','sort','6XoyFlP','none','attrs','dir','baidu','需要翻译的语言,对应locals','end','6HiGNLJ',':\x20\x22','dirname','parse','strict','-----------\x20中文字段统计频率排行榜,频率过高建议加入自定义key!','option','指定环境:dev(开发)/test(测试)/prod(生产),默认为开发环境','first','408395XSmTlA','.json','array','log','40931vLtgnQ','--secretKey\x20<value>','排除翻译的文件,可指定多个','/translate.json','reduce','requiredOption','translate','翻译api\x20密钥','this.$t(','target','map','test','7ZfQhDb','-----------\x20\x20第','pinyin-pro','$t(\x27'];a0_0x324c=function(){return _0x57af0d;};return a0_0x324c();}async function handleLocalFile(_0x10c026,_0x1e7308,_0x18ea8b,_0x56555a){const _0x26107f=function(_0x5dc49d){const _0x163213=a0_0x51f2,_0x5ed8d7=path[_0x163213(0x23b)](_0x1e7308);if(_0x5ed8d7==_0x163213(0x22a)){let _0x100c54=Object[_0x163213(0x238)](_0x5dc49d)[_0x163213(0x1ff)](_0x582b44=>'\x20\x20'+_0x582b44+_0x163213(0x1e9)+_0x5dc49d[_0x582b44]+'\x22')[_0x163213(0x223)](',\x0d');fs['writeFileSync'](_0x1e7308,'exports.__esModule\x20=\x20true;\x0dexports.default\x20=\x20{\x0d'+_0x100c54+'\x0d}');}else{let _0x323c69=Object[_0x163213(0x238)](_0x5dc49d)[_0x163213(0x1ff)](_0x487139=>_0x163213(0x234)+_0x487139+_0x163213(0x21f)+_0x5dc49d[_0x487139]+'\x22')[_0x163213(0x223)](',\x0d');fs[_0x163213(0x217)](_0x1e7308,'{\x0d'+_0x323c69+'\x0d}');}};let _0x2d7642,_0x58401d;getFileContent(_0x1e7308,_0x2bbcbe=>{const _0x54ae59=a0_0x51f2;_0x2d7642=Object[_0x54ae59(0x232)]({},_0x10c026,_0x2bbcbe),_0x58401d=getExtraValues(_0x10c026,_0x2bbcbe);},()=>{const _0x8e536f=a0_0x51f2;_0x2d7642=JSON[_0x8e536f(0x1eb)](JSON[_0x8e536f(0x248)](_0x10c026)),_0x58401d=JSON[_0x8e536f(0x1eb)](JSON['stringify'](_0x10c026));}),_0x56555a?await translater(_0x58401d,_0x18ea8b,config,_0x5d128b=>{_0x2d7642=Object['assign'](_0x2d7642,_0x5d128b),_0x26107f(_0x2d7642);}):_0x26107f(_0x2d7642);}function getExtraValues(_0x1a8d6e,_0x2b6e08){const _0x1a576f=a0_0x45a3ec,_0x5c843e=Object[_0x1a576f(0x238)](_0x1a8d6e)[_0x1a576f(0x222)](_0x308a0e=>!_0x2b6e08['hasOwnProperty'](_0x308a0e)),_0x274073={};return _0x5c843e[_0x1a576f(0x209)](_0x290bf7=>{_0x274073[_0x290bf7]=_0x1a8d6e[_0x290bf7];}),_0x274073;}function replaceStringFromTo(_0x5d1207,_0x24797a,_0x3411a9,_0x2afdc4){const _0x2d497a=a0_0x45a3ec;return _0x5d1207['substring'](0x0,_0x24797a)+_0x2afdc4+_0x5d1207[_0x2d497a(0x22b)](_0x3411a9);}function statisticalSort(_0x3a6b81){const _0x578d18=a0_0x45a3ec,_0x3aa85f=Object[_0x578d18(0x249)](_0x3a6b81);let _0x4d57b1={};for(let _0x54d095=0x0;_0x54d095<_0x3aa85f[_0x578d18(0x21a)];_0x54d095++){const _0x1d3431=_0x3aa85f[_0x54d095];_0x4d57b1[_0x1d3431]?_0x4d57b1[_0x1d3431]++:_0x4d57b1[_0x1d3431]=0x1;}const _0x65a281=Object[_0x578d18(0x20d)](_0x4d57b1)[_0x578d18(0x255)]((_0x5cd1d5,_0x49e1b1)=>_0x49e1b1[0x1]-_0x5cd1d5[0x1]);console[_0x578d18(0x1f4)](new Array(0x45)[_0x578d18(0x223)]('-')),console[_0x578d18(0x1f4)](_0x578d18(0x1ed));for(let _0x75606e=0x0;_0x75606e<_0x65a281['length'];_0x75606e++){const _0x17deb1=_0x65a281[_0x75606e];console['log'](_0x578d18(0x202)+(_0x75606e+0x1)+'名('+_0x17deb1[0x1]+'):'+_0x17deb1[0x0]);if(_0x75606e>=0x9)break;}console[_0x578d18(0x1f4)](_0x578d18(0x21c)),console[_0x578d18(0x1f4)](new Array(0x45)[_0x578d18(0x223)]('-'));} |
@@ -1,1 +0,1 @@ | ||
const a1_0x31c307=a1_0x1c35;function a1_0x218a(){const _0x4778ff=['tag\x20<','slice','indexOf','shouldDecodeNewlinesForHref','end','match','<div><span\x20class=\x22title\x22>测试</span><my-component/></div>','ssss','3gUThPG','log','replace','6306237yuHUgS','toLowerCase','7ThERCA','【结束标签】:','闭合标签','script,style,textarea','7276428bemOQE','2716474sFOtAV','test','开始标签','350751sZFbxJ','substring','split','lowerCasedTag','attrs','6531784XxBfna','>\x20has\x20no\x20matching\x20end\x20tag.','push','unarySlash','create','href','length','【文本内容】:','start','8645440igIMCk','4782500RgfhcI','shouldDecodeNewlines','tagName'];a1_0x218a=function(){return _0x4778ff;};return a1_0x218a();}(function(_0x449b1e,_0x4043fd){const _0x1c60b7=a1_0x1c35,_0xd35996=_0x449b1e();while(!![]){try{const _0x183a9d=parseInt(_0x1c60b7(0xe5))/0x1+parseInt(_0x1c60b7(0xe2))/0x2+parseInt(_0x1c60b7(0xd8))/0x3*(parseInt(_0x1c60b7(0xcd))/0x4)+-parseInt(_0x1c60b7(0xf3))/0x5+parseInt(_0x1c60b7(0xe1))/0x6+parseInt(_0x1c60b7(0xdd))/0x7*(-parseInt(_0x1c60b7(0xea))/0x8)+-parseInt(_0x1c60b7(0xdb))/0x9;if(_0x183a9d===_0x4043fd)break;else _0xd35996['push'](_0xd35996['shift']());}catch(_0x88ddfc){_0xd35996['push'](_0xd35996['shift']());}}}(a1_0x218a,0xd4ab9));function a1_0x1c35(_0x197f40,_0x2b9ab9){const _0x218aaa=a1_0x218a();return a1_0x1c35=function(_0x1c357e,_0x9b7c65){_0x1c357e=_0x1c357e-0xcd;let _0x236151=_0x218aaa[_0x1c357e];return _0x236151;},a1_0x1c35(_0x197f40,_0x2b9ab9);}function makeMap(_0x4595b7,_0xbb889e){const _0x2ef3e5=a1_0x1c35,_0x29d5f0=Object[_0x2ef3e5(0xee)](null),_0x2be212=_0x4595b7[_0x2ef3e5(0xe7)](',');for(let _0x14459d=0x0;_0x14459d<_0x2be212[_0x2ef3e5(0xf0)];_0x14459d++){_0x29d5f0[_0x2be212[_0x14459d]]=!![];}return _0xbb889e?_0xbe7069=>_0x29d5f0[_0xbe7069['toLowerCase']()]:_0x4777a7=>_0x29d5f0[_0x4777a7];}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_0x31c307(0xe0),!![]),isIgnoreNewlineTag=makeMap('pre,textarea',!![]),shouldIgnoreFirstNewline=(_0x5c90a0,_0x50d765)=>_0x5c90a0&&isIgnoreNewlineTag(_0x5c90a0)&&_0x50d765[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(_0x4293cb,_0x1d1f3b){const _0x1265af=a1_0x31c307,_0x39a9c3=_0x1d1f3b?encodedAttrWithNewLines:encodedAttr;return _0x4293cb[_0x1265af(0xda)](_0x39a9c3,_0x2e6590=>decodingMap[_0x2e6590]);}parseHTML(a1_0x31c307(0xd6));function parseHTML(_0x11cbae,_0x2e4690={'shouldDecodeNewlines':!![],'shouldDecodeNewlinesForHref':!![]}){const _0x8ef09d=a1_0x31c307,_0x327a0d=[];let _0x268289=0x0,_0x8faacd,_0x17299b;while(_0x11cbae){_0x8faacd=_0x11cbae,console[_0x8ef09d(0xd9)](_0x11cbae);if(!_0x17299b||!isPlainTextElement(_0x17299b)){let _0x2ff615=_0x11cbae[_0x8ef09d(0xd2)]('<');if(_0x2ff615===0x0){const _0x29fb9f=_0x11cbae['match'](doctype);if(_0x29fb9f){_0x450da3(_0x29fb9f[0x0]['length']);continue;}const _0x58cc05=_0x11cbae[_0x8ef09d(0xd5)](endTag);if(_0x58cc05){console[_0x8ef09d(0xd9)](_0x8ef09d(0xde)+_0x58cc05[0x1]);const _0x5b67e4=_0x268289;_0x450da3(_0x58cc05[0x0][_0x8ef09d(0xf0)]),_0x2fc138(_0x58cc05[0x1],_0x5b67e4,_0x268289);continue;}const _0x4de474=_0x30375e();if(_0x4de474){console[_0x8ef09d(0xd9)]('【'+(_0x4de474[_0x8ef09d(0xed)]?_0x8ef09d(0xdf):_0x8ef09d(0xe4))+'】:'+_0x4de474['tagName']);continue;}}let _0x237a35,_0x11f517,_0x3d04e2;if(_0x2ff615>=0x0){_0x11f517=_0x11cbae[_0x8ef09d(0xd1)](_0x2ff615);while(!endTag[_0x8ef09d(0xe3)](_0x11f517)&&!startTagOpen['test'](_0x11f517)){_0x3d04e2=_0x11f517[_0x8ef09d(0xd2)]('<',0x1);if(_0x3d04e2<0x0)break;_0x2ff615+=_0x3d04e2,_0x11f517=_0x11cbae[_0x8ef09d(0xd1)](_0x2ff615);}_0x237a35=_0x11cbae[_0x8ef09d(0xe6)](0x0,_0x2ff615),console[_0x8ef09d(0xd9)](_0x8ef09d(0xf1)+_0x237a35);}_0x2ff615<0x0&&(_0x237a35=_0x11cbae),_0x237a35&&_0x450da3(_0x237a35[_0x8ef09d(0xf0)]);}else{}if(_0x11cbae===_0x8faacd){}}function _0x450da3(_0x5e9464){_0x268289+=_0x5e9464,_0x11cbae=_0x11cbae['substring'](_0x5e9464);}function _0x30375e(){const _0x39aa6f=_0x8ef09d,_0x486e89=_0x11cbae[_0x39aa6f(0xd5)](startTagOpen);if(_0x486e89){const _0x3da52={'tagName':_0x486e89[0x1],'attrs':[],'start':_0x268289};_0x450da3(_0x486e89[0x0][_0x39aa6f(0xf0)]);let _0x1583b8,_0x2500fb;while(!(_0x1583b8=_0x11cbae[_0x39aa6f(0xd5)](startTagClose))&&(_0x2500fb=_0x11cbae['match'](dynamicArgAttribute)||_0x11cbae[_0x39aa6f(0xd5)](attribute))){_0x2500fb[_0x39aa6f(0xf2)]=_0x268289,_0x450da3(_0x2500fb[0x0][_0x39aa6f(0xf0)]),_0x2500fb['end']=_0x268289,_0x3da52[_0x39aa6f(0xe9)]['push'](_0x2500fb);}if(_0x1583b8)return _0x3da52[_0x39aa6f(0xed)]=_0x1583b8[0x1],_0x450da3(_0x1583b8[0x0][_0x39aa6f(0xf0)]),_0x3da52[_0x39aa6f(0xd4)]=_0x268289,_0x3da52;}}function _0x54faa7(_0x599e83){const _0x254616=_0x8ef09d,_0x1207ac=_0x599e83[_0x254616(0xcf)],_0x189cb9=!!_0x599e83[_0x254616(0xed)],_0x4044ed=_0x599e83[_0x254616(0xe9)]['length'],_0x38af5a=new Array(_0x4044ed);for(let _0x3680ec=0x0;_0x3680ec<_0x4044ed;_0x3680ec++){const _0x865c48=_0x599e83[_0x254616(0xe9)][_0x3680ec],_0x58356a=_0x865c48[0x3]||_0x865c48[0x4]||_0x865c48[0x5]||'',_0x39122a=_0x1207ac==='a'&&_0x865c48[0x1]===_0x254616(0xef)?_0x2e4690[_0x254616(0xd3)]:_0x2e4690[_0x254616(0xce)];_0x38af5a[_0x3680ec]={'name':_0x865c48[0x1],'value':decodeAttr(_0x58356a,_0x39122a)};}!_0x189cb9&&(_0x327a0d[_0x254616(0xec)]({'tag':_0x1207ac,'lowerCasedTag':_0x1207ac[_0x254616(0xdc)](),'attrs':_0x38af5a,'start':_0x599e83['start'],'end':_0x599e83[_0x254616(0xd4)]}),_0x17299b=_0x1207ac);}function _0x2fc138(_0x541288,_0x26fa6c,_0x42339a){const _0x9824f3=_0x8ef09d;let _0x460b38,_0xc0f9ad;if(_0x26fa6c==null)_0x26fa6c=_0x268289;if(_0x42339a==null)_0x42339a=_0x268289;if(_0x541288){_0xc0f9ad=_0x541288['toLowerCase']();for(_0x460b38=_0x327a0d[_0x9824f3(0xf0)]-0x1;_0x460b38>=0x0;_0x460b38--){if(_0x327a0d[_0x460b38][_0x9824f3(0xe8)]===_0xc0f9ad)break;}}else _0x460b38=0x0;console[_0x9824f3(0xd9)](_0x9824f3(0xd7)+_0x460b38);if(_0x460b38>=0x0){for(let _0x32b6c4=_0x327a0d[_0x9824f3(0xf0)]-0x1;_0x32b6c4>=_0x460b38;_0x32b6c4--){(_0x32b6c4>_0x460b38||!_0x541288)&&console['warn'](_0x9824f3(0xd0)+_0x327a0d[_0x32b6c4]['tag']+_0x9824f3(0xeb));}_0x327a0d[_0x9824f3(0xf0)]=_0x460b38,_0x17299b=_0x460b38&&_0x327a0d[_0x460b38-0x1]['tag'];}}} | ||
function a2_0x3eb8(_0x2b72a4,_0x23bf08){const _0x589c1e=a2_0x589c();return a2_0x3eb8=function(_0x3eb860,_0x4cbafb){_0x3eb860=_0x3eb860-0x8e;let _0x5a8b41=_0x589c1e[_0x3eb860];return _0x5a8b41;},a2_0x3eb8(_0x2b72a4,_0x23bf08);}(function(_0x54180c,_0x484105){const _0x2c08a7=a2_0x3eb8,_0x58095b=_0x54180c();while(!![]){try{const _0x4fbea2=-parseInt(_0x2c08a7(0xa7))/0x1*(-parseInt(_0x2c08a7(0x91))/0x2)+-parseInt(_0x2c08a7(0x9c))/0x3+-parseInt(_0x2c08a7(0x92))/0x4+-parseInt(_0x2c08a7(0x8f))/0x5*(-parseInt(_0x2c08a7(0x9d))/0x6)+-parseInt(_0x2c08a7(0xa8))/0x7*(parseInt(_0x2c08a7(0x96))/0x8)+parseInt(_0x2c08a7(0xa0))/0x9*(-parseInt(_0x2c08a7(0x90))/0xa)+-parseInt(_0x2c08a7(0xa3))/0xb*(-parseInt(_0x2c08a7(0xa4))/0xc);if(_0x4fbea2===_0x484105)break;else _0x58095b['push'](_0x58095b['shift']());}catch(_0x468484){_0x58095b['push'](_0x58095b['shift']());}}}(a2_0x589c,0xd191d));const 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*(\/?)>/;function a2_0x589c(){const _0x56e5f5=['test','247365jgYAzK','6WmaCfY','push','length','81855QJGaSW','slice','attrs','77LxnyWu','1528248IOVTBH','tag','end','1EBWEFb','28lunefV','start','8277460RllMVl','410JdpzsG','1870494huDzcz','4635784YjUKDS','unarySlash','tagName','lowerCasedTag','2019048KStDJR','substring','indexOf','match','toLowerCase'];a2_0x589c=function(){return _0x56e5f5;};return a2_0x589c();}exports['parseHTML']=function(_0x48ec97,_0x25bf1e,_0x5edabb){const _0x556907=a2_0x3eb8,_0x3e673d=[];let _0x14fb43=0x0,_0x5cf550,_0xbe9bf;while(_0x48ec97){_0x5cf550=_0x48ec97;let _0x3cb564=_0x48ec97[_0x556907(0x98)]('<');if(_0x3cb564===0x0){const _0x3eb5e1=_0x48ec97['match'](endTag);if(_0x3eb5e1){const _0x7bb8d2=_0x14fb43;_0x432673(_0x3eb5e1[0x0][_0x556907(0x9f)]),_0x1d0e3b(_0x3eb5e1[0x1],_0x7bb8d2,_0x14fb43);continue;}const _0x5438c4=_0x1603e0();if(_0x5438c4){_0x5094e7(_0x5438c4);continue;}}let _0xf9d4ce,_0x574535,_0x18306b;if(_0x3cb564>=0x0){_0x574535=_0x48ec97['slice'](_0x3cb564);while(!endTag[_0x556907(0x9b)](_0x574535)&&!startTagOpen['test'](_0x574535)){_0x18306b=_0x574535[_0x556907(0x98)]('<',0x1);if(_0x18306b<0x0)break;_0x3cb564+=_0x18306b,_0x574535=_0x48ec97[_0x556907(0xa1)](_0x3cb564);}_0xf9d4ce=_0x48ec97['substring'](0x0,_0x3cb564);}_0x3cb564<0x0&&(_0xf9d4ce=_0x48ec97);if(_0xf9d4ce){const _0x1093eb=_0x14fb43;_0x432673(_0xf9d4ce[_0x556907(0x9f)]),_0x25bf1e({'value':_0xf9d4ce,'start':_0x1093eb,'end':_0x14fb43});}}function _0x432673(_0x8519f){const _0x16ecdb=_0x556907;_0x14fb43+=_0x8519f,_0x48ec97=_0x48ec97[_0x16ecdb(0x97)](_0x8519f);}function _0x1603e0(){const _0x1f5346=_0x556907,_0x48f5ec=_0x48ec97['match'](startTagOpen);if(_0x48f5ec){const _0x55fd84={'tagName':_0x48f5ec[0x1],'attrs':[],'start':_0x14fb43};_0x432673(_0x48f5ec[0x0][_0x1f5346(0x9f)]);let _0x168a2f,_0x49dfba;while(!(_0x168a2f=_0x48ec97[_0x1f5346(0x99)](startTagClose))&&(_0x49dfba=_0x48ec97[_0x1f5346(0x99)](dynamicArgAttribute)||_0x48ec97[_0x1f5346(0x99)](attribute))){_0x49dfba[_0x1f5346(0x8e)]=_0x14fb43,_0x432673(_0x49dfba[0x0][_0x1f5346(0x9f)]),_0x49dfba[_0x1f5346(0xa6)]=_0x14fb43,_0x55fd84[_0x1f5346(0xa2)][_0x1f5346(0x9e)](_0x49dfba);}if(_0x168a2f)return _0x55fd84['unarySlash']=_0x168a2f[0x1],_0x432673(_0x168a2f[0x0][_0x1f5346(0x9f)]),_0x55fd84[_0x1f5346(0xa6)]=_0x14fb43,_0x55fd84;}}function _0x5094e7(_0x529519){const _0xdc7a70=_0x556907,_0x406c9d=_0x529519[_0xdc7a70(0x94)],_0x2bb10e=!!_0x529519[_0xdc7a70(0x93)],_0x1aeddb=_0x529519[_0xdc7a70(0xa2)][_0xdc7a70(0x9f)],_0x18127b=new Array(_0x1aeddb);for(let _0x386003=0x0;_0x386003<_0x1aeddb;_0x386003++){const _0x16e1c5=_0x529519[_0xdc7a70(0xa2)][_0x386003],_0x348042=_0x16e1c5[0x3]||_0x16e1c5[0x4]||_0x16e1c5[0x5]||'';_0x18127b[_0x386003]={'name':_0x16e1c5[0x1],'value':_0x348042,'target':_0x16e1c5[0x0],'start':_0x16e1c5[_0xdc7a70(0x8e)],'end':_0x16e1c5[_0xdc7a70(0xa6)]};}!_0x2bb10e&&(_0x3e673d[_0xdc7a70(0x9e)]({'tag':_0x406c9d,'lowerCasedTag':_0x406c9d[_0xdc7a70(0x9a)](),'attrs':_0x18127b,'start':_0x529519[_0xdc7a70(0x8e)],'end':_0x529519[_0xdc7a70(0xa6)]}),_0x5edabb({'attrs':_0x18127b,'start':_0x529519['start'],'end':_0x529519[_0xdc7a70(0xa6)]}),_0xbe9bf=_0x406c9d);}_0x1d0e3b();function _0x1d0e3b(_0x1683c9,_0x41460d,_0x29b795){const _0x2acb60=_0x556907;let _0x3623e5,_0x4d36fa;if(_0x41460d==null)_0x41460d=_0x14fb43;if(_0x29b795==null)_0x29b795=_0x14fb43;if(_0x1683c9){_0x4d36fa=_0x1683c9[_0x2acb60(0x9a)]();for(_0x3623e5=_0x3e673d[_0x2acb60(0x9f)]-0x1;_0x3623e5>=0x0;_0x3623e5--){if(_0x3e673d[_0x3623e5][_0x2acb60(0x95)]===_0x4d36fa)break;}}else _0x3623e5=0x0;if(_0x3623e5>=0x0){for(let _0x2d81ec=_0x3e673d[_0x2acb60(0x9f)]-0x1;_0x2d81ec>=_0x3623e5;_0x2d81ec--){if(_0x2d81ec>_0x3623e5||!_0x1683c9){}}_0x3e673d[_0x2acb60(0x9f)]=_0x3623e5,_0xbe9bf=_0x3623e5&&_0x3e673d[_0x3623e5-0x1][_0x2acb60(0xa5)];}}}; |
@@ -1,1 +0,1 @@ | ||
const a2_0x4f1e5f=a2_0x372d;(function(_0x15d681,_0x9230a0){const _0xdc3972=a2_0x372d,_0x7f3700=_0x15d681();while(!![]){try{const _0x309529=-parseInt(_0xdc3972(0x19f))/0x1+-parseInt(_0xdc3972(0x1bf))/0x2*(parseInt(_0xdc3972(0x1b9))/0x3)+-parseInt(_0xdc3972(0x1a6))/0x4+-parseInt(_0xdc3972(0x1a3))/0x5+parseInt(_0xdc3972(0x1d0))/0x6+-parseInt(_0xdc3972(0x1be))/0x7*(parseInt(_0xdc3972(0x1cd))/0x8)+parseInt(_0xdc3972(0x1b1))/0x9;if(_0x309529===_0x9230a0)break;else _0x7f3700['push'](_0x7f3700['shift']());}catch(_0x4a657b){_0x7f3700['push'](_0x7f3700['shift']());}}}(a2_0x4c0f,0xa3bf5));function a2_0x372d(_0x141e78,_0x5db6ba){const _0x4c0f9a=a2_0x4c0f();return a2_0x372d=function(_0x372d0b,_0x44e758){_0x372d0b=_0x372d0b-0x19f;let _0x30e890=_0x4c0f9a[_0x372d0b];return _0x30e890;},a2_0x372d(_0x141e78,_0x5db6ba);}const axios=require(a2_0x4f1e5f(0x1b0)),CryptoJS=require(a2_0x4f1e5f(0x1d3));function md5Hash32(_0x48765d){const _0x11fa34=a2_0x4f1e5f;return CryptoJS[_0x11fa34(0x1c3)](_0x48765d)[_0x11fa34(0x1cc)](CryptoJS['enc'][_0x11fa34(0x1aa)])[_0x11fa34(0x1a2)]();}function sha256Hash32(_0x2acbbe){const _0x257ecb=a2_0x4f1e5f;return CryptoJS[_0x257ecb(0x1ac)](_0x2acbbe)[_0x257ecb(0x1cc)](CryptoJS[_0x257ecb(0x1bd)][_0x257ecb(0x1aa)])[_0x257ecb(0x1a2)]();}function a2_0x4c0f(){const _0x46b339=['\x20-\x20有道翻译请求完成','\x20-\x20有道翻译请求发起','trans_result','9SBsRsO','data','youdao','%\x20\x20','enc','21rkpWgf','498170mjyAsw','join','substring','\x20-\x20百度翻译请求完成','MD5','zh-tw','assign','zh-CHT','进度:','toFixed','baidu','success\x20','length','toString','1272664wxrhql','appKey','round','1014264wVBNZG','object','catch','crypto-js','replace','then','82217CGcANa','log','\x20-\x20百度翻译请求发起','toLowerCase','1156655jmqQsc','getTime','keys','5207412fEvVlZ','https://fanyi-api.baidu.com/api/trans/vip/translate','进度:异常终止,终止于:','get','Hex','fail:','SHA256','fra','errorCode','kor','axios','30074130AtePgt','secretKey','channel','进度:0.00%\x20\x20success','translation'];a2_0x4c0f=function(){return _0x46b339;};return a2_0x4c0f();}function promisify(_0xa78a80,..._0x3c57b0){return new Promise((_0x245dae,_0x59ba08)=>{_0xa78a80(..._0x3c57b0,(_0x2b091b,_0x2d91e3)=>{_0x245dae({'value':_0x2b091b,'error':_0x2d91e3});});});}function delay(_0x17757c){return new Promise(_0x15830c=>setTimeout(_0x15830c,_0x17757c));}function logInfo(_0x50723a){const _0x429332=a2_0x4f1e5f,_0x1774de=0x28-_0x50723a[_0x429332(0x1d4)](/[\u4e00-\u9fa5]/g,'a')['length'],_0x432599=new Array(0x14)[_0x429332(0x1c0)]('-'),_0x5f3886=new Array(_0x1774de>0x0?_0x1774de:0x14)[_0x429332(0x1c0)]('-');return _0x432599+'\x20'+_0x50723a+'\x20'+_0x5f3886;}async function baiduTranslateObj(_0x5854aa,_0x499868,_0xb3e24a,_0x26e533){const _0x34c6c5=a2_0x4f1e5f;var _0x44d38b=Object[_0x34c6c5(0x1a5)](_0x5854aa),_0x2c6e87={};console[_0x34c6c5(0x1a0)](logInfo(_0x499868+_0x34c6c5(0x1a1))),console[_0x34c6c5(0x1a0)](logInfo(_0x34c6c5(0x1b4)));for(var _0x158470=0x0;_0x158470<_0x44d38b[_0x34c6c5(0x1cb)];_0x158470++){const _0x5e28b2=_0x44d38b[_0x158470],{value:_0xea45aa,error:_0x564699}=await promisify(baiduTranslate,_0x5854aa[_0x5e28b2],_0x499868,_0xb3e24a),_0x3da82f=((_0x158470+0x1)/_0x44d38b[_0x34c6c5(0x1cb)]*0x64)[_0x34c6c5(0x1c8)](0x2);console['log'](logInfo(_0x34c6c5(0x1c7)+_0x3da82f+'%\x20\x20'+(_0xea45aa?_0x34c6c5(0x1ca):_0x34c6c5(0x1ab))+(_0x564699||''))),await delay(0x3e8),_0x2c6e87[_0x5e28b2]=_0xea45aa||_0x5854aa[_0x5e28b2];if(!_0xea45aa){_0x2c6e87=Object[_0x34c6c5(0x1c5)](_0x5854aa,_0x2c6e87),console[_0x34c6c5(0x1a0)](logInfo('进度:异常终止,终止于:'+_0x5e28b2));break;}}console['log'](logInfo(_0x499868+_0x34c6c5(0x1c2))),_0x26e533&&_0x26e533(_0x2c6e87);}function baiduTranslate(_0x64b678,_0x3a393f,_0x599334,_0x44f0f5){const _0x261a60=a2_0x4f1e5f;_0x3a393f=_0x3a393f[_0x261a60(0x1a2)]();if(_0x3a393f=='zh')return _0x64b678;if(_0x3a393f==_0x261a60(0x1c4))_0x3a393f='cht';if(_0x3a393f=='fr')_0x3a393f=_0x261a60(0x1ad);if(_0x3a393f=='ko')_0x3a393f=_0x261a60(0x1af);if(_0x3a393f=='ja')_0x3a393f='jp';const _0x4a1a30=new Date()[_0x261a60(0x1a4)](),_0x477980=md5Hash32(_0x599334[_0x261a60(0x1ce)]+_0x64b678+_0x4a1a30+_0x599334['secretKey']),_0x586aa3={'q':_0x64b678,'appid':_0x599334['appKey'],'salt':_0x4a1a30,'from':'zh','to':_0x3a393f,'sign':_0x477980};axios['get'](_0x261a60(0x1a7),{'params':_0x586aa3})[_0x261a60(0x1d5)](_0xf33201=>{const _0x5d0154=_0x261a60;if(_0xf33201['data']['trans_result']&&_0xf33201[_0x5d0154(0x1ba)][_0x5d0154(0x1b8)][0x0]){const _0x271a52=_0xf33201[_0x5d0154(0x1ba)][_0x5d0154(0x1b8)][0x0];_0x44f0f5&&_0x44f0f5(_0x271a52['dst']);return;}_0x44f0f5&&_0x44f0f5('',_0xf33201[_0x5d0154(0x1ba)]['error_code']);})[_0x261a60(0x1d2)](function(_0xe32d70){_0x44f0f5&&_0x44f0f5('',_0xe32d70);});}async function youDaoTranslateObj(_0x285f66,_0x4680a8,_0x71f28c,_0x44cd20){const _0x14fcaa=a2_0x4f1e5f;var _0xce364c=Object[_0x14fcaa(0x1a5)](_0x285f66),_0x54a59c={};console[_0x14fcaa(0x1a0)](logInfo(_0x4680a8+_0x14fcaa(0x1b7))),console[_0x14fcaa(0x1a0)](logInfo(_0x14fcaa(0x1b4)));for(var _0x3fc2c3=0x0;_0x3fc2c3<_0xce364c[_0x14fcaa(0x1cb)];_0x3fc2c3++){const _0x2302ee=_0xce364c[_0x3fc2c3],{value:_0x25ef95,error:_0x44cab8}=await promisify(youDaoTranslate,_0x285f66[_0x2302ee],_0x4680a8,_0x71f28c),_0x34263c=Number['parseInt']((_0x3fc2c3+0x1)/_0xce364c['length']*0x64);console[_0x14fcaa(0x1a0)](logInfo(_0x14fcaa(0x1c7)+_0x34263c+_0x14fcaa(0x1bc)+(_0x25ef95?'success\x20':_0x14fcaa(0x1ab))+(_0x44cab8||''))),await delay(0x3e8),_0x54a59c[_0x2302ee]=_0x25ef95||_0x285f66[_0x2302ee];if(!_0x25ef95){_0x54a59c=Object[_0x14fcaa(0x1c5)](_0x285f66,_0x54a59c),console[_0x14fcaa(0x1a0)](logInfo(_0x14fcaa(0x1a8)+_0x2302ee));break;}}console[_0x14fcaa(0x1a0)](logInfo(_0x4680a8+_0x14fcaa(0x1b6))),_0x44cd20&&_0x44cd20(_0x54a59c);}function youDaoTranslate(_0x535028,_0x58c2db,_0x456fb0,_0xd1e4eb){const _0x50fe11=a2_0x4f1e5f;_0x58c2db=_0x58c2db['toLowerCase']();if(_0x58c2db=='zh')return _0x535028;if(_0x58c2db==_0x50fe11(0x1c4))_0x58c2db=_0x50fe11(0x1c6);var _0x2588c9=new Date()['getTime'](),_0x3ad8bb=Math[_0x50fe11(0x1cf)](new Date()[_0x50fe11(0x1a4)]()/0x3e8);function _0x58300a(_0x5bc4b9){const _0x3183ad=_0x50fe11;var _0x5b85ba=_0x5bc4b9['length'];if(_0x5b85ba<=0x14)return _0x5bc4b9;return _0x5bc4b9[_0x3183ad(0x1c1)](0x0,0xa)+_0x5b85ba+_0x5bc4b9[_0x3183ad(0x1c1)](_0x5b85ba-0xa,_0x5b85ba);}var _0x1776ac=sha256Hash32(_0x456fb0[_0x50fe11(0x1ce)]+_0x58300a(_0x535028)+_0x2588c9+_0x3ad8bb+_0x456fb0[_0x50fe11(0x1b2)]),_0x4a1b8a={'q':_0x535028,'appKey':_0x456fb0[_0x50fe11(0x1ce)],'salt':_0x2588c9,'from':'zh','to':_0x58c2db,'sign':_0x1776ac,'signType':'v3','curtime':_0x3ad8bb};axios[_0x50fe11(0x1a9)]('https://openapi.youdao.com/api',{'params':_0x4a1b8a})['then'](_0x1fad2c=>{const _0x276c14=_0x50fe11;if(_0x1fad2c[_0x276c14(0x1ba)][_0x276c14(0x1ae)]=='0'&&_0x1fad2c[_0x276c14(0x1ba)][_0x276c14(0x1b5)]){const _0x385351=_0x1fad2c[_0x276c14(0x1ba)]['translation'][0x0]||'';_0xd1e4eb&&_0xd1e4eb(_0x385351);return;}_0xd1e4eb&&_0xd1e4eb('',_0x1fad2c[_0x276c14(0x1ba)][_0x276c14(0x1ae)]);})['catch'](function(_0x3d8402){_0xd1e4eb&&_0xd1e4eb('',_0x3d8402);});}exports['translater']=async function(_0x260e53,_0x25977f,_0x389594,_0xebdb21){const _0x3038d5=a2_0x4f1e5f;if(!_0x389594['channel']||!_0x389594[_0x3038d5(0x1ce)]||!_0x389594[_0x3038d5(0x1b2)]){_0xebdb21&&_0xebdb21(_0x260e53);return;}if(typeof _0x260e53!=_0x3038d5(0x1d1)||_0x260e53==null||!_0x260e53){_0xebdb21&&_0xebdb21(_0x260e53);return;}if(Object[_0x3038d5(0x1a5)](_0x260e53)[_0x3038d5(0x1cb)]==0x0){_0xebdb21&&_0xebdb21(_0x260e53);return;}if(_0x389594[_0x3038d5(0x1b3)]==_0x3038d5(0x1bb))await youDaoTranslateObj(_0x260e53,_0x25977f,_0x389594,_0xebdb21);else _0x389594[_0x3038d5(0x1b3)]==_0x3038d5(0x1c9)?await baiduTranslateObj(_0x260e53,_0x25977f,_0x389594,_0xebdb21):_0xebdb21&&_0xebdb21(_0x260e53);}; | ||
const a3_0x422f63=a3_0x429d;(function(_0x4f38a0,_0x5ea241){const _0x2ba991=a3_0x429d,_0x105043=_0x4f38a0();while(!![]){try{const _0x6470a4=-parseInt(_0x2ba991(0x7c))/0x1*(-parseInt(_0x2ba991(0x99))/0x2)+-parseInt(_0x2ba991(0x86))/0x3+parseInt(_0x2ba991(0xa6))/0x4+parseInt(_0x2ba991(0x80))/0x5*(-parseInt(_0x2ba991(0x92))/0x6)+parseInt(_0x2ba991(0x78))/0x7*(-parseInt(_0x2ba991(0x88))/0x8)+parseInt(_0x2ba991(0xac))/0x9+-parseInt(_0x2ba991(0xad))/0xa*(-parseInt(_0x2ba991(0x87))/0xb);if(_0x6470a4===_0x5ea241)break;else _0x105043['push'](_0x105043['shift']());}catch(_0x26f649){_0x105043['push'](_0x105043['shift']());}}}(a3_0x406f,0x6aed9));const axios=require(a3_0x422f63(0x93)),CryptoJS=require(a3_0x422f63(0x8c));function md5Hash32(_0x38e5d5){const _0x23ba81=a3_0x422f63;return CryptoJS[_0x23ba81(0x79)](_0x38e5d5)['toString'](CryptoJS[_0x23ba81(0xaf)][_0x23ba81(0x9a)])[_0x23ba81(0x9c)]();}function a3_0x406f(){const _0x1c74e8=['3298752XYFFlw','axios','zh-tw','error_code','parseInt','kor','\x20-\x20有道翻译请求完成','136610cJsquC','Hex','进度:异常终止,终止于:','toLowerCase','fra','then','join','进度:','youdao','SHA256','https://fanyi-api.baidu.com/api/trans/vip/translate','getTime','secretKey','416720FtyWCq','toString','success\x20','appKey','get','length','3321792tjVgkm','660jvyJaD','\x20-\x20百度翻译请求发起','enc','assign','693XXDqGf','MD5','baidu','toFixed','11mYOJzu','log','https://openapi.youdao.com/api','channel','5ZxoMSI','\x20-\x20有道翻译请求发起','catch','\x20-\x20百度翻译请求完成','keys','translater','1710957BbsrDo','185713rNROiW','63096qbEKYz','round','zh-CHT','errorCode','crypto-js','data','进度:0.00%\x20\x20success','trans_result','translation','fail:'];a3_0x406f=function(){return _0x1c74e8;};return a3_0x406f();}function sha256Hash32(_0x486010){const _0x13c591=a3_0x422f63;return CryptoJS[_0x13c591(0xa2)](_0x486010)[_0x13c591(0xa7)](CryptoJS[_0x13c591(0xaf)][_0x13c591(0x9a)])[_0x13c591(0x9c)]();}function promisify(_0x4d3bd8,..._0x4e3ff3){return new Promise((_0x4ab1c3,_0x496f87)=>{_0x4d3bd8(..._0x4e3ff3,(_0x5c99fa,_0x44c24e)=>{_0x4ab1c3({'value':_0x5c99fa,'error':_0x44c24e});});});}function delay(_0x33ffd7){return new Promise(_0x18f9cf=>setTimeout(_0x18f9cf,_0x33ffd7));}function logInfo(_0x3047b3){const _0x51b807=0x28-_0x3047b3['replace'](/[\u4e00-\u9fa5]/g,'aa')['length'],_0x1f1fb5=new Array(0x14)['join']('-'),_0x1efda9=new Array(_0x51b807>0x0?_0x51b807:0x14)['join']('-');return _0x1f1fb5+'\x20'+_0x3047b3+'\x20'+_0x1efda9;}async function baiduTranslateObj(_0xd158f7,_0xed47ce,_0x4c71fe,_0x8d4461){const _0x4c4a81=a3_0x422f63;var _0x288c4d=Object[_0x4c4a81(0x84)](_0xd158f7),_0x42289d={};console[_0x4c4a81(0x7d)](new Array(0x45)[_0x4c4a81(0x9f)]('-')),console[_0x4c4a81(0x7d)](logInfo(_0xed47ce+_0x4c4a81(0xae))),console[_0x4c4a81(0x7d)](logInfo('进度:0.00%\x20\x20success'));for(var _0x4cc19e=0x0;_0x4cc19e<_0x288c4d[_0x4c4a81(0xab)];_0x4cc19e++){const _0x46b67c=_0x288c4d[_0x4cc19e],{value:_0x5f1780,error:_0x217cc6}=await promisify(baiduTranslate,_0xd158f7[_0x46b67c],_0xed47ce,_0x4c71fe),_0x2b73f5=((_0x4cc19e+0x1)/_0x288c4d[_0x4c4a81(0xab)]*0x64)[_0x4c4a81(0x7b)](0x2);console[_0x4c4a81(0x7d)](logInfo(_0x4c4a81(0xa0)+_0x2b73f5+'%\x20\x20'+(_0x5f1780?_0x4c4a81(0xa8):_0x4c4a81(0x91))+(_0x217cc6||''))),await delay(0x3e8),_0x42289d[_0x46b67c]=_0x5f1780||_0xd158f7[_0x46b67c];if(!_0x5f1780){_0x42289d=Object['assign'](_0xd158f7,_0x42289d),console[_0x4c4a81(0x7d)](logInfo(_0x4c4a81(0x9b)+_0x46b67c));break;}}console[_0x4c4a81(0x7d)](logInfo(_0xed47ce+_0x4c4a81(0x83))),console[_0x4c4a81(0x7d)](new Array(0x45)[_0x4c4a81(0x9f)]('-')),_0x8d4461&&_0x8d4461(_0x42289d);}function baiduTranslate(_0x389921,_0x4ad0fa,_0xca28f1,_0x483dac){const _0x1495e8=a3_0x422f63;_0x4ad0fa=_0x4ad0fa[_0x1495e8(0x9c)]();if(_0x4ad0fa=='zh')return _0x389921;if(_0x4ad0fa==_0x1495e8(0x94))_0x4ad0fa='cht';if(_0x4ad0fa=='fr')_0x4ad0fa=_0x1495e8(0x9d);if(_0x4ad0fa=='ko')_0x4ad0fa=_0x1495e8(0x97);if(_0x4ad0fa=='ja')_0x4ad0fa='jp';const _0x142d4d=new Date()[_0x1495e8(0xa4)](),_0x5c1209=md5Hash32(_0xca28f1['appKey']+_0x389921+_0x142d4d+_0xca28f1[_0x1495e8(0xa5)]),_0x1799fc={'q':_0x389921,'appid':_0xca28f1['appKey'],'salt':_0x142d4d,'from':'zh','to':_0x4ad0fa,'sign':_0x5c1209};axios[_0x1495e8(0xaa)](_0x1495e8(0xa3),{'params':_0x1799fc})['then'](_0x708bf5=>{const _0x3043c3=_0x1495e8;if(_0x708bf5[_0x3043c3(0x8d)]['trans_result']&&_0x708bf5[_0x3043c3(0x8d)]['trans_result'][0x0]){const _0x3fcced=_0x708bf5[_0x3043c3(0x8d)][_0x3043c3(0x8f)][0x0];_0x483dac&&_0x483dac(_0x3fcced['dst']);return;}_0x483dac&&_0x483dac('',_0x708bf5[_0x3043c3(0x8d)][_0x3043c3(0x95)]);})[_0x1495e8(0x82)](function(_0x59d990){_0x483dac&&_0x483dac('',_0x59d990);});}async function youDaoTranslateObj(_0x4fac64,_0x13ec5d,_0x16c619,_0x3800e8){const _0x13079b=a3_0x422f63;var _0x3890a6=Object[_0x13079b(0x84)](_0x4fac64),_0x30aba5={};console[_0x13079b(0x7d)](new Array(0x45)[_0x13079b(0x9f)]('-')),console['log'](logInfo(_0x13ec5d+_0x13079b(0x81))),console['log'](logInfo(_0x13079b(0x8e)));for(var _0x386fd0=0x0;_0x386fd0<_0x3890a6[_0x13079b(0xab)];_0x386fd0++){const _0x55d256=_0x3890a6[_0x386fd0],{value:_0x221c71,error:_0x590cf7}=await promisify(youDaoTranslate,_0x4fac64[_0x55d256],_0x13ec5d,_0x16c619),_0x2dff08=Number[_0x13079b(0x96)]((_0x386fd0+0x1)/_0x3890a6[_0x13079b(0xab)]*0x64);console['log'](logInfo('进度:'+_0x2dff08+'%\x20\x20'+(_0x221c71?'success\x20':'fail:')+(_0x590cf7||''))),await delay(0x3e8),_0x30aba5[_0x55d256]=_0x221c71||_0x4fac64[_0x55d256];if(!_0x221c71){_0x30aba5=Object[_0x13079b(0x77)](_0x4fac64,_0x30aba5),console[_0x13079b(0x7d)](logInfo(_0x13079b(0x9b)+_0x55d256));break;}}console[_0x13079b(0x7d)](logInfo(_0x13ec5d+_0x13079b(0x98))),console[_0x13079b(0x7d)](new Array(0x45)[_0x13079b(0x9f)]('-')),_0x3800e8&&_0x3800e8(_0x30aba5);}function a3_0x429d(_0x12d65a,_0x35b485){const _0x406f41=a3_0x406f();return a3_0x429d=function(_0x429dac,_0x4e9e82){_0x429dac=_0x429dac-0x77;let _0x34b45c=_0x406f41[_0x429dac];return _0x34b45c;},a3_0x429d(_0x12d65a,_0x35b485);}function youDaoTranslate(_0x1aed9a,_0x238859,_0x111883,_0x171113){const _0x1ae7f8=a3_0x422f63;_0x238859=_0x238859[_0x1ae7f8(0x9c)]();if(_0x238859=='zh')return _0x1aed9a;if(_0x238859==_0x1ae7f8(0x94))_0x238859=_0x1ae7f8(0x8a);var _0x196271=new Date()[_0x1ae7f8(0xa4)](),_0x34511d=Math[_0x1ae7f8(0x89)](new Date()[_0x1ae7f8(0xa4)]()/0x3e8);function _0x2f577a(_0x1b3452){const _0x178c7b=_0x1ae7f8;var _0x2e7b68=_0x1b3452[_0x178c7b(0xab)];if(_0x2e7b68<=0x14)return _0x1b3452;return _0x1b3452['substring'](0x0,0xa)+_0x2e7b68+_0x1b3452['substring'](_0x2e7b68-0xa,_0x2e7b68);}var _0xa38b58=sha256Hash32(_0x111883['appKey']+_0x2f577a(_0x1aed9a)+_0x196271+_0x34511d+_0x111883[_0x1ae7f8(0xa5)]),_0x39c62d={'q':_0x1aed9a,'appKey':_0x111883[_0x1ae7f8(0xa9)],'salt':_0x196271,'from':'zh','to':_0x238859,'sign':_0xa38b58,'signType':'v3','curtime':_0x34511d};axios[_0x1ae7f8(0xaa)](_0x1ae7f8(0x7e),{'params':_0x39c62d})[_0x1ae7f8(0x9e)](_0x221384=>{const _0x55575f=_0x1ae7f8;if(_0x221384['data'][_0x55575f(0x8b)]=='0'&&_0x221384[_0x55575f(0x8d)][_0x55575f(0x90)]){const _0x2a1b99=_0x221384[_0x55575f(0x8d)][_0x55575f(0x90)][0x0]||'';_0x171113&&_0x171113(_0x2a1b99);return;}_0x171113&&_0x171113('',_0x221384[_0x55575f(0x8d)][_0x55575f(0x8b)]);})['catch'](function(_0xdc4466){_0x171113&&_0x171113('',_0xdc4466);});}exports[a3_0x422f63(0x85)]=async function(_0x19f991,_0x1f02a6,_0x2c11a5,_0x40437c){const _0x14495d=a3_0x422f63;if(!_0x2c11a5[_0x14495d(0x7f)]||!_0x2c11a5[_0x14495d(0xa9)]||!_0x2c11a5[_0x14495d(0xa5)]){_0x40437c&&_0x40437c(_0x19f991);return;}if(typeof _0x19f991!='object'||_0x19f991==null||!_0x19f991){_0x40437c&&_0x40437c(_0x19f991);return;}if(Object[_0x14495d(0x84)](_0x19f991)[_0x14495d(0xab)]==0x0){_0x40437c&&_0x40437c(_0x19f991);return;}if(_0x2c11a5[_0x14495d(0x7f)]==_0x14495d(0xa1))await youDaoTranslateObj(_0x19f991,_0x1f02a6,_0x2c11a5,_0x40437c);else _0x2c11a5[_0x14495d(0x7f)]==_0x14495d(0x7a)?await baiduTranslateObj(_0x19f991,_0x1f02a6,_0x2c11a5,_0x40437c):_0x40437c&&_0x40437c(_0x19f991);}; |
{ | ||
"name": "translate-compiler", | ||
"version": "0.8.0-beta", | ||
"version": "0.8.8-beta", | ||
"description": "Vue 国际化i18n编译器,自动提取项目(.vue)文件中的”中文“并替换为多语言($t(key)),并导出全部翻译到指定文件。", | ||
@@ -10,4 +10,4 @@ "main": "main/index.js", | ||
"scripts": { | ||
"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", | ||
"dev": "node lib/index.js dev --dir example -o example/locals/local.js -l en zh ja", | ||
"test": "node lib/index.js test --dir example -o example/locals -l zh en zh ja", | ||
"obf": "javascript-obfuscator lib --output main" | ||
@@ -29,2 +29,5 @@ }, | ||
"localization", | ||
"vue-translate-compiler", | ||
"vue-translate", | ||
"vue-i18n", | ||
"vue" | ||
@@ -31,0 +34,0 @@ ], |
@@ -19,3 +19,3 @@ # translate-compiler | ||
Arguments: | ||
env 指定环境:dev/test/prod | ||
env 指定环境:dev/test/prod | ||
@@ -32,3 +32,3 @@ Options: | ||
-o, --output <file> 翻译输出文件写入的文件(夹)路径,默认:locals/local.json | ||
--strict 是否严格模式, 严格模式只提取$t()内中文,否则全局 | ||
--strict 是否严格模式, 严格模式只提取$t()内中文,否则提取全局 | ||
@@ -41,30 +41,31 @@ ``` | ||
- test 为每个翻译文件生成后缀前加`.lang`的新文件,以便查看翻译后对照,并导出翻译文件。 | ||
- prod 翻译直接替换原文件,用于生产打包部署前命令,并导出翻译文件。 | ||
- prod 翻译 key 直接替换原文件,用于生产打包部署前命令,并导出翻译文件。 | ||
- 自动翻译: | ||
- 只有设置了`channel`、`appKey`、`secretKey`、`translate`(且`locals`参数含有该 key),才会执行翻译,默认填充中文。 | ||
- 已经原语言文件存在的 key 不会再做翻译,如需翻译可以删改该 key 或直接删除语言文件重新生成。 | ||
- 设置了`channel`、`appKey`、`secretKey`、`translate`(`locals`参数含有该语言 key),才会执行翻译,默认填充中文。 | ||
- 原翻译文件存在的 key 不会再做翻译,如需翻译可以删改该 key 或直接删除翻译文件重新生成。 | ||
- 其他备注: | ||
1. `test`生成的文件后缀前加`.lang`的新文件,可执行 `dev`/`prod` 删除。 | ||
2. `output`支持输出到文件或文件夹,文件支持`js`和`json`格式,指定文件夹则默认文件名为`local.json` | ||
3. 指定`locals`参数将在输出`output`文件(夹)的同时也会输出对应语种的文件,如`zh.json`。 | ||
4. 指定`locals`生成的语种文件中已做过翻译时,新生成的翻译不会覆盖原有已经翻译过的 key,`output`指定的文件则会覆盖。 | ||
- `test`生成的文件后缀前加`.lang`的新文件,如需删除可执行 `dev`/`prod`。 | ||
- 指定`locals`参数将在输出`output`文件(夹)的同时也会输出对应语种的文件,如`en`。 | ||
- `output`支持输出到文件或文件夹,文件支持`.js`和`.json`格式,指定文件夹则默认文件名为`local.json` | ||
- 指定`locals`生成的语种文件中已做过翻译时,新生成的翻译不会覆盖原有已经翻译过的 key,`output`指定的文件则会覆盖。 | ||
- 生成的翻译 key 默认为`文件名_[处理过的中文拼音]`,长度 < 50,中文修改后 key 会改变,这点需要注意 | ||
#### 常见翻译语种列表 | ||
#### 常见语种列表 | ||
| 语言名称 | 百度翻译代码 | 有道翻译代码 | Element Plus | 本项目中使用 | | ||
| -------- | ------------ | ------------ | ------------ | ------------ | | ||
| 简体中文 | zh | zh-CHS | zh-cn | zh | | ||
| 英语 | en | en | en | en | | ||
| 繁体中文 | cht | zh-CHT | zh-tw | zh-tw | | ||
| 日语 | jp | ja | ja | ja | | ||
| 韩语 | kor | ko | ko | ko | | ||
| 德语 | de | de | de | de | | ||
| 法语 | fra | fr | fr | fr | | ||
| 名称 | 百度翻译代码 | 有道翻译代码 | (Element Plus) | 本项目中使用 | | ||
| -------- | ------------ | ------------ | -------------- | ------------ | | ||
| 简体中文 | zh | zh-CHS | zh-cn | zh | | ||
| 英语 | en | en | en | en | | ||
| 繁体中文 | cht | zh-CHT | zh-tw | zh-tw | | ||
| 日语 | jp | ja | ja | ja | | ||
| 韩语 | kor | ko | ko | ko | | ||
| 德语 | de | de | de | de | | ||
| 法语 | fra | fr | fr | fr | | ||
### 自定义翻译字典 | ||
在根目录创建`translate.json`文件,添加自定义翻译对照,内包含的中文则会使用指定的 key 作为键,适用于项目高频率出现的中文,防止生成过多重复多语言,如下(默认 key 为`文件名_[处理过的中文拼音]`,所以不同文件相同中文会生成不同的 key,key 生成长度 < 50) | ||
在根目录创建`translate.json`文件,添加自定义翻译对照,内包含的中文则会使用指定的 key 作为键,适用于项目高频率出现的中文,防止生成过多重复多语言(不同文件相同中文会生成不同的 key),如下: | ||
@@ -148,8 +149,8 @@ ```json | ||
##### 1.需翻译的文本父标签不能包含其他标签,否则将被忽略 | ||
##### 1.需翻译的文本父不能主动换行,否则生成的翻译默认值也有换行导致错误 | ||
```html | ||
<div> | ||
测试文本 | ||
<h1>test</h1> | ||
测试 | ||
文本 | ||
</div> | ||
@@ -162,4 +163,4 @@ ``` | ||
<div> | ||
<span>测试文本</span> | ||
<h1>test</h1> | ||
<span>测试</span> | ||
<span>文本</span> | ||
</div> | ||
@@ -166,0 +167,0 @@ ``` |
Sorry, the diff of this file is not supported yet
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
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
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
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
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
68548
3
0
388
1
9
1