Localization

Message Templates provide localization support out-of-the-box. Message Templates sent to a user will be localized according to the device locale settings. A business can also optionally specify a fallback locale for displaying the message if a translation does not exist.

This document covers:

Localizable Parameters

Some Message Template parameters (e.g., date/time, prices, etc.) should be displayed differently depending on the client's language/locale. See the Localizable Parameters documentation for more information.

If the device is unsuccessful in localizing a parameter, it should fall back to using the HSMLocalizableParameter's default string.

HSMLocalizableParameter

NameTypeRequiredDescription

default

String

Yes

Default text if localization fails

currency

HSMCurrency

No

Localization spec for currency

date_time

HSMDateTime

No

Localization spec for date/time

The currency and date_time fields are not required, but only one of them can be present if used.

Currency

The Whatsapp Business API Client will attempt to format the currency based on a specified localization.

HSMCurrency

NameTypeRequiredDescription

currency_code

String

Yes

Currency code as defined in ISO 4217

amount_1000

Integer

Yes

Amount multipled by 1000

Dates & Times

The Whatsapp Business API Client will attempt to format the date/time based on a specified localization. The supported date and time formats include:

  • Component Time — The time is assembled from components (i.e., day of the week, month, hour, etc.) The time specified will be the same, regardless of the time zone the client is in.
  • Unix Time — The time to be displayed is dependent on the time zone the client is in.

HSMDateTime

NameTypeRequiredDescription

component

HSMDateTimeComponent

No

Date/time by component

unix_epoch

HSMDateTimeUnixEpoch

No

Date/time by Unix epoch

The component and unix_epoch fields are not required, but only one of them can be present if used.

HSMDateTimeComponent

NameTypeRequiredDescription

day_of_week

String

No

Both strings and numbers are accepted. If different from the value derived from the date (if specified), use the derived value.
Options: "MONDAY", 1, "TUESDAY", 2, "WEDNESDAY", 3, "THURSDAY", 4, "FRIDAY", 5, "SATURDAY", 6, "SUNDAY", 7

year

Integer

No

The year

month

Integer

No

The month

day_of_month

Integer

No

The day of month

hour

Integer

No

The hour

minute

Integer

No

The minute

calendar

String

No

Type of calendar
Options: GREGORIAN, SOLAR_HIJRI

HSMDateTimeUnixEpoch

HSMDateTimeUnixEpoch will be deprecated in May 2020. HSMDateTimeComponent will be the default going forward. Please make changes to your code to avoid issues.

NameTypeRequiredDescription

timestamp

Integer

Yes

Epoch timestamp in seconds