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

Return zombies list #61

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

rlunaro
Copy link

@rlunaro rlunaro commented Aug 8, 2023

My improvements:

Now the baseSrc parameter allows entering an array. This way, you could add angular multi-project projects, just by setting all the directories of the different projects:

killTranslateZombies({
  translateFilePath: 'C:\\plastic\\auditmap-pipeline-webhosting\\mapfre-auditlib\\src\\assets\\i18n\\es.json',
  baseSrc: [
    'first-application/src',
    'libraries-project/src' ]
});

Added an alreadyVerified option to avoid the reporting of zombie keys that have been already verified and are correct. This is an attempt to mitigate the problems found with dynamic keys: if you mark certain keys as "verified", those will not be reported as zombies anymore.

killTranslateZombies({
  [...]
  alreadyVerified: [
  	'this.key.is.not.a.zombie',
  	'this.other.key.is.not.a.zombie'
  ]
});

List of zombie keys can be exported, too (see below). This way, when you want just to check your precious translate file and check, line by line, the translations found and remove manually those that are zombies, you can make that too, just asking
the function to write down the list of zombie keys it have found:

killTranslateZombies({
  translateFilePath: 'C:\\plastic\\auditmap-pipeline-webhosting\\mapfre-auditlib\\src\\assets\\i18n\\es.json',
  baseSrc: [
    'first-application/src',
    'libraries-project/src' ],
  exportZombieKeys: 'found-zombie-keys.json', 
  alreadyVerified: [
  	'this.key.is.not.a.zombie',
  	'this.other.key.is.not.a.zombie'
  ]
});

Function walkThroughAllFiles is not that complicated, in my humble opinion. Check out the new version.

Other functions have been changed name: findInFile in fact, does not just "find in a file" the zombie keys, but remove the found keys, so it's changed to removeKeyIfFoundInFile.

Libraries under package.json have been upgraded. I've done my best to preserve functionality of the existing scripts, but
I failed in some cases due to errors in libraries (trash).

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

Successfully merging this pull request may close these issues.

1 participant