Localisation

  Last updated: 

 

By specifying the locale parameter during SDK initialisation as described below, you can change the language and formatting of text displayed to better suit the needs of your international customers. Such changes are applied to field names, buttons (e.g. “Pay”) and notification messages displayed to the customer during the checkout process (e.g. Success or Declined).

 

Locale for form elements

All translations are already bundled with the SDK. Appropriate texts on UI elements, which are part of the SDK, will automatically be translated based on the OS system language setting.

locale requires a language and country to be specified, in the format shown below. We support the following values:

locale value Description
cy_GB Welsh, United Kingdom
da_DK Danish, Denmark
de_DE German, Germany
en_US English, United States
en_GB English, United Kingdom
es_ES Spanish, Spain
fr_FR French, France
it_IT Italian, Italy
nl_NL Dutch, The Netherlands
nb_NO Norwegian, Norway
no_NO Norwegian, Norway
sv_SE Swedish, Sweden

 

Locale for gateway response

By also updating the payload within the JWT to include the locale field, you can update your checkout to translate response messages returned by the gateway during the payment session.

locale requires a language and country to be specified, in the format shown below. We support the following values:

locale value Description
cy_GB Welsh, United Kingdom
da_DK Danish, Denmark
de_DE German, Germany
en_US English, United States
en_GB English, United Kingdom
es_ES Spanish, Spain
fr_FR French, France
it_IT Italian, Italy
nl_NL Dutch, The Netherlands
no_NO Norwegian, Norway
sv_SE Swedish, Sweden

 

(Example payload)

{
"iss":"jwt-test",
"iat":16094035377,
"payload":{
"accounttypedescription":"ECOM",
"baseamount":"1050",
"currencyiso3a":"GBP",
"locale":"en_US",
"sitereference":"test_site12345",
"requesttypedescriptions":["THREEDQUERY","AUTH"],
"termurl":"https:\/\/payments.securetrading.net\/process\/payments\/mobilesdklistener"
}
}

  If a locale is not submitted in the JWT payload, the responses from the Trust Payments gateway uses the default value English (United Kingdom). If the locale specified in the JWT payload is not a gateway supported locale, and invalid field error will be returned.

We recommend that you use the OS language for displaying the gateway responses. If the device language is not supported, your app should omit the locale from the JWT.

When providing an app in Norwegian language, we recommend that “no_NO” is submitted for locale in the JWT instead of “nb_NO” or “nn_NO”, as this is the most common Norwegian language setting for Android devices.

Retrieving the current system locale in Android can be achieved by:

 

v24 of API and newer

Kotlin Java
resources.configuration.locales.get(0)

 

v32 of API and older

Kotlin Java
resources.configuration.locale

 

Custom translations

You can specify custom translations for elements on the checkout form that will override the default text displayed.

This also allows you to provide alternative wording to the default phrases returned to better reflect your brand’s voice (e.g. re-wording the default error messages returned to customers).

To specify custom translations, you will need to override the default string resources in the language-specified strings.xml files, as is used in the standard Android localisation mechanism.

 

Default string resources to override

Strings in payment form Strings related to WebView
<string name="pvc_pan_label">Card number</string>
<string name="pvc_expiry_date_label">Expiry date</string>
<string name="pvc_expiry_date_hint">MM/YY</string>
<string name="pvc_cvv_label">CVV</string>
<string name="pvc_pay_button_text">Pay</string>
<string name="pvc_input_error_text">Invalid field</string>

 

Example: When overriding “Pay” to be “Pay now” in the payment form, you would need to create a strings.xml file for en-GB or en-US in your app resources and include the following:

<string name="pvc_pay_button_text">Pay now</string>

The same mechanism can be used for the creation of unsupported language versions.

  Error messages cannot be translated to an unsupported language or overridden in this way.

Was this article helpful?
0 out of 0 found this helpful