Learn how to deal with a large number of keys and technical restrictions in complex translation projects.
Managing keys is one of the most relevant tasks when dealing with localization files and translations. Phrase provides useful tools and mechanisms to deal with a large number of keys and technical restrictions in complex translation projects.
Phrase allows you to block keys. Blocked keys will be ignored when:
- pushing / uploading translations
- pulling / downloading translations
- working within the Phrase In-Context Editor
While blocking prevents whole keys from being managed in Phrase, you also can exclude individual keys from being translated into certain languages. Please refer to the section Excluding translations below.
The blocklist is a powerful tool to handle issues with keys that should be managed manually rather than be editable by everyone. Examples of typically blocked keys are:
- date and time format strings
- keys that include configuration
- keys that cause issues when being managed with the phrase gem
A best practice would be to add those keys to your blocklist and manage them in a separate language file in your application that is not processed or maintained by Phrase.
Because we know that there are some keys that cause issues when used with Phrase (especially in setups with Ruby on Rails), we add several keys to the blocklist when creating a new project, e.g
If you only want to exclude keys from being picked up by the in-context editor but still manage them with Phrase, you should consider the ignored keys setting.
In some cases you might want to exclude keys only in certain languages. For this Phrase allows you to mark certain translations as excluded. A excluded translation will:
- be excluded from export of the related language.
- be excluded from the related language section in the analytics tab (even if the content is empty, it is not counted as untranslated).
- be visible but not editable in the translation editor.
While excluding individual keys prevents them from being translated into certain languages, blocking prevents whole keys from being managed in Phrase. Please refer to the Blocking keys section above.
You have two options to exclude translations for a key:
- exclude a single translation in a language within the translation editor.
- exclude multiple translations in a language within the translation editor.
- exclude multiple translations by selecting the languages when creating or editing the key.
Phrase lets you set the number of characters a translation can contain. The character limit can be set under the “Advanced” tab when editing a key. When a maximum number of characters is defined, the character count will be displayed when editing translations for that key.
The character limit can also be set via upload from certain file formats. The options here are:
- Adding an extra column in a CSV file or Excel spreadsheet
- With XLIFF you can make use of the maxwidth attribute:
<trans-unit id="key_name" maxwidth="20" size-unit="char">
Deleting unused keys
If you have made a lot of changes in your localization file or removed whole features from your application and want to delete keys only attached to these features, you probably want to remove these “orphaned” keys from the list of keys in Phrase as well. You can identify keys that no longer occur in your (main) localization file by uploading the file again to the translation center via the browser.
After uploading the file you should see an indicator of how many keys are no longer mentioned in the main file in the “Keys unmentioned” column. Click on the “Delete unmentioned keys” button to get an overview of the keys that you might want to delete. Click the delete button to remove all of them in one step.
How can I delete all keys from my project?
You can access the Keys section of your project and delete keys from there. You will find an option to delete all keys there (in sets of 1000 keys at once). Alternatively, you can use an API request as well. Please follow the link to our API documentation: Delete a collection of keys
How can I delete a collection of keys based on their tag?
You can select multiple keys and delete your selection. Filter your search after the specific tag and select all those keys. You can now select the delete checkbox. You can also use our API, using the tag as a parameter for the query. Please follow the link to our API documentation: Delete a collection of keys
How can we search for specific keys when reviewing the translations?
To search keys when reviewing translations, you can either use jobs to assign the reviewer only certain keys or you can use the search bar in the translation center, where you can filter your search.