Skip to content

Internationalization Formatter and Type Formatter

Formatter Indicator

  • The indicator could be applied to all properties value including string literal, binding, globals, ActionBar, ToolBar, FormCell controls, SectionedTable controls, Extension controls (with separate i18n strings resource files under same extension folder).

  • The optional parameters could be skipped with empty or null in order to pass the next optional parameters.

  • It is allowed to concatenate string literal with indicator, i.e. "Some text is combined with $(L,key)".

  • It is also allowed to have multiple indicators on one property value, i.e. "$(L,key1) combined with $(N,key2) and $(DT, key3)".

  • It is advised to add single quote (\') on string literal within the indicator to mark the start and end of the string value, i.e. $(N,'string value') or $(L,key,'string parameter').

  • Current supported types are:

    • L: Localized String
    • N: Number
    • C: Currency
    • S: Scientific
    • P: Percentage
    • DT: Date and Time
    • D: Date
    • T: Time

Localized String Formatter

Return the localized string for the specified key according to the device's or app's current locale.

Usage:

$(L, <LocalizationKey>, <AdditionalParam1>, <AdditionalParam2>, ...)

Parameters:

Parameter Name Type Required? Description
Localization Key String Literal Mandatory Key defined the localization properties file
Additional Param X String Literal, Binding Optional Value for format parameter

Example:

  • $(L,description_key)
  • $(L,description_key,'dynamic param 1','dynamic param 2')

Number Formatter

Format the provided value as number according to the device's or app's current locale and format options (if provided)

Usage:

$(N, <Value>, <Locale>, <Format Options>)

Parameters:

Parameter Name Type Required? Description
Value String Literal, Binding Mandatory Value to be formatted
Locale String Literal Optional Optional locale. If not provided, the value will be formatted with the current device/app locale
Format Options JSON Object Optional Optional format options. See Format Options for details

Example:

  • $(N,123456.789)
  • $(N,{NumberField})
  • $(N,123456.789,'de-DE')
  • $(N,123456.789,'de-DE',{maximumFractionDigits:2,useGrouping:true})
  • $(N,123456.789,'',{maximumFractionDigits:2,useGrouping:true})
  • $(N,123456.789,null,{maximumFractionDigits:2,useGrouping:true})

Currency Formatter

Format the provided value as currency according to the specified currency code, device's current locale and format options (if provided)

Usage:

$(C, <Value>, <Currency Code>, <Locale>, <Format Options>)

Parameters:

Parameter Name Type Required? Description
Value String Literal, Binding Mandatory Value to be formatted
Currency Code String Literal, Binding Mandatory Currency Code to be used in the formatter
Locale String Literal Optional Optional locale. If not provided, the value will be formatted with the current device/app locale
Format Options JSON Object Optional Optional format options. See Format Options for details

Example:

  • $(C,123456.789,'USD')
  • $(C,{CurrencyField},{CurrencyCode})
  • $(C,123456.789,'USD','de-DE')
  • $(C,123456.789,'USD','de-DE',{maximumFractionDigits:2,useGrouping:true})
  • $(C,123456.789,'USD','',{maximumFractionDigits:2,useGrouping:true})
  • $(C,123456.789,'USD',null,{maximumFractionDigits:2,useGrouping:true})

Percentage Formatter

Format the provided value as percentage according to the device's or app's current locale and format options (if provided).

Usage:

$(P, <Value>, <Locale>, <Format Options>)

Parameters:

Parameter Name Type Required? Description
Value String Literal, Binding Mandatory Value to be formatted
Locale String Literal Optional Optional locale. If not provided, the value will be formatted with the current device/app locale
Format Options JSON Object Optional Optional format options. See Format Options for details

Example:

  • $(P,0.7865)
  • $(P,{PercentageField})
  • $(P,0.7865,'de-DE')
  • $(P,0.7865,'de-DE',{maximumFractionDigits:2,useGrouping:true})
  • $(P,0.7865,'',{maximumFractionDigits:2,useGrouping:true})
  • $(P,0.7865,null,{maximumFractionDigits:2,useGrouping:true})

Scientific Notation Formatter

Format the provided value as scientific notation according to the device's or app's current locale and format options (if provided)

Usage:

$(S, \<Value>, \<Locale>, \<Format Options>)

Parameters:

Parameter Name Type Required? Description
Value String Literal, Binding Mandatory Value to be formatted
Locale String Literal Optional Optional locale. If not provided, the value will be formatted with the current device/app locale
Format Options JSON Object Optional Optional format options. See Format Options for details

Example:

  • $(S,123456.789)
  • $(S,{ScientificNotationField})
  • $(S,123456.789,'de-DE')
  • $(S,123456.789,'de-DE',{maximumFractionDigits:2,useGrouping:true})
  • $(S,123456.789,'',{maximumFractionDigits:2,useGrouping:true})
  • $(S,123456.789,null,{maximumFractionDigits:2,useGrouping:true})

Date and Time Formatter

Format the provided date-time value according to the device's or app's current locale and timezone. The result will include date and time portion.

Usage:

$(DT, <Value>, <Locale>, <Timezone>)

Parameters:

Parameter Name Type Required? Description
Value String Literal, Binding Mandatory Value to be formatted. If literal string is passed, formatter will always assume timezone is UTC+0
Locale String Literal Optional Optional locale. If not provided, the value will be formatted with the current device/app locale
Timezone String Literal Optional Optional locale. If not provided device's current timezone will be used
Format Options JSON Object Optional Optional format options. See Format Options for details

Example:

  • $(DT,'2017-12-25T11:40:00Z')
  • $(DT,{DateTimeField})
  • $(DT,'2017-12-25T11:40:00Z','de-DE')
  • $(DT,'2017-12-25T11:40:00Z','de-DE',Europe/Berlin')
  • $(DT,'2017-12-25T11:40:00Z','','Europe/Berlin')
  • $(DT,'2017-12-25T11:40:00Z',null,'Europe/Berlin')
  • $(DT,'2017-12-25T11:40:00Z',null,'Europe/Berlin',{format:'long'})

Date Formatter

Format the provided date-time value according to the device's or app's current locale and timezone. The result will only include date portion.

Usage:

$(D, <Value>, <Locale>, <Timezone>)

Parameters:

Parameter Name Type Required? Description
Value String Literal, Binding Mandatory Value to be formatted. If literal string is passed, formatter will always assume timezone is UTC+0
Locale String Literal Optional Optional locale. If not provided, the value will be formatted with the current device/app locale
Timezone String Literal Optional Optional locale. If not provided device's current timezone will be used
Format Options JSON Object Optional Optional format options. See Format Options for details

Example:

  • $(D,'2017-12-25T11:40:00Z')
  • $(D,{DateField})
  • $(D,'2017-12-25T11:40:00Z','de-DE')
  • $(D,'2017-12-25T11:40:00Z','de-DE','Europe/Berlin')
  • $(D,'2017-12-25T11:40:00Z','','Europe/Berlin')
  • $(D,'2017-12-25T11:40:00Z',null,'Europe/Berlin')
  • $(D,'2017-12-25T11:40:00Z',null,'Europe/Berlin',{format:'long'})

Time Formatter

Format the provided date-time value according to the device's or app's current locale and timezone. The result will only include time portion.

Usage:

$(T, <Value>, <Locale>, <Timezone>)

Parameters:

Parameter Name Type Required? Description
Value String Literal, Binding Mandatory Value to be formatted. If literal string is passed, formatter will always assume timezone is UTC+0
Locale String Literal Optional Optional locale. If not provided, the value will be formatted with the current device/app locale
Timezone String Literal Optional Optional locale. If not provided device's current timezone will be used
Format Options JSON Object Optional Optional format options. See Format Options for details

Example:

  • $(T,'2017-12-25T11:40:00Z')
  • $(T,{TimeField})
  • $(T,'2017-12-25T11:40:00Z','de-DE')
  • $(T,'2017-12-25T11:40:00Z','de-DE','Europe/Berlin')
  • $(T,'2017-12-25T11:40:00Z','','Europe/Berlin')
  • $(T,'2017-12-25T11:40:00Z',null,'Europe/Berlin')
  • $(T,'2017-12-25T11:40:00Z',null,'Europe/Berlin',{format:'long'})

Format Options

Parameter Name Supported Format Type Required? Description
minimumIntegerDigits Number, Currency, Scientific, Percentage Integer Literal Optional The number of integer digits allowed as output. Default is 1 (System default).
minimumFractionDigits Number, Currency, Scientific, Percentage Integer Literal Optional The minimum number of digits after the decimal separator allowed as output. Default is 0 (System default).
maximumFractionDigits Number, Currency, Scientific, Percentage Integer Literal Optional The maximum number of digits after the decimal separator allowed as output. Default is 2 (MDK default, not applicable for currency).
useGrouping Number, Currency, Scientific, Percentage Boolean Literal Optional Determines whether the display should show the group separator. Default is true (MDK default, not applicable for currency).
format Date, Time, DateTime String Literal Optional Display date and time in the specified format. Supported format style: short, medium, long, full. Default for date is medium. Default for time is short. (MDK default)
  • For Currency, the default for supported properties is managed by system default based on currency code.

Last update: March 31, 2020