Cleaning up Native resources

Pushing strings in a Native resource may grow the amount of phrases over time, thus creating the need for clean-up. In other words, delete phrases that are no longer relevant in the code base.

Cleaning up Native with a single code repository is easy. You can use the --purge option of the CLI to keep the resource fresh and up-to-date. For example, in a Javascript project you may use the command:

$ npx txjs-cli push src/ --purge

and phrases that no longer appear in the code will be deleted in the Native resource.

The challenge though arises when you are using the same Native resource for multiple projects. Using the purge option is no longer recommended because purging the content from one project will delete the phrases of the other projects.

To overcome this use case, you may use the tags feature. We will use the tag main to mark active content, and remove the rest. Here is how.

Step1: Remove tag main from all strings in the editor

In the Transifex editor:

  1. Select [Edit source]
  2. Add the filter tags:main in the search input
  3. Mass select all strings
  4. Add main in the Edit tags for selected strings input
  5. Click Delete tags
2444

Step2: Push content and tag it as main

For each code project using the same Native resource, push again using the CLI by also appending the tag main. For example, in a Javascript project you may do:

[Project-A]$ npx txjs-cli push src/ --append-tags=main
[Project-B]$ npx txjs-cli push src/ --append-tags=main
[Project-C]$ npx txjs-cli push src/ --append-tags=main

This will tag all active content with tag main.

Step3: Delete non main content

In the Transifex Editor:

  1. Select [Edit source]
  2. Add the filter tags_not_contains:main in the search input
  3. Mass select all strings
  4. Click Delete source strings
2438

Step4: Remove the tag main from all strings in the editor

Optionally, follow Step1 and cleanup the main tag from editor, to keep your content clean for the next time.