Display keys best practices
A display key represents a single piece of user-viewable text. A display key comprises:
- A name to use in PCF files and Gosu code, where you want to display textual information
- A text value to display in place of the name, for each locale installed in your PolicyCenter instance
As a best practice, Guidewire recommends that you edit your display key definitions by using the Display Keys editor in Guidewire Studio.
See also
Use display keys to display text
Define display keys for any text that you display
to users through the PolicyCenter
user interface or in log messages. Do not use hard-coded String literals. Display keys
help you localize your configuration of PolicyCenter with translations for
specific languages.
Use existing display keys whenever possible
Before you create a new display key, search the existing display keys to find one with the text that you want. In Guidewire Studio, open the display_localeCode.properties file for the language you are using. Then, type the word or phrase you want. The Display Keys editor navigates to and highlights display keys that contain the text or phrase in their names or values.
Observe display key naming conventions
Generally, display key names begin with a capital letter. Internal capitalization separates words in compound display key names. For example:
ContactDetailPolicyCenter represents display keys in a hierarchical name space. A period (.) separates display key names in the paths of the display key hierarchy. For example:
Validation.Contact.ContactDetailGenerally, you specify text
values for display key names that are leaves on the display keys resource
tree. Generally, you do not specify text values for display key names
that are parts of the path to a leaf display key. In the preceding example,
the display keys Validation
and Validation.Contact
have no text values, because they are parts of a display key path. The
display key ContactDetail
has a text value, “Contact Detail”, because it is a leaf display
key with no child display keys beyond it.
Add a suffix to new display keys to avoid name conflicts
To avoid future naming conflicts when Guidewire
adds or changes base display keys, append the suffix _Ext to your new display key names.
For example, your PolicyCenter instance has a branch of the display key hierarchy for text that relates to contact validation.
Validation.Contact.ContactDetail
Validation.Contact.NewContact
You want to add a display key for the text “Delete
Contact”. Add a new display key named DeleteContact_Ext.
Validation.Contact.ContactDetail
Validation.Contact.DeleteContact_Ext
Validation.Contact.NewContact
You can change the text for base display keys to change
the text that the base configuration of the application displays. Guidewire
recommends that you use the base configuration display keys for this
purpose so the base configuration PCF files can just make use of the
new values. If you add display keys with the suffix _Ext with the intention of using
them in the base configuration, the base configuration PCF files must
be altered to use them.
Organize display keys by page configuration component
Guidewire recommends that you organize display keys under paths specific to the page configuration component types and PCF file names where the text values of display keys appears. For example,
LV.Activity.Activities.DueDate