Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonYCHuang committed Feb 27, 2017
1 parent 6a9c55f commit cb75a4f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Contributors: please follow the recommendations outlined at [keepachangelog.com]
## [Unreleased]
*Please add entries here for your pull requests.*

### Added
- Allow using rake task to generate javascript locale files. [#717](https://github.com/shakacode/react_on_rails/pull/717) by [JasonYCHuang](https://github.com/JasonYCHuang).

### Fixed
- Upgrade Rails to 4.2.8 to fix security vulnerabilities in 4.2.5. [#735](https://github.com/shakacode/react_on_rails/pull/735) by [hrishimittal](https://github.com/hrishimittal).

Expand Down
17 changes: 5 additions & 12 deletions docs/basics/i18n.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Here's a summary of adding the I18n functionality.

You can refer to [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial) and [PR #340](https://github.com/shakacode/react-webpack-rails-tutorial/pull/340) for a complete example.

1. Add `react-intl` & `intl` to `client/package.json`, and remember to `bundle && npm install`.
1. Add `react-intl` & `intl` to `client/package.json`, and remember to `bundle && yarn install`.

```js
"dependencies": {
Expand Down Expand Up @@ -44,18 +44,11 @@ You can refer to [react-webpack-rails-tutorial](https://github.com/shakacode/rea
config.i18n_dir = Rails.root.join("PATH_TO", "YOUR_JS_I18N_FOLDER")
```
Add following lines to `config/application.rb`, this will help you to generate `translations.js` & `default.js` automatically when you starts the server.
4. Javascript locale files must be generated before `yarn build`.
Once you setup `config.i18n_dir` as in the previous step, react_on_rails will help you to do this.
```js
module YourModule
class Application < Rails::Application
...
config.after_initialize do
ReactOnRails::LocalesToJs.new
end
end
end
```
If you create your own Procfile files, you must add `bundle exec rake react_on_rails:locale` before `yarn build`.
5. In React, you need to initialize `react-intl`, and set parameters for it.
Expand Down

0 comments on commit cb75a4f

Please sign in to comment.