github formatjs/formatjs v1.2.0
v1.2.0 — React 0.13+ Support, Updated Locale Data

latest releases: react-intl@6.6.5, eslint-plugin-formatjs@4.13.0, @formatjs/editor@2.0.45...
9 years ago

This feature release updates React Intl's dependency on react to support 0.11.2 up to 1.0.0 (#79), has updated locale data to fix zh-Hant (#78) plus adds support for new locales, adds select-ordinal argument support to messages, and allows a "now" date to be specified on <FormattedRelative> (#94).

React 0.13+ Support

React Intl has a hard dependency on React, but stays on the happy path in terms of which React features are used. The React team has also been great with their back-compat support, so we feel confident on the change to allow React Intl to automatically opt-into all future 0.x React releases.

There's a good discussion in #79 about whether we should move React to peerDependencies. What we've concluded is that the current situation of with this React Intl's dependency on React not being flexible enough to work with future React releases is temporary — It's a symptom of React being in a 0.x major version. Once React moves to 1.x this problem goes away; but for the time being we're confident in treating React's 0.x version as if it were 1.x.

Updated Locale Data

This release has vastly improved locale data in the following ways:

  • Added locale data for all leaf locales which differ from their root locale's data; e.g. "zh-Hant-TW" is not the same as "zh".
  • Properly de-duplicate data for all CLDR locales by correctly traversing a locale's hierarchy of ancestor locales.
  • Added data for the following languages:
    aa, agq, bas, bh, ckb, dav, dje, dsb, dua, dv, dyo, ebu, ewo, guw, guz, hsb, ia, in, iu, iw, jbo, ji, jv, jw, kaj, kam, kcg, khq, ki, kln, kok, ksf, ku, lb, lu, luo, luy, mer, mfe, mgh, mo, mua, nah, nmg, no, nqo, nus, ny, pap, prg, qu, rn, rw, sbp, sh, sma, smi, smj, smn, sms, swc, syr, tk, tl, twq, vai, wa, wo, yav, yi, zgh

Added selectordinal Support for Messages

This release adds support for selectordinal arguments in messages, which are just like plural arguments, expect the ordinal pluralization rules are used; e.g., to display which birthday your about to have:

It's my {year, selectordinal,
    one {#st}
    two {#nd}
    few {#rd}
    other{#th}
} birthday!

Added now Prop to <FormattedRelative> Component

Added support for specifying the "now" value from which relative time is computed. This change adds a new optional prop now to the component which will pass along that value to IntlRelativeFormat#format() method.

Other Bug Fixes

  • Fixed propsTypes to propTypes typo in Intl Mixin (#90, @lencioni)

Checkout the full set of changes since the last release for more details.

Don't miss a new formatjs release

NewReleases is sending notifications on new releases.