Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output keys and values removed with locize sync #98

Closed
staaky opened this issue Nov 11, 2024 · 6 comments
Closed

Output keys and values removed with locize sync #98

staaky opened this issue Nov 11, 2024 · 6 comments

Comments

@staaky
Copy link

staaky commented Nov 11, 2024

🚀 Feature Proposal

It would be useful to have an option to output the keys and values that get removed with locize sync. Perhaps it can even be the default.

Motivation

It gives an easy way to restore keys. I've destroyed translation work that already happened in Locize by mistake several times by messing up a sync. In Locize there doesn't seem to be a history for removed keys. If locize sync outputs both the keys and the values it removes, this would provide a way to recover from the cli.

Example

Instead of this output:

removing 9 keys in es/common...
removing 9 keys in fr/common...

You also get the keys and their values:

removing 9 keys in es/common...
removed "arrival": "Llegada"
removed "departure": "Salida"
...etc
@adrai
Copy link
Collaborator

adrai commented Nov 11, 2024

Have you tried to restore the files like described here? https://docs.locize.com/more/general-questions/where-do-i-find-the-namespace-backups

The CLI also has a dry-run functionality. Just add the --dry true argument, and you will see what would happen, without making any real changes.

Alternatively, you can also copy your local translations before executing the sync command.

Personally, I don't think it is the right approach for adding this functionality to the CLI.

Let me know if my suggestions helps.

@staaky
Copy link
Author

staaky commented Nov 11, 2024

I'll try the namespace backups, thanks!

The dry-run could help avoid it somewhat in the future.

I don't think copying local files beforehand would help, those files are in git and can already be reverted. The problem is with keys in Locize that your system (and git) isn't aware of, but because local timestamps are newer you can still remove those keys with a sync. Unless the CLI informs about what is getting removed, the values are lost. Even the dry-run, in case you used it, only shows the keys that got removed, the values are still lost.

Hopefully the backups will work. I'd argue that since a sync can remove content that you can't be aware of, it would be helpful if the CLI made you aware of it, so backups aren't the only option.

@adrai
Copy link
Collaborator

adrai commented Nov 11, 2024

let me know if this helps...
if not, I'll think about a new argument that backups the keys and values to a dedicated folder...

@staaky
Copy link
Author

staaky commented Nov 11, 2024

The namespace backups are helpful, was able to restore things partially so far. Thanks.

Local backups seem like a good idea. Having a timestamped folder per sync with backups would make things easier next time.

@adrai
Copy link
Collaborator

adrai commented Nov 12, 2024

with v8.2.0 you should now be able to pass a backup path argument: locize sync -B ../bak

@staaky
Copy link
Author

staaky commented Nov 12, 2024

Awesome, works great, thanks!

@staaky staaky closed this as completed Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants