nodePapago - Unofficial papago translator.
- Note: It can stop working anytime.
- Korean Reference
Install
npm install nodepapago
Github
https://github.com/PinMIlk/nodepapago
npm
https://www.npmjs.com/package/nodepapago
Example
import Translator from 'nodepapago';
new Translator({
parameter: {
target: 'ko',
text: 'So far, so good!'
}
}).translate()
.then(res => console.log(res))
.catch(e => console.log(e));
// Expected output: '지금까지, 너무 좋아요!'
new Translator({
parameter: [
{
source: 'en',
target: 'ko',
text: 'Morning, sir.'
},
{
source: 'en',
target: 'ko',
text: 'Morning, ma\'am.'
}
],
honorific: true
}).translate()
.then(res => console.log(res))
.catch(e => console.log(e));
// Expected output: [ '안녕하세요, 선생님.', '안녕하세요, 부인.' ]
new Translator({
parameter: [
{
source: 'en',
target: 'ko',
text: 'Morning!'
},
{
source: 'en',
target: 'ko',
text: 'Morning, baby!'
}
],
verbose: true
}).translate()
.then(res => console.log(res))
.catch(e => console.log(e));
// Expected output: sooooo long...
Translator.detect('So far, so bueno!')
.then(res => console.log(res))
.catch(e => console.log(e));
// Expected output: 'it'
Table
Config
Property | Detail | Type | Required | Default |
---|---|---|---|---|
parameter |
Translate parameter (list) | TranslateParameter | TranslateParameter[] |
Y | - |
honorfic |
Respectability(Widely used in East Asian languages) | boolean |
N | false |
verbose |
If it is true, returns with raw json | boolean |
N | false |
multi |
Multi translation | boolean |
N | false |
Parameter
Property | Detail | Type | Required | Default |
---|---|---|---|---|
source |
Oringin language code | string |
N | detect |
target |
Destination language code | string |
Y | - |
text |
Text to be translated | string |
Y | - |
Language detect
Parameter | Detail | Type | Required |
---|---|---|---|
text |
Text to be detected language | string |
Y |
Language code table
Code | Language |
---|---|
ko |
Korean |
en |
English |
ja |
Japanese |
zh-cn |
Chinese(Simplified) |
zh-tw |
Chinese(Traditional) |
hi |
Hindi |
es |
Spanish |
fr |
French |
de |
German |
pt |
Portuguese |
vi |
Vietnamese |
id |
Indonesian |
fa |
Persian |
ar |
Arabic |
mm |
Myanmar |
th |
Thai |
ru |
Russian |
it |
Italian |
detect |
Auto detect |
Release
v2.2.1
Changed hashing algorithm
v2.2.4
Changed hashing algorithm
v3.0.0
Changed all source
v3.0.1
Changed hashing algorithm
v3.1.0
Changed hashing algorithm
Modularized
License
It is following MIT License.