File tree Expand file tree Collapse file tree 3 files changed +196
-80
lines changed Expand file tree Collapse file tree 3 files changed +196
-80
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "version" : " 1.5.0 " ,
2
+ "version" : " 1.5.1 " ,
3
3
"license" : " MIT" ,
4
4
"main" : " dist/index.js" ,
5
5
"description" : " Translate your JSON file or object into another languages with Google Translate API" ,
65
65
"dependencies" : {
66
66
"@types/bluebird" : " ^3.5.36" ,
67
67
"@types/filesystem" : " ^0.0.32" ,
68
- "@vitalets/google-translate-api" : " ^9 .0.0" ,
68
+ "@vitalets/google-translate-api" : " 8 .0.0" ,
69
69
"axios" : " ^1.2.2" ,
70
70
"bluebird" : " ^3.7.2" ,
71
71
"cwait" : " ^1.1.2" ,
Original file line number Diff line number Diff line change 1
- import { translate } from '@vitalets/google-translate-api' ;
1
+ import translate from '@vitalets/google-translate-api' ;
2
2
import createHttpProxyAgent from 'http-proxy-agent' ;
3
3
import { LanguageCode , Sources } from '..' ;
4
4
import * as fs from 'fs/promises' ;
@@ -113,13 +113,18 @@ async function translateWithGoogle(
113
113
word : string ,
114
114
from : LanguageCode ,
115
115
to : LanguageCode ,
116
- options ?: any
116
+ options ?: { agent : any ; timeout : number }
117
117
) {
118
- const { text } = await translate ( safeValueTransition ( word ) , {
119
- from : from ,
120
- to : to ,
121
- fetchOptions : options ,
122
- } ) ;
118
+ const { text } = await translate (
119
+ safeValueTransition ( word ) ,
120
+ {
121
+ from : from ,
122
+ to : to ,
123
+ } ,
124
+ {
125
+ agent : options != undefined ? options . agent : undefined ,
126
+ }
127
+ ) ;
123
128
124
129
global . totalTranslated = global . totalTranslated + 1 ;
125
130
You can’t perform that action at this time.
0 commit comments