Skip to content

Latest commit

 

History

History
38 lines (25 loc) · 1.95 KB

TRANSLATION_GUIDE.md

File metadata and controls

38 lines (25 loc) · 1.95 KB

Translation Guide

This project uses ICU message format.

Formatted arguments

Formatted arguments are the preferred way of formatting. Custom formatting functions are allowed if the output is not part of the message (i.e. non translated value embeded directly in the markup) or if required formatting cannot be achieved using ICU format.

Number skeleton

Common number formatting options (in concise syntax) and their mapping to Intl.NumberFormat properties (used for custom formatting functions):

  1. minimumIntegerDigits: 1 -> 0 (integer-width)
  2. minimumFractionDigits: 0, maximumFractionDigits: 0 -> . (equivalent to precision-integer )
  3. minimumFractionDigits: 1, maximumFractionDigits: 1 -> .0 (fraction-precision)
  4. useGrouping: false -> ,_ (group-off)
  5. style: 'percent' -> % (percent unit)

Given the following message:

 dashboardUtilizationCardAvailableOfPercent: {
    id: 'dashboard.utilizationCardAvailableOfPercent',
    defaultMessage: 'of {percent, number, :: scale/0.01 % .  0 ,_ }',
    description: 'part of utilization card\'s summary',
 }

when we call msg.dashboardUtilizationCardAvailableOfPercent({ percent: 1234.5 }), using en-US locales, the output will be:

of 1235%

Full reference is available here.