Translation Management

Keys (Strings)

Content is machine translated from English by Phrase Language AI.

Keys are used to identify translatable text strings within software code. This allows the use of a key (as a code name for a translatable string) to be referenced only once by Phrase instead of for each required translation of the string.

A key can have multiple translations associated with it, each corresponding to a different language locale of the project. The function is similar to that of the primary key in relational databases with the translations being an attribute of the key. Keys are stored in resource files and are used to identify source and target languages.

The use of keys allows localization management platforms to present translatable text to translators without having to present code.

Keys do not normally need to be added to a project as they are ideally created when a resource file is uploaded through the Languages tab of a project page.

To prevent keys from being picked up by the editor, use the blocking key functionality. To display keys in the editor but prevent them from being translated, use the exclude keys functionality.

Keys in a project can be duplicated by selecting More/Duplicate key in the Keys section of a project page or at the top of the Strings editor pane.

Different translation keys with the same values across one or multiple projects can be linked to automate content updates. Linked keys are used to ensure consistency across projects and eliminate repetitive work on identical content.

Changes to keys can be reverted from the sidebar activity window in the Strings editor.

Note

When working with repositories (GitHub, GitLab, etc.) and deleting keys, the keys must be deleted from both Phrase and the repository to be permanently deleted. This is to prevent the accidental deletion of keys due to errors or accidents in either Phrase or the repository.

Key Naming

Keys names must be unique within one project.

There are a multiple strategies for naming keys:

  • Descriptive

    The original text is identified by function. This may make it harder to identify the text when reading code, but will remain a constant.

    Example:

    Key

    German

    English

    fem_char

    die Frau

    woman

    male_char

    der Mann

    man

  • Source strings (not recommended)

    The original text itself is used as the key which making it easy to identify the use of the text. This is problematic as if the original text changes, it breaks the relationship with the translations.

    Example:

    Key

    German

    French

    Dog

    Hund

    Chien

    Cat

    Katze

    Chat

Creating Keys

If keys are not uploaded, they can be created manually.

To create a key, follow these steps:

  1. From the Keys tab, click Add key.

    The Add key window opens.

  2. From the General tab, provide a Name, Description , any available Tags and a Default translation.

  3. Enable plural forms from the Plural forms tab if required.

  4. Select excluded languages from the Excluded tab if required.

  5. Provide technical details in the Advanced tab if required.

    For example, it is possible to set a character limit for translations in the Max. Characters field. If set, the character limit is displayed by an indicator in the Strings editor when editing the translations of the relevant key.

  6. Click Save.

    The key is added to the project and can be viewed on the Keys tab.

Deleting a key from the editor or the Keys tab will delete all associated translations of that key and cannot be reversed.

In projects with more than 10,000 keys, unmentioned keys will not be calculated in further uploads.

Blocked Keys

Blocking prevents whole keys from being added to a project; if the name of a blocked key appears in an uploaded file, that key is omitted and not added to the project.

Blocking is used to omit keys from a project so they are not managed at all.

Typically blocked keys:

  • Date and time format strings.

  • Keys including configurations.

  • Keys causing issues when managed with the Phrase gem.

Manage blocked keys in a separate language file that is not processed or maintained.

Problematic keys

These keys can cause problems and if used should be blocked when a project is created.

  • activemodel.errors*

  • number.format*

  • number.currency*

  • number.percentage*

  • datetime.prompts*

Blocking a Key

To block a key, follow these steps:

  1. From a project page, select the Blocked keys tab.

  2. Click Add key to the blocked keys list.

    The Add key to the blocked keys list window opens.

  3. Provide a name for the key or a regular expression (regexp) and click Save.

    The key is added to the list.

    Tip

    AI chatbots can be very effective at generating and verifying regexp.

    Use tools like Regex101 to test regexp with different inputs.

Keys can be later modified by clicking Phrase_Gear.png or deleted Phrase_Bin.png.

Exclusions

Some keys may need to be excluded from certain languages and can be marked as being excluded. These keys are uploaded and exist within a project, but are ignored.

Excluded translations are:

  • Excluded from export of the related language.

  • Excluded from the related language reports.

    If the content is empty it is not counted as untranslated.

  • Visible but not editable in the translation editor.

Exclusion options:

  • 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.

Excluding keys

To exclude a key, follow these steps:

  1. From the keys page, click Phrase_Gear.png for the key requiring exclusion.

    The Edit key window opens.

  2. Select the Excluded tab.

  3. Select languages for exclusion.

  4. Click Save.

    The selection is excluded in the specified key.

Keys can also be excluded from within the editor by selecting the key and using the Update status menu.

Was this article helpful?

Sorry about that! In what way was it not helpful?

The article didn’t address my problem.
I couldn’t understand the article.
The feature doesn’t do what I need.
Other reason.

Note that feedback is provided anonymously so we aren't able to reply to questions.
If you'd like to ask a question, submit a request to our Support team.
Thank you for your feedback.