Language and locale
When you send a request to Cloud API, the default behavior is to present data in the response
using the default language and locale specified in PolicyCenter.
These defaults are specified in config.xml
using the following application
configuration parameters:
DefaultApplicationLanguage
DefaultApplicationLocale
For more information on how InsuranceSuite applications support globalization, see the Globalization Guide.
If PolicyCenter supports multiple languages and locales, Cloud API requests can use request headers to specify a language and locale for the response. There are different ways the language and locale of the response can be interpreted:
- The Guidewire-specific
GW-Language
andGW-Locale
headers- This is the recommended method
- The preferred language of an authenticated user
- The standard HTTP
Accept-Language
header
GW headers
Cloud API has two Guidewire-specific headers you can use to specify language and
locale: GW-Language
and GW-Locale
. These headers
give you the ability to explicitly state the desired language and locale for a
call.
To specify a language using Guidewire-specific headers, include the following header with the request:
- Key:
GW-Language
- Value: (an ISO 639-1 code designating the language)
For example, to set the language to Japanese, the request must contain a
GW-Language/ja
header.
To specify a locale using GW headers, include the following header with the request:
- Key:
GW-Locale
- Value: (an ISO 639-1 code followed by an underscore followed by an ISO 3166-1 alpha-2 locale code)
For example, to set the locale to Japanese, the request must contain a
GW-Locale/ja_JP
header.
If you want to specify a language and locale, Guidewire recommends using these headers. They are the most explicit declaration of the intent of the call.
The preferred language of the authenticated caller
If the caller is authenticated and has a preferred language and the call does not
specify a GW-Language
or GW-Locale
header, then
the caller's preferred language is used.
Note that this only applies to calls where the caller is authenticated. It does not
apply to calls where authentication does not occur, such as calls to the
/openapi.json
and /swagger.json
endpoints.
The Accept-Language
header
The Accept-Language
header is a standard HTTP header that specifies
a preferred language (but not a preferred locale). This header is automatically
added by most browsers. However, how it is set depends on the browser. The header
can also be set by non-browser calls.
If the request does not contain either a GW-Language
header or
GW-Locale
header, and the caller is not an authenticated user
with a preferred language, then the Accept-Language
header is
used.
How are the response language and locale determined?
What is specified | What is language set to? | What is locale set to? |
---|---|---|
Both GW-Language and
GW-Locale |
The GW-Language header value. |
The GW-Locale header value. |
Only GW-Language |
The GW-Language header value. |
The caller's preferred locale, if any. Otherwise, the PolicyCenter default locale. |
Only GW-Locale |
The caller's preferred language, if any. Otherwise, the PolicyCenter default language. | The GW-Locale header value. |
Neither GW-Language nor
GW-Locale |
The caller's preferred language, if any. Otherwise, the
Accept-Language header, if any. Otherwise,
the PolicyCenter default
language. |
The caller's preferred locale, if any. Otherwise, the PolicyCenter default locale. |