Skip to content

Releases: alibaba/react-intl-universal

Load Multiple Locale Data

03 Apr 02:52
c8e1990
Compare
Choose a tag to compare

Add load function to support loading multiple locale data.
An example is shown in the test file.

This release fixes #46.

Suppport Typescript

28 Dec 05:00
Compare
Choose a tag to compare

Typescript declaration file added.

Thanks @giespaepen for the contribution.

Load Common Locale Data from CDN on Demand

12 Dec 13:10
Compare
Choose a tag to compare

For browser rendering, the common locale data such as date, currency, and number format are automatically loaded from CDN on demand.

For server-side rendering, they should be added in your application as shown in the example.

// For Node.js
import IntlPolyfill from "intl";
global.Intl = IntlPolyfill;
require('intl/locale-data/jsonp/en.js');
require('intl/locale-data/jsonp/zh.js');
require('intl/locale-data/jsonp/fr.js');
require('intl/locale-data/jsonp/ja.js');

Add getInitOptions() function

27 Nov 15:42
de671f4
Compare
Choose a tag to compare

Some developers would like to get the initial options such as currentLocale at some other files. Here you are.

FileA.js

import intl from 'react-intl-universal';
intl.init({ locales, currentLocale: "en-US" });

FileB.js

import intl from 'react-intl-universal';
const { currentLocale } = intl.getInitOptions();
console.log(currentLocale); // "en-US"

Support non-nested locale json file for key with dot

23 Nov 15:49
Compare
Choose a tag to compare

Upgrade intl-messageformat to v2.2.0.

To fix values for 0 issue.

Support non-nested locale json file for key with dot.

In v1.4.3, the nested locale file is supported,

{
  "page1": {
    "hello": "Hello world",
  }
}

Then, it will get the nested json correctly.

intl.get('page1.hello'); // "Hello world"

However, some developer like to use dot as separator in the key,
For example, the locale file is as following,

{
  "page1.hello": "Hello world"
}

In this release, if the locale json file isn't nested, it will return correct value.

intl.get('page1.hello'); // "Hello world"

Support nested JSON locale data

25 Sep 05:06
Compare
Choose a tag to compare

This release supports nested JSON locale data (#20). Here is example:

locale data:

{
  "page1": {
    "hello": "Hello world",
  },
  "page2": {
    "hello": "Hello react-intl-universal!",
  }
}

JS:

intl.get('page1.hello'); // "Hello world"
intl.get('page2.hello'); // "Hello react-intl-universal!"

Thanks @elgalesmana for the contribution.

Fix Build Problem

15 Aug 05:44
Compare
Choose a tag to compare

This release fixes #15, #16, #17, and #19.
The build size and time is as following.

browser-example node-js-example
Size 118.35 KB 90.14 KB
Time 20.03s 18.04s

Support node.js for server-side render (SSR)

09 Jul 07:15
Compare
Choose a tag to compare
  • fix window is not defined (SSR) #9

Mirror react-intl API

18 Jun 15:47
Compare
Choose a tag to compare

New Feature:

  • Mirror react-intl API #2
  • Shorten defaultMessage method #4