Localized properties for multiple languages
InsuranceSuite apps can be configured to store localized values for multiple languages. PolicyCenter stores localized values in separate database tables.
You can work with localized values through Cloud API by marking the corresponding schema properties as localized. You can retrieve all or some language values for localized properties, and you can set localized values in POSTs and PATCHes.
For example, consider that an instance of PolicyCenter is configured to use both US English
(en_US) and France French (fr_FR). The name property of a role is
localized for both languages. You can make requests and responses that contain localized
values for name:
{
"data": {
"attributes": {
...
"name": "Privileged Administrator",
"name_Localizations": {
"en_US": "Privileged Administrator"
"fr_FR": "Administrateur privilégié"
...
}
}
}
}
Enabling localized properties
The schema property x-gw-enableLocalizedProperties must be
true to work with localized properties.
This is a top-level schema property that is set to true by default in
the
configuration/config/integration/schemas/gw/core/pl/framework/v1/framework_pl-1.0.schema.json
file. All Cloud API schemas in PolicyCenter inherit this schema directly or through another
schema, so the feature is enabled by default for all Cloud APIs.
Note: Guidewire recommends that you not set
x-gw-enableLocalizedProperties to false in Cloud
API schema extension files. However, it can be set to false if you
write an entirely new schema.
Configuring localized properties
- In the entity file, the column for the localizable value must have the
<localization/>attribute - The property in the schema must have
x-gw-localizedset totrue - The property in the schema must have
x-gw-localizedset totrue - The property in the schema must be a
stringand cannot have the$refattribute
assessmentsum_name_l10n
database table. Therefore, the entity’s .eti file has a column that looks like
this:<entity
...
<column
desc="Name of the specific assessment service, model, or solution that generated this assessment summary"
name="Name"
nullok="true"
type="shorttext">
<localization
tableName="assessmentsum_name_l10n"/>
</column>
...
</entity>name property must also be marked as localized in the
schema:...
"AssessmentSummary: {
"properties": {
"name": {
"title": "Name",
"type": "string",
"x-gw-localized": true,
"x-gw-extensions": {
"securityLevel": "public"
}
...Note that for this feature to work as expected, mappers and updaters must be properly
configured. Specifically, the path attribute for the mapper and updater
files for the property must be set to the entity property that corresponds to the
database column (for example, AssessmentSummary.Name).
As a result of these configurations, you can now send GET, POST, and PATCH requests with
the localized fields. Use the includeLocalizations query parameter to
view localized values in responses. See the Cloud API Consumer Guide for more.
How localized properties are processed
- Schemas - When JSON schemas are loaded, properties marked with
x-gw-localizedgenerate schema properties for localized values with_Localizationsappended to the original property name.securityLevelanddefaultViewsattributes are copied over from the original property. A newLocalizedValuesschema is generated to hold all localized values. For nullable values, the generated schema isLocalizedValuesNullable. - Mappers - For each localized property, a corresponding mapping property
is generated to map localized values into the JSON response. The localized
properties inherit the
predicateattribute from the original property. - Updaters - Updater properties for localized values are generated to
update localized values. These properties use the
LocalizedValuesschema and follow the same path as the original property. The following updater attributes are copied from the original updater’s localized property to all updater localization properties:allowedignoredeferUpdateafterGraphPropertyhandlerNamepreUpdateValidatorspostUpdateValidatorshandlerConfig
Permissions to access localized values are the same as permissions to access original
values. These permissions are configured in <role name>_role.yaml
files. Localized properties do not have to be explicitly listed in these files, because
localized values are automatically treated the same as values in the original
language.