mololab / json-translator

jsontt 💡 - AI JSON Translator + other FREE translation modules to translate your json/yaml files into other languages ✅ Check Readme ✌
https://mololab.org/jsontt/npm
MIT License
427 stars 53 forks source link

an error when translate words #12

Closed solkx closed 1 year ago

solkx commented 1 year ago

with example:

import * as translator from '@parvineyvazov/json-translator';

translator.translateWord('Home sweet home!', translator.languages.English, translator.languages.Chinese_Simplified).then((value) => {
  console.log(value);
});
RangeError: Maximum call stack size exceeded
Exception in PromiseRejectCallback:
C:\Users\LiuJjiang\Desktop\a\node_modules\@parvineyvazov\json-translator\dist\json-translator.cjs.development.js:327
    reject(error);
    ^

RangeError: Maximum call stack size exceeded
C:\Users\LiuJjiang\Desktop\a\node_modules\@parvineyvazov\json-translator\dist\json-translator.cjs.development.js:138
        var record = tryCatch(innerFn, self, context);
                     ^
RangeError: Maximum call stack size exceeded
    at Generator.<anonymous> (C:\Users\LiuJjiang\Desktop\a\node_modules\@parvineyvazov\json-translator\dist\json-translator.cjs.development.js:138:22)
    at Generator.next (C:\Users\LiuJjiang\Desktop\a\node_modules\@parvineyvazov\json-translator\dist\json-translator.cjs.development.js:82:21)
    at asyncGeneratorStep (C:\Users\LiuJjiang\Desktop\a\node_modules\@parvineyvazov\json-translator\dist\json-translator.cjs.development.js:324:24)
    at _next (C:\Users\LiuJjiang\Desktop\a\node_modules\@parvineyvazov\json-translator\dist\json-translator.cjs.development.js:343:9)
    at C:\Users\LiuJjiang\Desktop\a\node_modules\@parvineyvazov\json-translator\dist\json-translator.cjs.development.js:348:7
    at new Promise (<anonymous>)
    at C:\Users\LiuJjiang\Desktop\a\node_modules\@parvineyvazov\json-translator\dist\json-translator.cjs.development.js:340:12
    at plaintranslate (C:\Users\LiuJjiang\Desktop\a\node_modules\@parvineyvazov\json-translator\src\core\core.ts:9:37)
    at _callee$ (C:\Users\LiuJjiang\Desktop\a\node_modules\@parvineyvazov\json-translator\src\core\core.ts:45:16)
    at tryCatch (C:\Users\LiuJjiang\Desktop\a\node_modules\@parvineyvazov\json-translator\dist\json-translator.cjs.development.js:57:17)
    at Generator.<anonymous> (C:\Users\LiuJjiang\Desktop\a\node_modules\@parvineyvazov\json-translator\dist\json-translator.cjs.development.js:138:22)
    at Generator.next (C:\Users\LiuJjiang\Desktop\a\node_modules\@parvineyvazov\json-translator\dist\json-translator.cjs.development.js:82:21)
    at asyncGeneratorStep (C:\Users\LiuJjiang\Desktop\a\node_modules\@parvineyvazov\json-translator\dist\json-translator.cjs.development.js:324:24)
    at _next (C:\Users\LiuJjiang\Desktop\a\node_modules\@parvineyvazov\json-translator\dist\json-translator.cjs.development.js:343:9)
    at C:\Users\LiuJjiang\Desktop\a\node_modules\@parvineyvazov\json-translator\dist\json-translator.cjs.development.js:348:7
    at new Promise (<anonymous>)
ParvinEyvazov commented 1 year ago

Hi @solkx , thank you for your report.

If you are in .js can you replace the import line with this:

const translator = require("@parvineyvazov/json-translator");

Also which version of this lib are you using?

ParvinEyvazov commented 1 year ago

I updated the package, can you please try version 1.3.0?

version 1.3.0 on npm