-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
3,551 additions
and
1 deletion.
There are no files selected for viewing
Binary file added
BIN
+104 KB
docs/@kabeep/node-translate-cli/1.0.0/fonts/Montserrat/Montserrat-Bold.eot
Binary file not shown.
Binary file added
BIN
+46 KB
docs/@kabeep/node-translate-cli/1.0.0/fonts/Montserrat/Montserrat-Bold.ttf
Binary file not shown.
Binary file added
BIN
+110 KB
docs/@kabeep/node-translate-cli/1.0.0/fonts/Montserrat/Montserrat-Bold.woff
Binary file not shown.
Binary file added
BIN
+83.4 KB
docs/@kabeep/node-translate-cli/1.0.0/fonts/Montserrat/Montserrat-Bold.woff2
Binary file not shown.
Binary file added
BIN
+104 KB
docs/@kabeep/node-translate-cli/1.0.0/fonts/Montserrat/Montserrat-Regular.eot
Binary file not shown.
Binary file added
BIN
+45.3 KB
docs/@kabeep/node-translate-cli/1.0.0/fonts/Montserrat/Montserrat-Regular.ttf
Binary file not shown.
Binary file added
BIN
+109 KB
docs/@kabeep/node-translate-cli/1.0.0/fonts/Montserrat/Montserrat-Regular.woff
Binary file not shown.
Binary file added
BIN
+83.2 KB
docs/@kabeep/node-translate-cli/1.0.0/fonts/Montserrat/Montserrat-Regular.woff2
Binary file not shown.
Binary file added
BIN
+18.9 KB
docs/@kabeep/node-translate-cli/1.0.0/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot
Binary file not shown.
978 changes: 978 additions & 0 deletions
978
.../node-translate-cli/1.0.0/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+66.2 KB
docs/@kabeep/node-translate-cli/1.0.0/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf
Binary file not shown.
Binary file added
BIN
+20.6 KB
docs/@kabeep/node-translate-cli/1.0.0/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff
Binary file not shown.
Binary file added
BIN
+15.7 KB
.../@kabeep/node-translate-cli/1.0.0/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2
Binary file not shown.
Binary file added
BIN
+19.5 KB
.../@kabeep/node-translate-cli/1.0.0/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot
Binary file not shown.
1,049 changes: 1,049 additions & 0 deletions
1,049
...ode-translate-cli/1.0.0/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+67 KB
.../@kabeep/node-translate-cli/1.0.0/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf
Binary file not shown.
Binary file added
BIN
+21.2 KB
...@kabeep/node-translate-cli/1.0.0/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff
Binary file not shown.
Binary file added
BIN
+16.2 KB
...kabeep/node-translate-cli/1.0.0/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,228 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
|
||
<meta charset="utf-8"> | ||
<title>Home - Documentation</title> | ||
|
||
|
||
<script src="scripts/prettify/prettify.js"></script> | ||
<script src="scripts/prettify/lang-css.js"></script> | ||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> | ||
<script src="scripts/nav.js" defer></script> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
</head> | ||
<body> | ||
|
||
<input type="checkbox" id="nav-trigger" class="nav-trigger" /> | ||
<label for="nav-trigger" class="navicon-button x"> | ||
<div class="navicon"></div> | ||
</label> | ||
|
||
<label for="nav-trigger" class="overlay"></label> | ||
|
||
<nav > | ||
|
||
|
||
<h2><a href="index.html">Home</a></h2> | ||
|
||
</nav> | ||
|
||
<div id="main"> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<section class="package"> | ||
<h3>@kabeep/node-translate-cli 1.0.0</h3> | ||
</section> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<section class="readme usertext"> | ||
<article><div align="center"> | ||
<img width="814" src="docs/images/logo.png" alt="logo"> | ||
<p>A powerful, secure and feature-rich tool via Google Translation <strong>in terminal</strong>.</p> | ||
<hr> | ||
<p><a href="https://nodejs.org/docs/latest/api/"><img src="https://img.shields.io/node/v/%40kabeep%2Fnode-translate-cli?color=lightseagreen" alt="NodeJS"></a> | ||
<a href="LICENSE"><img src="https://img.shields.io/github/license/kabeep/node-translate-cli?color=slateblue" alt="License"></a> | ||
<a href="https://www.npmjs.com/package/@kabeep/node-translate-cli"><img src="https://img.shields.io/npm/d18m/%40kabeep%2Fnode-translate-cli?color=cornflowerblue" alt="NPM"></a> | ||
<a href="https://codecov.io/gh/kabeep/node-translate-cli"><img src="https://img.shields.io/codecov/c/github/kabeep/node-translate-cli?logo=codecov&color=mediumvioletred" alt="Codecov"></a> | ||
<a href="https://app.codacy.com/gh/kabeep/node-translate-cli/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade"><img src="https://img.shields.io/codacy/grade/2cf61fce83694f82a0a9213ac8d9a796?logo=codacy&logoColor=dodgerblue&color=dodgerblue" alt="Codacy"></a> | ||
<a href="https://dl.circleci.com/status-badge/redirect/circleci/Qh23T2Zgw4Fy4V8uvKaymp/XWLHQrsMmQsM3jydfFa2AW/tree/master"><img src="https://dl.circleci.com/status-badge/img/circleci/Qh23T2Zgw4Fy4V8uvKaymp/XWLHQrsMmQsM3jydfFa2AW/tree/master.svg?style=shield" alt="CircleCI"></a></p> | ||
<p>English | <a href="README.zh-CN.md">简体中文</a></p> | ||
<p><img src="https://repobeats.axiom.co/api/embed/f0b1b8b0150e5f891d765081ad1349cccc127c5c.svg" alt="Alt" title="Repobeats analytics image"></p> | ||
<img width="814" src="docs/images/feature.png" alt="logo"> | ||
</div> | ||
<h2>📖 Introduction</h2> | ||
<blockquote> | ||
<p>Using the <a href="https://github.com/kabeep/node-translate">node-translate</a> API in the terminal.</p> | ||
</blockquote> | ||
<h4>Besides simple text translation, it also provides:</h4> | ||
<ul> | ||
<li>Adaptive translation language</li> | ||
<li>Automatic correction of the source text</li> | ||
<li>Getting source text from stdin</li> | ||
<li>Polysemous translation results</li> | ||
<li>Synonyms of the source text</li> | ||
<li>Example sentences of the source text</li> | ||
<li>Phonetic transcription of the source and translated text</li> | ||
<li>Stable output and error prompts</li> | ||
<li>Beautiful terminal styling</li> | ||
<li>Internationalized prompt for terminal</li> | ||
</ul> | ||
<h2>⚙️ Installation</h2> | ||
<pre class="prettyprint source lang-bash"><code>npm install @kabeep/node-translate-cli --save | ||
</code></pre> | ||
<pre class="prettyprint source lang-bash"><code>yarn add @kabeep/node-translate-cli | ||
</code></pre> | ||
<pre class="prettyprint source lang-bash"><code>pnpm add @kabeep/node-translate-cli | ||
</code></pre> | ||
<h2>🚀 Usage</h2> | ||
<pre class="prettyprint source lang-text"><code>translate <text> [options] | ||
|
||
options: | ||
-f, --from The source language (language to be translated from) | ||
specified as language name or ISO 639-1 code | ||
[string] [default: "auto"] | ||
-t, --to The target language (language to be translated to) | ||
specified as language name or ISO 639-1 code | ||
[string] [default: "auto"] | ||
--timeout Timeout duration for the translation request in | ||
milliseconds [number] [default: 30000] | ||
--stdin-timeout You can use this parameter to avoid timeouts if stdin | ||
takes too long (ms) [number] [default: 5000] | ||
-r, --retry Retry attempts for the translation request in case of | ||
failure [number] [default: 0] | ||
-p, --show-phonetics Show the pronunciation of the translated word | ||
[boolean] [default: false] | ||
-s, --show-source Show source text information [boolean] [default: false] | ||
-d, --show-detail Show translated detail information [boolean] [default: false] | ||
-l, --show-list Show supported language list [boolean] [default: false] | ||
--show-code Show supported language code list [boolean] [default: false] | ||
--show-adaptive Show adaptive language [boolean] [default: false] | ||
-v, --version Show version [boolean] | ||
-h, --help Show help info [boolean] | ||
</code></pre> | ||
<div align="center"> | ||
<img width="814" src="docs/images/i18n.png" alt="logo"> | ||
<p>i18n</p> | ||
</div> | ||
<h2>🪄 Examples</h2> | ||
<h4>Using stdin</h4> | ||
<pre class="prettyprint source lang-shell"><code>echo "test" | translate -f en -t zh | ||
</code></pre> | ||
<h4>Using iso-639-1 and text parameters</h4> | ||
<pre class="prettyprint source lang-shell"><code>translate "test" --from=en --to=zh | ||
</code></pre> | ||
<h4>Adaptive source language</h4> | ||
<pre class="prettyprint source lang-shell"><code>translate "test" -t zh | ||
</code></pre> | ||
<h4>Self-detection of native language</h4> | ||
<pre class="prettyprint source lang-shell"><code>translate "test" -f en | ||
</code></pre> | ||
<h4>Autocorrect source text</h4> | ||
<pre class="prettyprint source lang-shell"><code>translate "Thunk you" | ||
</code></pre> | ||
<h4>Translate words and show synonyms, polysemy explanations and examples</h4> | ||
<pre class="prettyprint source lang-shell"><code>translate "test" -d | ||
</code></pre> | ||
<h4>Translate a word, phrase or sentence and show the source text and phonetic symbols</h4> | ||
<pre class="prettyprint source lang-shell"><code>translate "test" -s -p | ||
</code></pre> | ||
<h4>Set API timeout</h4> | ||
<pre class="prettyprint source lang-shell"><code>translate "test" --timeout=60000 | ||
</code></pre> | ||
<h4>Set the timeout for the standard input stream</h4> | ||
<pre class="prettyprint source lang-shell"><code>npm view node-translate-cli description | translate --stdin-timeout=30000 | ||
</code></pre> | ||
<h4>Set the number of retries when an API request fails</h4> | ||
<pre class="prettyprint source lang-shell"><code>translate "test" -r 2 | ||
</code></pre> | ||
<h4>Show supported languages</h4> | ||
<pre class="prettyprint source lang-shell"><code>translate -l | ||
</code></pre> | ||
<h4>Show supported language codes</h4> | ||
<pre class="prettyprint source lang-shell"><code>translate --show-code | ||
</code></pre> | ||
<h4>Show supported adaptive languages</h4> | ||
<pre class="prettyprint source lang-shell"><code>translate --show-adaptive | ||
</code></pre> | ||
<h4>Show help information</h4> | ||
<pre class="prettyprint source lang-shell"><code>translate -h | ||
</code></pre> | ||
<h4>Show the version of current</h4> | ||
<pre class="prettyprint source lang-shell"><code>translate -v | ||
</code></pre> | ||
<h2>🔧 Autocorrect</h2> | ||
<blockquote> | ||
<p><code>Default</code> white</p> | ||
<p><code>Detect Language</code> yellow</p> | ||
<p><code>Detect Spelling</code> red</p> | ||
</blockquote> | ||
<div align="center"> | ||
<img width="600" src="docs/images/autocorrect.png" alt="logo"> | ||
</div> | ||
<h2>🐢 Network anomaly</h2> | ||
<blockquote> | ||
<p>When the network is abnormal, the terminal will change as shown in the figure below | ||
(they actually come from the same line).</p> | ||
</blockquote> | ||
<div align="center"> | ||
<img width="600" src="docs/images/slowly-network.png" alt="logo"> | ||
</div> | ||
<h2>🔗 Related</h2> | ||
<ul> | ||
<li><a href="https://github.com/kabeep/node-translate">node-translate</a> - 🦜 A powerful, secure and feature-rich api via Google | ||
Translation.</li> | ||
<li><a href="https://github.com/jesusalber1/google-translate-cli">google-translate-cli</a> - Google Translate via CLI.</li> | ||
</ul> | ||
<h2>🤝 Contribution</h2> | ||
<p>Contributions via Pull Requests or <a href="https://github.com/kabeep/node-translate-cli/issues">Issues</a> are welcome.</p> | ||
<h2>📄 License</h2> | ||
<p>This project is licensed under the MIT License. See the <a href="LICENSE">LICENSE</a> file for details.</p></article> | ||
</section> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Wed May 08 2024 10:48:55 GMT+0800 (中国标准时间) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. | ||
</footer> | ||
|
||
<script>prettyPrint();</script> | ||
<script src="scripts/polyfill.js"></script> | ||
<script src="scripts/linenumber.js"></script> | ||
|
||
|
||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
function hideAllButCurrent(){ | ||
//by default all submenut items are hidden | ||
//but we need to rehide them for search | ||
document.querySelectorAll("nav > ul").forEach(function(parent) { | ||
if (parent.className.indexOf("collapse_top") !== -1) { | ||
parent.style.display = "none"; | ||
} | ||
}); | ||
document.querySelectorAll("nav > ul > li > ul li").forEach(function(parent) { | ||
parent.style.display = "none"; | ||
}); | ||
document.querySelectorAll("nav > h3").forEach(function(section) { | ||
if (section.className.indexOf("collapsed_header") !== -1) { | ||
section.addEventListener("click", function(){ | ||
if (section.nextSibling.style.display === "none") { | ||
section.nextSibling.style.display = "block"; | ||
} else { | ||
section.nextSibling.style.display = "none"; | ||
} | ||
}); | ||
} | ||
}); | ||
|
||
//only current page (if it exists) should be opened | ||
var file = window.location.pathname.split("/").pop().replace(/\.html/, ''); | ||
document.querySelectorAll("nav > ul > li > a").forEach(function(parent) { | ||
var href = parent.attributes.href.value.replace(/\.html/, ''); | ||
if (file === href) { | ||
if (parent.parentNode.parentNode.className.indexOf("collapse_top") !== -1) { | ||
parent.parentNode.parentNode.style.display = "block"; | ||
} | ||
parent.parentNode.querySelectorAll("ul li").forEach(function(elem) { | ||
elem.style.display = "block"; | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
hideAllButCurrent(); |
28 changes: 28 additions & 0 deletions
28
docs/@kabeep/node-translate-cli/1.0.0/scripts/commonNav.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
if (typeof fetch === 'function') { | ||
const init = () => { | ||
if (typeof scrollToNavItem !== 'function') return false | ||
scrollToNavItem() | ||
// hideAllButCurrent not always loaded | ||
if (typeof hideAllButCurrent === 'function') hideAllButCurrent() | ||
return true | ||
} | ||
fetch('./nav.inc.html') | ||
.then(response => response.ok ? response.text() : `${response.url} => ${response.status} ${response.statusText}`) | ||
.then(body => { | ||
document.querySelector('nav').innerHTML += body | ||
// nav.js should be quicker to load than nav.inc.html, a fallback just in case | ||
return init() | ||
}) | ||
.then(done => { | ||
if (done) return | ||
let i = 0 | ||
;(function waitUntilNavJs () { | ||
if (init()) return | ||
if (i++ < 100) return setTimeout(waitUntilNavJs, 300) | ||
console.error(Error('nav.js not loaded after 30s waiting for it')) | ||
})() | ||
}) | ||
.catch(error => console.error(error)) | ||
} else { | ||
console.error(Error('Browser too old to display commonNav (remove commonNav docdash option)')) | ||
} |
25 changes: 25 additions & 0 deletions
25
docs/@kabeep/node-translate-cli/1.0.0/scripts/linenumber.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/*global document */ | ||
(function() { | ||
var source = document.getElementsByClassName('prettyprint source linenums'); | ||
var i = 0; | ||
var lineNumber = 0; | ||
var lineId; | ||
var lines; | ||
var totalLines; | ||
var anchorHash; | ||
|
||
if (source && source[0]) { | ||
anchorHash = document.location.hash.substring(1); | ||
lines = source[0].getElementsByTagName('li'); | ||
totalLines = lines.length; | ||
|
||
for (; i < totalLines; i++) { | ||
lineNumber++; | ||
lineId = 'line' + lineNumber; | ||
lines[i].id = lineId; | ||
if (lineId === anchorHash) { | ||
lines[i].className += ' selected'; | ||
} | ||
} | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function scrollToNavItem() { | ||
var path = window.location.href.split('/').pop().replace(/\.html/, ''); | ||
document.querySelectorAll('nav a').forEach(function(link) { | ||
var href = link.attributes.href.value.replace(/\.html/, ''); | ||
if (path === href) { | ||
link.scrollIntoView({block: 'center'}); | ||
return; | ||
} | ||
}) | ||
} | ||
|
||
scrollToNavItem(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
//IE Fix, src: https://www.reddit.com/r/programminghorror/comments/6abmcr/nodelist_lacks_foreach_in_internet_explorer/ | ||
if (typeof(NodeList.prototype.forEach)!==typeof(alert)){ | ||
NodeList.prototype.forEach=Array.prototype.forEach; | ||
} |
Oops, something went wrong.