flutter_translation_sheet
flutter_translation_sheet copied to clipboard
Auto remove unused keys
The is a feature request. It would be nice if flutter_translation_sheet used translations_cleaner (or similar) under the hood and exposed an fts command to clean unused keys from arb and strings files.
As the project grows we end up with unused keys which are hard to keep track of.
@fotiDim are you still struggling with this? or you managed to get some workaround script for the cleanup?
@roipeker nope. I have been manually cleaning up for the time being.
So for clarification, the idea is that all unused keys on the master yaml file, generated Maps, Strings keys, or arb should be deleted?
Sounds a little bit tedious to inspect all /lib for code usage.
I would delete the yaml records maybe, and clean the worksheet for a fresh sync and file generation but would lose any manual translations... I guess is a tricky and interesting feature
Yes, basically what translations_cleaner does plus cleaning the .strings file. Since the .strings file is the single source of truth, I guess deleting unused keys only there is enough. Isn't it already the case that removing a key from the .strings file that it also removes it from the spreadsheet and the generated .arb files?
In any case, I wouldn't want to lose manual translations. I would prefer to stick with unused strings in that case since it's the lesser of those 2 evils.
Found this starter code in case it helps.
Yep, i get the idea, in our case is detection phase, like the code u shared, and adjust the master strings yaml and make the "queries" to remove the potential records on gsheets and the last part is the most complicated i think? As there is no query concept and we have to get all the spreadhseet rows, compare and cleanup, and reupload. After all that, regenerate all the arb/Map/Strings files.
The thing is translation_cleaner focus on arb files which is irrelevant for fts, all those files are ephemeral to the cli tool and are regenerated from scratch on every fts run. So the feature request requires a full implementation on fts