Skip to content

Commit

Permalink
fixed #19
Browse files Browse the repository at this point in the history
  • Loading branch information
xfslove committed Dec 18, 2018
1 parent af50a24 commit 235b80a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
"use strict";
const tts = require("./tts");
const translate = require("./translate");
const isChinese = require("is-chinese");
// 简单正则,只要包含一个就是中文
const isChinese = /[\u4E00-\u9FA5\uF900-\uFA2D]/;

const os = require('os');

const q = process.argv[2];
const to = isChinese(q) ? "en" : "zh-CN";
const from = isChinese(q) ? "zh-CN" : "en";
const from = isChinese.test(q) ? "zh-CN" : "en";
const to = from === "zh-CN" ? "en" : "zh-CN";

//文档上说cmd+L时会找largetype,找不到会找arg,但是实际并不生效。
//同时下一步的发音模块中query变量的值为arg的值。
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alfred-google-translate",
"version": "1.1.4",
"version": "1.1.5",
"description": "Alfred 3 workflow to translate between zh-cn and en with google tanslate api",
"license": "MIT",
"repository": "xfslove/alfred-google-translate",
Expand Down Expand Up @@ -39,7 +39,6 @@
"alfy": "^0.6.0",
"configstore": "^2.0.0",
"got": "^6.3.0",
"is-chinese": "^1.2.5",
"safe-eval": "^0.4.1",
"file-system": "^2.2.2"
},
Expand Down

0 comments on commit 235b80a

Please sign in to comment.