Before you get into today's topic, read the previous articles in this series to see what you can achieve with Automated Workflows:

❓ What are deprecated keys? 🔗

Deprecated keys serve to protect you from accidental, irreversible changes. Even if you remove the keys from your local files, they are still available on Localazy and not lost forever - they can still be used as a source for duplicity linking or connected projects, and all the history, comments, contributions, translators, context information, etc. are preserved.

However, they also consume a portion of your source key limit, so removing them entirely is sometimes useful if you are 100% sure they are no longer needed.

🤔 Why delete deprecated keys? 🔗

In some situations, you don't want the keys to be kept as deprecated when you know that you will never need them again - e.g. when you are going through a migration or project reorganization or hitting the limit and reducing their number.

Sometimes, you know that some of the keys are no longer needed, so let's look at a simple solution to delete them completely based on defined criteria.

In this scenario, I'm preparing for a long-time migration of a project available for Android and iOS, and no platform-specific keys should be kept. All keys prefixed with android_ are about to be removed.

I don't really want to deprecate them and later spend time filtering them and removing them from my Localazy project. I want to automate this action. Let's see how to do that simply with Automated Workflows.

⚙️ Setting up the workflow 🔗

1. Create a new workflow 🔗

Navigate to Workflows in the console and select the project you want to automate. Now, create a new empty workflow. You can name it as you wish; I'm choosing Delete android_ keys, so it's descriptive.

article-image

My new workflow is ready, but it's empty and stopped. Let's edit it.

article-image

Be sure to enable the workflow as they are, for security reasons, disabled by default. Also, select the desired action, which is to Delete deprecated keys. This action doesn't need additional settings, but we must also enable it for the desired Trigger Event.

article-image

In the Filter box, we need to tell our workflow to only run for android_ keys, so let's untick the Apply to all events checkbox, which reveals a few new options. The important one for us is the Content Filter, and by clicking Add Filter on the right side, we can add a simple rule for our keys.

article-image

You can read more about filters in our previous article.

Save the workflow and verify that it's enabled and ready to roll, and that's it. All is configured!

article-image

2. Upload content as usual with deprecation enabled 🔗

No matter if you upload your files manually or via CLI, be sure to enable the deprecate feature, which you probably already did since you are reading this article 🙂 , and that's it.

The deprecate feature tells the server to deprecate any key missing in the upload batch. With the value file, only keys missing in touched files are deprecated. With the value project, all keys missing in this upload batch across the whole project are deprecated. With the default value none, nothing is deprecated.

Whenever there are some deprecated keys, the workflow is run and keys that match the filter are automatically deleted. No matter if you spend one day or one month reorganizing your project, you never need to think about cleaning the unused keys.

3. Delete all deprecated keys automatically 🔗

By the way, if you don't want to use deprecated keys at all as you are sure that they are never to be needed again, or if you have any other solution in place (such as a really great backup mechanism that can help you to restore missing information - but please do not forget that it's not about translation only, but also about context information, history, comments, etc.), you can just tick the Apply to all events checkbox and forget about it forever. The workflows will take care of any deprecated keys and delete them automatically for you.

✅ Conclusion 🔗

You can set up a lot of different workflows that can help you in all kinds of situations. Deleting deprecated keys automatically can help you save time and make space for fresh source keys to translate, but don't forget that deprecated keys can be useful, so decide carefully!