You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2021/02/17 09:40:00 UTC

[echarts-bot] branch master updated: fix(translator): tweak `detectEnglish` logic.

This is an automated email from the ASF dual-hosted git repository.

wangzx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-bot.git


The following commit(s) were added to refs/heads/master by this push:
     new c3f215f  fix(translator): tweak `detectEnglish` logic.
c3f215f is described below

commit c3f215f3c85193d13c150f9ad305b75f9bb9b35f
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Wed Feb 17 17:39:12 2021 +0800

    fix(translator): tweak `detectEnglish` logic.
---
 src/translator.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/translator.js b/src/translator.js
index 422d8ef..19614b1 100644
--- a/src/translator.js
+++ b/src/translator.js
@@ -48,8 +48,9 @@ function detectLanguage(text, detectAll) {
  */
 function detectEnglish(text) {
     const lang = detectLanguage(text, true);
-    return lang[0][0] === 'eng'
-        && (!lang[1] || (lang[1][0] === 'sco' && lang[1][1] > 0.9) || lang[1][1] < 0.9);
+    return (lang[0][0] === 'eng' && lang[0][1] === 1)
+        || (lang[0][0] === 'eng'
+            && (!lang[1] || (lang[1][0] === 'sco' && lang[1][1] > 0.9) || lang[1][1] < 0.9));
 }
 
 /**


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org