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

Cache mixes up different directories

Open fletchgqc opened this issue 9 months ago • 0 comments

I have a similar problem to the OP here https://github.com/leolabs/json-autotranslate/issues/88.

To reproduce, you need two folders which share a cache, e.g. in one project locales/en.json locales/de.json errors/en.json errors/de.json

for each directory, i.e. locales and errors, run: npx json-autotranslate -i "$directory" --directory-structure ngx-translate -m i18next -d -s deepl-free -c "key"

Edit one of the machine translations and rerun. Your edit should be kept, but instead it will be overwritten by the machine translations. To fix the problem, use --cache to set a different cache for each $directory.

Analysis: I see that the files are being correctly created in the cache, prepended with a path. So they shouldn't interefere with one another. But apparently when diffing with the cache, the code makes a mistake and diffs with the wrong cache or something.

fletchgqc avatar May 16 '24 13:05 fletchgqc