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

Feature suggestion: Translating updated strings again

Open petrchutny opened this issue 6 years ago • 7 comments

Hello,

thanks for making this amazing script. It helps us greatly to save so much time translating at Tinkamo. I know this might be a big idea requiring more coding, but what do you think about the functionality of being able to detect whether a source string has changed and translating it again? What do you think about it? :)

petrchutny avatar Oct 30 '19 06:10 petrchutny

Hey @petrchutny,

thanks for your feedback! It's awesome to see this tool being used in real-world products!

I'm guessing that you're using key-based translation, like:

{
    "SOME_TEXT": "This is a string",
    "OTHER_TEXT": "This is another string"
}

To be able to detect changes, json-autotranslate would need to keep a kind of cache folder containing the latest translated version of files and compare them to the current ones.

This feature has already kind of been requested in #5 and I will try to implement a good solution for it this week.

Thinking about it, keeping the last translated version would also allow json-autotranslate to detect which translations have been manually edited and warn the user if they would be overwritten by a command.

leolabs avatar Nov 04 '19 15:11 leolabs

Thanks for your reply :) Yes, we’re using it for key-based translation. That’s great that you’re up for doing it! Your idea with the warnings is also very good.

All the best & thanks,

— Petr Chutný petrchutny.cz On 4 Nov 2019, 23:53 +0800, Leo Bernard [email protected], wrote:

Hey @petrchutny, thanks for your feedback! It's awesome to see this tool being used in real-world products! I'm guessing that you're using key-based translation, like: { "SOME_TEXT": "This is a string", "OTHER_TEXT": "This is another string" } To be able to detect changes, json-autotranslate would need to keep a kind of cache folder containing the latest translated version of files and compare them to the current ones. This feature has already kind of been requested in #5 and I will try to implement a good solution for it this week. Thinking about it, keeping the last translated version would also allow json-autotranslate to detect which translations have been manually edited and warn the user if they would be overwritten by a command. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

petrchutny avatar Nov 07 '19 03:11 petrchutny

I've implemented this in v1.5.0, check it out if you like :)

leolabs avatar Nov 08 '19 22:11 leolabs

So the cache folder should be kept as part of source control? I ignored it as I assumed it was temp folder, make sense now that I read this.

cs-NET avatar Nov 19 '19 20:11 cs-NET

Ah, yes :) Maybe calling it .json-autotranslate-cache was not the best idea. Do you have a better name in mind that would suggest it should be part of source control?

leolabs avatar Nov 20 '19 08:11 leolabs

Hmm .json-autotranslate-history

cs-NET avatar Nov 22 '19 20:11 cs-NET

For attranslate, I called it attranslate-cache instead of .json-autotranslate-cache. Keeping this cache in source control is not strictly required, but highly recommended.

One thing that I am not yet sure about is the number of required caches. For attranslate, once cache per source-file is sufficient. However, in future versions of attranslate, this might be changed to "one cache per source-target combination". In contrast, json-autotranslate keeps once cache for every file, which I am not sure why this was done.

fkirc avatar Nov 01 '20 18:11 fkirc