Skip to content

Commit

Permalink
[HOTFIX] Fixed ReactBindings export.
Browse files Browse the repository at this point in the history
* [HOTFIX] R16N strucutre import

* 1.0.2

* [HOTFIX] Changed how R16N exports React Bindings

* 1.0.3
  • Loading branch information
razodeh committed Jan 13, 2018
1 parent 83d7200 commit 0fbbf9f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 16 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ A binding for `getTranslation(state, key)`

**example**:
```javascript
import {Translation} from 'r16n/React';
import {ReactBindings} from 'r16n';
const {Translation} = ReactBindings;

// ... Inside your component.
<Translation tKey='text.apple'/>
// ...
Expand All @@ -190,7 +192,9 @@ Whenever `setLocale(...)` action is called with new locale, it re-renders with t

**example** :
```javascript
import {Date} from 'r16n/React'
import {ReactBindings} from 'r16n'
const {Date} = ReactBindings;

// ... Inside your component
<Date value={1514908177545} format="gggg-MM-ddd hh:mmA"/> // en-> 2018-01-Tue 05:49PM, ar-> ٢٠١٨-٠١-ثلاثاء ٠٥:٤٩م
// Different Formats for each locale.
Expand All @@ -206,7 +210,9 @@ A binding for localizing numbers.

**example** :
```javascript
import {Number} from 'r16n/React'
import {ReactBindings} from 'r16n'
const {Number} = ReactBindings;

// ... Inside your component
<Number value="1"/> // en-> 1, ar-> ١
<Number value={23232}/> // en-> 23,232 ar-> ٢٣٬٢٣٢
Expand Down
17 changes: 8 additions & 9 deletions examples/react-example/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import React from 'react';
import ReactDom from 'react-dom';
import { combineReducers, createStore, compose } from 'redux';
import { connect, Provider } from 'react-redux';
import {createR16nReducer, setLocale, getLocale, getTranslation} from '../../dist';
import {Number, Date} from '../../dist/React';
const Translation = require('../../dist/React').Translation;
import { createR16nReducer, setLocale, getLocale, getTranslation, ReactBindings } from 'r16n';
const { Translation, Number, Date } = ReactBindings;

const locales = {
en: {
Expand Down Expand Up @@ -48,7 +47,7 @@ const App = ({ text, locale, setLocale, r16nStore, dummyText }) =>
<button onClick={() => setLocale('en')}>
En
</button>

<h1>
{locale} -> {text}
</h1>
Expand All @@ -58,14 +57,14 @@ const App = ({ text, locale, setLocale, r16nStore, dummyText }) =>
<hr />
<h4>Translation</h4>
<Translation tKey="helloWorld" />
<br/>
<br />
<h4>Numbers</h4>
<Number value="1" />
<br/>
<br />
<h4>Dates</h4>
<Date value={1514908177545} format="gggg-MM-ddd hh:mmA"/><br/>
<Date value="2018-01-09T19:09:33+02:00" format={{ar: "gggg-MM-d ddd hh:mmA"}}/>
<br/>
<Date value={1514908177545} format="gggg-MM-ddd hh:mmA" /><br />
<Date value="2018-01-09T19:09:33+02:00" format={{ ar: "gggg-MM-d ddd hh:mmA" }} />
<br />
<div>
<h4>Store Structure</h4>
<pre>
Expand Down
1 change: 1 addition & 0 deletions examples/react-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"r16n": "^1.0.3",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-redux": "^5.0.6",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "r16n",
"version": "1.0.1",
"version": "1.0.3",
"description": "Redux internationalization. This library provides Redux reducer to translate strings, and React components to localize dates, and numbers.",
"main": "dist/index.js",
"main": "dist",
"files": [
"dist",
"examples"
Expand All @@ -12,7 +12,8 @@
"test:lint": "eslint src",
"build": "babel src -d dist",
"build:watch": "npm run build -- --watch",
"clean": "rimraf dist"
"clean": "rimraf dist",
"prepublish": "npm run build"
},
"repository": {
"type": "git",
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as ReactBindings from './React';
export { createR16nReducer } from './store_elements/reducer';
export { setLocale } from './store_elements/actions';
export { getTranslation, getLocale, getTranslations } from './store_elements/selectors';
export {ReactBindings};

0 comments on commit 0fbbf9f

Please sign in to comment.