Removing keys and locales

Cleaning up a Localhero.ai project happens at three levels. Keys you delete in a pull request are removed for you if you use the GitHub Action, and push --force --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.

Reset is the only one of the three that cannot be walked back.

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 those keys come out of the dashboard while the PR is still open. Close the PR without merging and they come back, so an abandoned branch does not take your keys with it.

The diff needs the base branch present in the checkout, which is what fetch-depth: 0 in the generated workflow is for. And only source files are compared: deleting a key from a target locale file alone changes nothing.

Outside that flow, deletions are a manual step. push adds and updates, it never deletes. Add --prune to also delete keys from the backend that no longer exist in your local files:

npx @localheroai/cli push --force --prune

--prune only considers keys in the source files that are part of the current push. Without --force, push filters files by git changes against the base branch, so --prune on its own misses stale keys living in files you did not touch. Pairing the two flags is 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.

--force means two different things

On push, --force means "push all files regardless of git changes". It does not overwrite anything harder.

On clone, -f/--force means overwrite existing local files on disk. Same flag name, different consequence.

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 delete-locale operation in the CLI.

To take the language off the project, open project settings in the dashboard and click the on the language row. That removes it from the project's language list. Its stored translations are not deleted.

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, unlike pruning. There is no CLI equivalent. 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

Redo att testa?

Kom igång på några minuter. Inget kreditkort behövs.