json-translator icon indicating copy to clipboard operation
json-translator copied to clipboard

What is wrong?

Open Aido21 opened this issue 3 years ago β€’ 14 comments

Translating. Please wait.(node:78632) UnhandledPromiseRejectionWarning: RequestError: read ETIMEDOUT at ClientRequest. (/Users/Eugene/node_modules/got/source/request-as-event-emitter.js:178:14) at Object.onceWrapper (events.js:520:26) at ClientRequest.emit (events.js:412:35) at ClientRequest.origin.emit (/Users/Eugene/node_modules/@szmarczak/http-timer/source/index.js:37:11) at TLSSocket.socketErrorListener (_http_client.js:475:9) at TLSSocket.emit (events.js:400:28) at emitErrorNT (internal/streams/destroy.js:106:8) at emitErrorCloseNT (internal/streams/destroy.js:74:3) at processTicksAndRejections (internal/process/task_queues.js:82:21) (Use node --trace-warnings ... to show where the warning was created) (node:78632) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:78632) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Aido21 avatar Feb 21 '22 03:02 Aido21

Thanks for your report. Can you please provide more information about your flow? 1 - The size of your JSON object (number of fields approximately) 2 - Which languages are you translating your JSON object to? (number of languages) 3 - Are you using CLI or functions?

ParvinEyvazov avatar Feb 21 '22 07:02 ParvinEyvazov

Hi

  1. 1237 lines
  2. English to Indonesian
  3. CLI on my MacOS

On 21 Feb 2022, at 15:38, Parvin Eyvazov @.***> wrote:

Thanks for your report. Can you please provide more information about your flow? 1 - The size of your JSON object (number of fields approximately) 2 - Which languages are you translating your JSON object to? (number of languages) 3 - Are you using CLI or functions?

β€” Reply to this email directly, view it on GitHub https://github.com/ParvinEyvazov/json-translator/issues/1#issuecomment-1046558208, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBNC5ZWTV4YV34ANDFBCEDU4HTYNANCNFSM5O5NNAFQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.

Aido21 avatar Feb 21 '22 07:02 Aido21

Thank you. Can you please try the v0.7.0 version? (will be available after 10 hours) I will also mention here when the new release comes.

ParvinEyvazov avatar Feb 21 '22 07:02 ParvinEyvazov

Sure ))

On 21 Feb 2022, at 15:52, Parvin Eyvazov @.***> wrote:

Thank you. Can you please try the v0.7.0 version? (will be available after 10 hours) I will also mention here when the new release comes.

β€” Reply to this email directly, view it on GitHub https://github.com/ParvinEyvazov/json-translator/issues/1#issuecomment-1046566472, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBNC5ZL2XGG627WC3A46VLU4HVKFANCNFSM5O5NNAFQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.

Aido21 avatar Feb 21 '22 07:02 Aido21

v0.7.0 is available now. Can you please try the same flow?

ParvinEyvazov avatar Feb 21 '22 19:02 ParvinEyvazov

It has been still working for 2 hours already it it ok for that file?

On 22 Feb 2022, at 03:57, Parvin Eyvazov @.***> wrote:

v0.7.0 is available now. Can you please try the same flow?

β€” Reply to this email directly, view it on GitHub https://github.com/ParvinEyvazov/json-translator/issues/1#issuecomment-1047187922, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBNC562L3WMJBQMTHHHOJDU4KKMHANCNFSM5O5NNAFQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.

Aido21 avatar Feb 22 '22 07:02 Aido21

Actually, it is normal for that big file. I translated 700 lines JSON file before, and it took 10 minutes. If there is no error, it will respond.

This package works in async format to make operations fast. That means if there are 5 fields in the object it tries to translate them at the same time. And when sending more than 1000+ requests at the same time to the Google Translate API, response times get longer (Google Translate API makes this latency.). At that time problem occurs on big files. Unfortunately, I can't solve it right now (I don't have much time nowadays) but there can be a way to solve it manually. You can do like this:

Please divide your JSON file into 3 or more pieces, translate them separately and merge it. For example: You have 1000 lines JSON file (a.json): Create valid JSON files:

a1.json (from a.json, take 0 to 250 lines)
a2.json (from a.json, take 251 to 500 lines)
a3.json (from a.json, take 501 to 750 lines)
a4.json (from a.json, take 751 to 1000 lines)

And translate them separately. (Don't forget to change the name of the file which will be created each time. Because the new English file name will always be en.json).

Sorry for the problem. I am adding this problem to the roadmap to solve it when I am available.

ParvinEyvazov avatar Feb 22 '22 08:02 ParvinEyvazov

Thanks

you don't have to say sorry. )) Everything is ok and thanks a lot for your work.

On 22 Feb 2022, at 16:10, Parvin Eyvazov @.***> wrote:

Actually, it is normal for that big file. I translated 700 lines JSON file before, and it took 10 minutes. If there is no error, it will respond.

This package works in async format to make operations fast. That means if there are 5 fields in the object it tries to translate them at the same time. And when sending more than 1000+ requests at the same time to the Google Translate API, response times get longer (Google Translate API makes this latency.). At that time problem occurs on big files. Unfortunately, I can't solve it right now (I don't have much time nowadays) but there can be a way to solve it manually. You can do like this:

Please divide your JSON file into 3 or more pieces, translate them separately and merge it. For example: You have 1000 lines JSON file (a.json): Create valid JSON files:

a1.json (from a.json, take 0 to 250 lines) a2.json (from a.json, take 251 to 500 lines) a3.json (from a.json, take 501 to 750 lines) a4.json (from a.json, take 751 to 1000 lines) And translate them separately. (Don't forget to change the name of the file which will be created each time. Because the new English file name will always be en.json).

Sorry for the problem. I am adding this problem to the roadmap to solve it when I am available.

β€” Reply to this email directly, view it on GitHub https://github.com/ParvinEyvazov/json-translator/issues/1#issuecomment-1047527733, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBNC523XDQLFNZIM6VHL3LU4NAIZANCNFSM5O5NNAFQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.

Aido21 avatar Feb 22 '22 08:02 Aido21

just one idea - if you would show the number of lines that is translated already the user can be sure that the process is working and not stuck

On 22 Feb 2022, at 16:10, Parvin Eyvazov @.***> wrote:

Actually, it is normal for that big file. I translated 700 lines JSON file before, and it took 10 minutes. If there is no error, it will respond.

This package works in async format to make operations fast. That means if there are 5 fields in the object it tries to translate them at the same time. And when sending more than 1000+ requests at the same time to the Google Translate API, response times get longer (Google Translate API makes this latency.). At that time problem occurs on big files. Unfortunately, I can't solve it right now (I don't have much time nowadays) but there can be a way to solve it manually. You can do like this:

Please divide your JSON file into 3 or more pieces, translate them separately and merge it. For example: You have 1000 lines JSON file (a.json): Create valid JSON files:

a1.json (from a.json, take 0 to 250 lines) a2.json (from a.json, take 251 to 500 lines) a3.json (from a.json, take 501 to 750 lines) a4.json (from a.json, take 751 to 1000 lines) And translate them separately. (Don't forget to change the name of the file which will be created each time. Because the new English file name will always be en.json).

Sorry for the problem. I am adding this problem to the roadmap to solve it when I am available.

β€” Reply to this email directly, view it on GitHub https://github.com/ParvinEyvazov/json-translator/issues/1#issuecomment-1047527733, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBNC523XDQLFNZIM6VHL3LU4NAIZANCNFSM5O5NNAFQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.

Aido21 avatar Feb 22 '22 08:02 Aido21

Great idea. Thank you for the feedback :)

ParvinEyvazov avatar Feb 22 '22 08:02 ParvinEyvazov

Hi @Aido21 , json-translater now will show the number of lines that are translated already with the 0.8.0 version. Now, it is available to use.

Thank you for your great feedback.

ParvinEyvazov avatar Apr 15 '22 00:04 ParvinEyvazov

Thanks. I just checked it up It works pretty fast much faster that i expected but it stuck in line 1650 of my file. And does not translate more So i see Translating. Please wait. 1650 of 1724 translated and no progress more

These lines are 1650: "sections_have_been_sorted": "Sections have been sorted”, 1651: "currently_the_scorm_course_addon_is_deactivate": "Currently the scorm course addon is deactivate", Cannot understand what is the problem

On 15 Apr 2022, at 08.32, Parvin Eyvazov @.***> wrote:

Hi @Aido21 https://github.com/Aido21 , json-translater now will show the number of lines that are translated already with the 0.8.0 version. Now, it is available to use.

Thank you for your great feedback.

β€” Reply to this email directly, view it on GitHub https://github.com/ParvinEyvazov/json-translator/issues/1#issuecomment-1099741454, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBNC55LUUFRS2EEODXCK4TVFC2I3ANCNFSM5O5NNAFQ. You are receiving this because you were mentioned.

Aido21 avatar May 03 '22 07:05 Aido21

It was after first execution

Now it does not work i just get the different errors about the connection

like this

Translating. Please wait. 1267 of 1724 translated.(node:35328) UnhandledPromiseRejectionWarning: RequestError: socket hang up at ClientRequest. (/Users/Eugene/node_modules/got/source/request-as-event-emitter.js:178:14) at Object.onceWrapper (events.js:520:26) at ClientRequest.emit (events.js:412:35) at ClientRequest.origin.emit @.***/http-timer/source/index.js:37:11) at TLSSocket.socketOnEnd (_http_client.js:499:9) at TLSSocket.emit (events.js:412:35) at endReadableNT (internal/streams/readable.js:1334:12) at processTicksAndRejections (internal/process/task_queues.js:82:21) (Use node --trace-warnings ... to show where the warning was created) (node:35328) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:35328) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. Β° Translating. Please wait. 1530 of 1724 translated.

It looks like the number of lines is limited

On 15 Apr 2022, at 08.32, Parvin Eyvazov @.***> wrote:

Hi @Aido21 https://github.com/Aido21 , json-translater now will show the number of lines that are translated already with the 0.8.0 version. Now, it is available to use.

Thank you for your great feedback.

β€” Reply to this email directly, view it on GitHub https://github.com/ParvinEyvazov/json-translator/issues/1#issuecomment-1099741454, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBNC55LUUFRS2EEODXCK4TVFC2I3ANCNFSM5O5NNAFQ. You are receiving this because you were mentioned.

Aido21 avatar May 03 '22 08:05 Aido21

The number of lines can be limited by Google Translate API (because of concurrent requests from the same IP address). I will try to find a way to handle these errors. Thank you for the report.

For the current situation, you can try to split your file into 3 different files and translate them one by one and can combine them all until I fix this problem.

ParvinEyvazov avatar May 03 '22 08:05 ParvinEyvazov

Fixed #2 with version 1.0.0

Solution is here

ParvinEyvazov avatar Sep 04 '22 14:09 ParvinEyvazov