gtd-scripts icon indicating copy to clipboard operation
gtd-scripts copied to clipboard

Added Caching

Open serafdev opened this issue 8 years ago • 11 comments

Here I added Caching to the translation script. First the output files need to remain in the new tmp/ folder that I created (changed the output from /tmp/ to ./tmp/ which is root of project. You need to keep the translated files so we can reuse the translated strings. For example if you modify the base json, it will only translate the newly added keys.

Fixed a bug with Special Characters stopping the script running because of encodeURI, we now use encodeURIComponent to be able to encode special characters.

serafdev avatar Oct 13 '17 18:10 serafdev

Hi,

I just grabbed the changes from your PR and tested locally. It works well. My translation files are big so definitely I needed this to avoid unnecessary calls to the API.

Thank you for your work.

yps1978 avatar Sep 04 '19 20:09 yps1978

@yps1978 Happy to contribute! Have fun coding 😄

Sent with GitHawk

serafdev avatar Sep 05 '19 04:09 serafdev

Ohh I've just seen t his PR, and since it wans't merger to master, I'd to develope this feature for myself.

Also, i added a different way of translating string using package "google-translate-api-browser" which lets you use Google Translet without an API key.

urielgolab avatar Jun 02 '20 15:06 urielgolab

Cool stuff @urielgolab I merged my caching branch to master from my fork

I think this project is dead, we might want someone to take over somehow, maybe create a new repo with the continuation of the code in it? Also we might want to consider bumping the node version

Let me know what you think

serafdev avatar Jun 03 '20 00:06 serafdev

@serafdev Nice to see some activity. I missed this years ago with the original pull request for some reason. Clearly, I haven't updated this recently. I am happy to redirect the repo to one of you, and make that clear in the README. Just let me know.

tewen avatar Jun 03 '20 01:06 tewen

I just found useful and very useful to translate some randomly defined JSON files.

If you can add me as a contributor, I could push my code to let anybody translate without having an API key.

Also, I needed to cached keys persisted on the disk because the free usage of googles Api rejects requests after a few responses.

El mar., 2 jun. 2020 a las 22:00, Trevor Ewen ([email protected]) escribió:

@serafdev https://github.com/serafdev Nice to see some activity. I missed this years ago with the original pull request for some reason. Clearly, I haven't updated this recently. I am happy to redirect the repo to one of you, and make that clear in the README. Just let me know.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tewen/gtd-scripts/pull/4#issuecomment-637892463, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEC2I7CHRFO6DZPGRRRYCDRUWODHANCNFSM4D7DTV3Q .

urielgolab avatar Jun 03 '20 01:06 urielgolab

Will do @urielgolab

tewen avatar Jun 03 '20 01:06 tewen

@tewen hey Trevor, thank you for this code by the way! Are you able to add an open License on the main repo too? We’ll pull that on the inherited repository.

@urielgolab if you are actively working with google translates it would be better if you take care of this, I’ll be happy to continue contributing

serafdev avatar Jun 03 '20 01:06 serafdev

I just made some changes to use this module freely but my changes will drop the multilingual solution as this was designed for.

I would push my code to a new branch so anybody could check that out.

PR has more work ahead...

‪El mar., 2 jun. 2020 a las 22:32, ‫فارس‬‎ ([email protected]) escribió:‬

@tewen https://github.com/tewen hey Trevor, thank you for this code by the way! Are you able to add an open License on the main repo too? We’ll pull that on the inherited repository.

@urielgolab https://github.com/urielgolab if you are actively working with google translates it would be better if you take care of this, I’ll be happy to continue contributing

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tewen/gtd-scripts/pull/4#issuecomment-637900947, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEC2I67TFXRBZQULZTA3ZTRUWR3RANCNFSM4D7DTV3Q .

urielgolab avatar Jun 03 '20 01:06 urielgolab

Great, are you able to merge this one @urielgolab, I use this version of the code, and we should still be able to have both options (free and with api), we should keep that in mind!

Some cases won't work with the free version (chat bots, etc) where throughput can be high

serafdev avatar Jun 03 '20 14:06 serafdev

haha yes, I'm working with chatbots indeed.

I've made some changes to work with and without API key, and also have multilingual support for caching.

Won't do the tests with an API key, but will leave that part untouched.

‪El mié., 3 jun. 2020 a las 11:47, ‫فارس‬‎ ([email protected]) escribió:‬

Great, are you able to merge this one @urielgolab https://github.com/urielgolab, I use this version of the code, and we should still be able to have both options (free and with api), we should keep that in mind!

Some cases won't work with the free version (chat bots, etc) where throughput can be high

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tewen/gtd-scripts/pull/4#issuecomment-638247378, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEC2I6JHKREL6EIZK3MABTRUZPB3ANCNFSM4D7DTV3Q .

urielgolab avatar Jun 03 '20 14:06 urielgolab