Removing keys and locales
There are three ways to remove keys from a Localhero.ai project. Keys you delete in a pull request are removed for you if you use the GitHub Action, and npx @localheroai/cli push --prune covers deletions made outside that flow. Removing a language takes it off the project but keeps its translations. Reset clears the project's contents and keeps its settings.
Removing keys you deleted or renamed
If you use the GitHub Action, deletions are handled for you. A pull request that removes keys from a source file is diffed against the base branch, and the removed keys come out of the dashboard. Close the PR without merging and they come back. Merge it and they are gone for good.
Two things to know
The base branch has to be in the checkout for the diff to work. That is what
fetch-depth: 0in the generated GitHub Action workflow is for.Only source files are compared. Deleting a key from a target locale file alone changes nothing.
If you deleted keys locally and want the backend to match, run push with the --prune flag. On its own push only adds and updates, it never deletes. With --prune it also removes keys from the backend that no longer exist in your local files:
npx @localheroai/cli push --force --prune
push sends your localization files in one go, and by default it only includes the ones that differ from your base branch. --prune looks at the files included in that run, so on its own it never sees stale keys in files you did not touch. --force includes every localization file instead, which is why the two flags together give you the full sweep.
Before it deletes anything
The CLI lists the keys it would remove, up to 10 of them followed by "... and N more", and asks for confirmation. The prompt defaults to no, so pressing enter cancels. Read the list: pruning the wrong keys means re-adding them to your source file and translating them again.
What
--forcedoes hereOn
push,--forcemeans "push all files regardless of git changes". It does not overwrite anything harder.
Removing a language
Removing a target locale from localhero.json stops the CLI syncing that language. It deletes nothing on the backend. There is no operation in the CLI for removing a whole language yet.
To take the language off the project, open project settings in the dashboard and click the β on the language row.
Resetting a project
Reset is the only real start over. Go to Project Settings β Danger area β Reset in the dashboard. It requires organization admin.
Reset permanently deletes everything Localhero.ai has stored for the project: translations, translation history, jobs and keys. Your local files are untouched. It preserves project settings such as the name and the configured languages, so you keep the project and lose its contents.
This one is permanent. The same Danger area also holds a full project delete, which removes the project itself.
Further reading: the CLI reference for every command and flag.
Last updated
Ready to try it?
Get setup in a couple of minutes. No credit card required.