Adding translations to custom fields
If you need a localized field label, field tooltip, or error message reflecting the language preference of the logged in user, the field label, tooltip, and—optionally—error message need to reference a resource file. For custom translations, there's a resource file called customerResources.csv for each of the configured languages. The resource file holds a key value pair for each translated string. Standard fields are by default translated using an SAP-managed resources.csv file.
Depending on the language of the logged in user, the solution retrieves the key from the field reference and finds the entry in the corresponding file (resources.csv or customerResources.csv).
If you want to add a translation to a custom field, or if you want to change a standard field, you simply have to add a reference to the key in the field definition using @customerResources/<key>.
To achieve this, follow these steps:
- Log into the Test environment as a user with "Advanced Configuration Access" rights.
- Choose Manage → Administration → Customization Manager → Field Configuration.
- In the Browse Classes box, search for and select the class that contains the field definition.
- Locate the field on the right and click Edit.
- Update the Label (or Tooltip) field, and add the text @customerResources/<key> to reference the key entry in the customerResources.csv file. For example, @customerResources/ContractLocationLabel and @customerResources/ContractLocationTooltip.
- Click Update to save the changes.
- Publish the changes by clicking the Customize link (near the top right of the page) and then select Publish.
A simple way to retrieve custom resource references is simply to export and download the configuration JSON file. This file contains the resource keys for every customized field.
Note
The same resource or customerResource entry can be used by many field labels or tooltips, and standard out-of-the-box labels and tooltips can also be used for custom fields.