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
main
from all strings in the editorIn the Transifex editor:
- Select
[Edit source]
- Add the filter
tags:main
in the search input - Mass select all strings
- Add
main
in theEdit tags for selected strings
input - Click
Delete
tags
Step2: Push content and tag it as main
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
main
contentIn the Transifex Editor:
- Select
[Edit source]
- Add the filter
tags_not_contains:main
in the search input - Mass select all strings
- Click
Delete
source strings
Step4: Remove the tag main
from all strings in the editor
main
from all strings in the editorOptionally, follow Step1 and cleanup the main
tag from editor, to keep your content clean for the next time.
Updated over 2 years ago