lokalise / i18n-ally

🌍 All in one i18n extension for VS Code
https://marketplace.visualstudio.com/items?itemName=lokalise.i18n-ally
MIT License
3.92k stars 312 forks source link

All translations got deleted time to time when adding new translations from GUI #943

Open pzgz opened 1 year ago

pzgz commented 1 year ago

Describe the bug I am haunged by this issue for a long time, it's not happened all the time, but sometime very oftern. It used to be ok for a while, but it just came back recently.

The issue is, when I added or update a translation from GUI, after completed the editing, all translations in the language files were removed and only the new edited translation was there. I cannot reproduce it at all because there's no pattern at all. This is really annoy, anyone have similiar issue?

I have disabed the feature which auto sort keys, but still no luck.

Extension Version i18n Ally v2.9.1

Framework/i18n package you are using vue-i18n

To Reproduce Steps to reproduce the behavior: Sorry, but I really cannot reproduce it, I tried for a long time, but cannot find a pattern.

Device Infomation

Extension Log Go to View -> Output -> i18n Ally, and paste the content below. You should mask any sensitive information

🈶 Activated, v2.9.1

――――――

💼 Workspace root changed to "/foo/bar"
📦 Packages file "package.json" found
🕳 Packages file "pubspec.yaml" not exists
🕳 Packages file "composer.json" not exists
🕳 Packages file "Gemfile" not exists
🌞 Enabled
🧩 Enabled frameworks: Vue, General
🧬 Enabled parsers: json

📈 Telemetry id: ea987e9b-2c78-4c41-8c68-2dd6fb786415
🚀 Initializing loader "/foo/bar"
📂 Directory structure: dir
🗃 Custom Path Matcher: {locale}.json
🗃 Path Matcher Regex: /^(?<locale>[\w-_]+)\.json$/

📂 Loading locales under /foo/bar/src/locale
  📑 Loading (en-US) en-US.json [1686036749298.7197]
  📑 Loading (zh-CN) zh-CN.json [1686036736088.62]

👀 Watching change on /foo/bar/src/locale
✅ Loading finished

――――――

🐛 ERROR: Error: connect ECONNREFUSED 127.0.0.1:7890
Error: connect ECONNREFUSED 127.0.0.1:7890
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1247:16)
[object Object]
🔄 File changed (change) zh-CN.json
  📑 Loading (zh-CN) zh-CN.json [1686507053825.7969]
✅ Loading finished

🔄 File changed (change) zh-CN.json
  📑 Loading (zh-CN) zh-CN.json [1686507057736.4841]
✅ Loading finished

🔄 File changed (change) zh-CN.json
  📑 Loading (zh-CN) zh-CN.json [1686507347311.0996]
✅ Loading finished

🔄 File changed (change) zh-CN.json
  📑 Loading (zh-CN) zh-CN.json [1686507440347.284]
✅ Loading finished

💾 Writing /foo/bar/src/locale/zh-CN.json
💾 Writing /foo/bar/src/locale/zh-CN.json
✅ Loading finished

✅ Loading finished

🔄 File changed (change) zh-CN.json
  📑 Loading (zh-CN) zh-CN.json [1686552678213.3276]
✅ Loading finished

💾 Writing /foo/bar/src/locale/en-US.json
✅ Loading finished

🔄 File changed (change) en-US.json
  📑 Loading (en-US) en-US.json [1686552698687.069]
✅ Loading finished

💾 Writing /foo/bar/src/locale/zh-CN.json
💾 Writing /foo/bar/src/locale/zh-CN.json
✅ Loading finished

✅ Loading finished

🔄 File changed (change) zh-CN.json
  📑 Loading (zh-CN) zh-CN.json [1686552735745.0073]
✅ Loading finished

💾 Writing /foo/bar/src/locale/en-US.json
✅ Loading finished

🔄 File changed (change) en-US.json
  📑 Loading (en-US) en-US.json [1686552746203.834]
✅ Loading finished
bnanchen commented 1 year ago

I've observed similar behavior recently. Is the extension still under development?

BlueBazze commented 1 year ago

We have had the similar issue recently. When adding new keys from code, open editor and add the translation text, it overrides the entire json file and inserts the new key.

smomapz commented 1 year ago

Same thing happened to me during a huge translation change work session. I could only restore the translations from repository but all uncommitted changes from that day were lost.

george-kuanli-peng commented 12 months ago

This problem happend 2 times this morning. Now I have to check the translation files EACH TIME after I edit a new translation.

I'm using the latest v2.12.0, but this problem also happened before in my previous installtion.

ianmartorell commented 11 months ago

We've had this issue in our team from time to time since we started using i18n-ally. It seems like it happens randomly one out of 20 times or so, deleting the entire file and losing all the uncommited translations in the process 🫠

s749312025 commented 10 months ago

We've had this issue in our team when adding new translations from GUI

pzgz commented 9 months ago

Still happening till today, bumped up, any clues at least?

BlueBazze commented 9 months ago

I have noticed that adding new nested keys from code and hovering over the key to edit it. This error occurs.

So when adding for instance "common.create", if the common object does not exist already, the entire file will be overridden.

Not sure if it happens every time, but enough for me to notice this specifically.

Unfortunately it is not severe enough to justify a PR

fxxkscript commented 5 months ago

also found this problem

leonardlin commented 4 months ago

I had this issue too, several times.

I also couldn't find a reproduction pattern.

leonardlin commented 4 months ago

I found a few workarounds, not sure if it's really solving the issue, but perhaps it helps.

I'm using one json file per language /locale/en.json /locale/de/json ...

Based on a new project:

Some theories:

What works for me now:

pzgz commented 4 months ago

@leonardlin one thing you mentioned I can confirm from my side

Never USE this Editor

Yes, that's the workaround for me to work with this project now, I stopped using the editor, and only using the popup vscode pallete for entering translations for each language one by one, though it's troublesome, but never met the translations clearout issue again

maxijonson commented 3 months ago

Just ran into this issue. Can't reproduce it but it does seem to be while using the editor the above comment talks about. About 90% of the time it works just fine, but I have to keep an eye on the files in case it randomly doesn't work and deletes the entire file (except for the trad I just added).

Hypothesis

Again, I can't reproduce it 100%, but I have noticed it never happens when I'm doing my steps perfectly, without a misclick or something like that. I have an Excel sheet with the trads in the browser and VS Code opened:

  1. Copy the trad in the browser
  2. Click in the corresponding field
  3. Paste
  4. Repeat

Sometimes, I'll misclick into an already filled field (above the one I actually wanted to click into) and hit paste before I realize my mistake:

Workaround

If you're like me and not using the editor would simply be a huge burden on your workflow, I suggest you keep a tab open on each of your language files. Not only will this make it pretty obvious when a file gets deleted, but you can then just CTRL+Z to quickly recover before noticing too late. It does get pretty crowded though, especially if you're working on 7 languages like me. Highly recommend you do this on a 4k monitor or zoom out a bit 😅