Localizing hints for date and time fields

You can localize hints for date, time, and date-time fields in PolicyCenter screens so they can change based on the language currently in use in the application. Hints display as temporary text in the field and as a tooltip. The hint disappears when the user starts to enter data.

You use Guidewire Studio to localize regional format patterns for date-time field display and input in localization_localeCode.xml files. In these files, you can specify values for date and time formats in the <GWLocale> element by defining settings for <DateFormat> and <TimeFormat>.

PolicyCenter can display a hint for a date-time field based on the format values it finds in the current region’s localization_localeCode.xml file. You can additionally localize date and time hints by language, enabling the hints to display letters that reflect the current language selection. You do this localization in language_languageCode.xml files.

You define and manage language characteristics in language_languageCode.xml files. You can define a language_languageCode.xml file for each language you want to support, such as language_en_US.xml. You access the localization files in Studio by navigating in the Project window to configuration > config > Localizations.

Note: Because you cannot define hints for Japanese characters—katakana and hiragana—the Japanese Imperial Calendar does not support configuring date-time hints.

Each language_languageCode.xml file contains a <GWLanguage> element. This element supports the following elements that you can use to configure and localize date-time field hints:

  • <FormatPatternLocalization> – The XML subelement of <GWLanguage> for this localization.
  • useExampleDate – An optional boolean attribute of <FormatPatternLocalization> that specifies whether the hint for a date-time field is to use a sample date-time element, with numbers, or a format pattern. By default, this attribute is false, and the hint for a date-time field uses a date-time pattern format, such as MM/dd/yyyy hh:mm:ss. If useExampleDate is true, the date-time field hint uses numbers instead of the pattern format. In either case, the hint uses the <DateFormat> and <TimeFormat> pattern definitions if they are defined in the region’s localization_localeCode.xml file.

    For example, the following line of XML code defines useExampleDate attribute to be true:

    <FormatPatternLocalization useExampleDate="true"/>
  • <PatternSymbolLocalization> – A subelement of <FormatPatternLocalization> that maps the letters used for the Java date-time format pattern from the Java values to the localized value.
    • java – The value of the Java string to be localized.
    • localized – The localized value of the Java string. Because this value is a string, it is possible to define a localized value for a Java pattern letter that is more than one letter.

    For example, the following code maps the Java d format pattern letter (the day part of a date) to French j (for jour):

    <FormatPatternLocalization>
      <PatternSymbolLocalization java="d" localized="j"/>
    </FormatPatternLocalization>

See also