react-intl-universal
Advanced tools
Comparing version 2.1.3 to 2.1.4
{ | ||
"name": "react-intl-universal", | ||
"version": "2.1.3", | ||
"version": "2.1.4", | ||
"description": "Internationalize React apps. Not only for React.Component but also for Vanilla JS.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -260,21 +260,9 @@ # react-intl-universal | ||
### Common Locale Data | ||
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](https://github.com/alibaba/react-intl-universal/blob/master/examples/node-js-example/src/App.js#L11-L16). | ||
```js | ||
// 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'); | ||
``` | ||
### Helper | ||
[react-intl-universal](https://www.npmjs.com/package/react-intl-universal) provides a utility helping developer determine the user's `currentLocale`. As the running examples, when user select a new locale, it redirect user new location like `http://localhost:3000?lang=en-US`. Then, we can use `intl.determineLocale` to get the locale from URL. It can also support determine user's locale via cookie, localStorage, and browser default language. Refer to the APIs section for more detail. | ||
## App Examples | ||
- [Browser rendering](https://github.com/alibaba/react-intl-universal/blob/master/examples/browser-example/src/App.js) | ||
- [Server-side rendering](https://github.com/alibaba/react-intl-universal/blob/master/examples/node-js-example/src/App.js) | ||
## APIs Definition | ||
@@ -402,21 +390,2 @@ | ||
## Running Examples Locally | ||
```sh | ||
git clone git@github.com:alibaba/react-intl-universal.git | ||
``` | ||
For browser rendering, | ||
```sh | ||
cd react-intl-universal/examples/browser-example | ||
npm install | ||
npm start | ||
``` | ||
For server-side rendering, | ||
```sh | ||
cd react-intl-universal/examples/node-js-example | ||
npm install | ||
npm start | ||
``` | ||
## Tools | ||
@@ -423,0 +392,0 @@ - [react-intl-universal-pseudo-converter](https://github.com/ceszare/react-intl-universal-pseudo-converter): A [pseudo-localization](https://en.wikipedia.org/wiki/Pseudolocalization) tool for testing internationalization. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34148
394