setLocale()

The setLocale() method is used to set and get the preferred language for the Payment Element or Vaulting Element UI.

Method signature

copy
public void setLocale(Locale locale)

Parameters

Parameter

Data type

Required

Description

locale

String

No

Preferred language. Composed of a language code (ISO-639) and country code (ISO-3166) connected by an underscore, for example, new Locale("en", "US").

Valid values are:

  • en_US: Default value. English
  • pt_BR: Portuguese (Brazil)
  • pt_PT: Portuguese
  • es_ES: Spanish
  • ko_KR: Korean
  • zh_CN: Simplified Chinese
  • zh_HK: Traditional Chinese
  • ms_MY: Malay
  • in_ID: Indonesian
  • th_TH: Thai
  • vi_VN: Vietnamese
  • tl_PH: Filipino
  • it_IT: Italian
  • de_DE: German
  • fr_FR: French
  • nl_NL: Dutch
  • ja_JP: Japanese
  • ro: Romanian
  • pl_PL: Polish
  • ar_SA: Arabic
  • tr_TR: Turkish
  • hi_IN: Hindi

Note: If no value is passed or the language value passed is not within the above range, the system will default to using English.

Return value

Returns the currently configured language.